fix: language flags
This commit is contained in:
parent
82fdd0f21c
commit
01261b6f3a
|
@ -45,7 +45,8 @@ const languageToFlagMap: Record<string, string> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getFlagEmoji(languageCode?: string): string | undefined {
|
export function getFlagEmoji(languageCode?: string): string | undefined {
|
||||||
const language = languageCode?.split("-").pop()?.toLowerCase();
|
if (!languageCode) return;
|
||||||
if (!language) return;
|
const language = languageCode.split("-").shift()?.toLowerCase();
|
||||||
return languageToFlagMap[language];
|
if (language == null) return;
|
||||||
|
return languageToFlagMap[language] ?? `[${language.toUpperCase()}]`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue