From d3781b1c4ab23d49e93109ea224ab3533dc0b7f0 Mon Sep 17 00:00:00 2001 From: kabeep Date: Thu, 9 May 2024 21:35:42 +0800 Subject: [PATCH] fix: capitalized correction for native name --- src/core/iso-639-1-x.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/iso-639-1-x.ts b/src/core/iso-639-1-x.ts index 0780fd3..b635fe5 100644 --- a/src/core/iso-639-1-x.ts +++ b/src/core/iso-639-1-x.ts @@ -34,7 +34,7 @@ class Iso6391X { * @returns {string} - The name of the language. */ getName(code: string) { - return additionalCodes[code.toString() as AdditionalCode]?.name ?? iso6391.getName(code); + return additionalCodes[code.toLowerCase() as AdditionalCode]?.name ?? iso6391.getName(code); } /** @@ -51,7 +51,7 @@ class Iso6391X { * @returns {string} - The native name of the language. */ getNativeName(code: string) { - return additionalCodes[code.toString() as AdditionalCode]?.nativeName ?? iso6391.getNativeName(code); + return additionalCodes[code.toLowerCase() as AdditionalCode]?.nativeName ?? iso6391.getNativeName(code); } /** @@ -93,7 +93,7 @@ class Iso6391X { for (const code of codes) { if (has(additionalCodes, code.toLowerCase())) { googleLanguages.push({ - code: code as LanguageCode, + code: code.toLowerCase() as LanguageCode, ...(additionalCodes as Record)[code], }); } else {