Commit ca336af4 authored by Steven's avatar Steven

chore: update locale checks

parent 7ec5d07c
...@@ -24,17 +24,22 @@ const LocaleSelect: FC<Props> = (props: Props) => { ...@@ -24,17 +24,22 @@ const LocaleSelect: FC<Props> = (props: Props) => {
onChange={(_, value) => handleSelectChange(value as Locale)} onChange={(_, value) => handleSelectChange(value as Locale)}
> >
{availableLocales.map((locale) => { {availableLocales.map((locale) => {
try {
const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale); const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale);
if (languageName === undefined) { if (languageName) {
return ( return (
<Option key={locale} value={locale}> <Option key={locale} value={locale}>
{locale} {languageName.charAt(0).toUpperCase() + languageName.slice(1)}
</Option> </Option>
); );
} }
} catch (error) {
// do nth
}
return ( return (
<Option key={locale} value={locale}> <Option key={locale} value={locale}>
{languageName.charAt(0).toUpperCase() + languageName.slice(1)} {locale}
</Option> </Option>
); );
})} })}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment