|
|
|
@ -24,17 +24,22 @@ const LocaleSelect: FC<Props> = (props: Props) => {
|
|
|
|
|
onChange={(_, value) => handleSelectChange(value as Locale)}
|
|
|
|
|
>
|
|
|
|
|
{availableLocales.map((locale) => {
|
|
|
|
|
try {
|
|
|
|
|
const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale);
|
|
|
|
|
if (languageName === undefined) {
|
|
|
|
|
if (languageName) {
|
|
|
|
|
return (
|
|
|
|
|
<Option key={locale} value={locale}>
|
|
|
|
|
{locale}
|
|
|
|
|
{languageName.charAt(0).toUpperCase() + languageName.slice(1)}
|
|
|
|
|
</Option>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
// do nth
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Option key={locale} value={locale}>
|
|
|
|
|
{languageName.charAt(0).toUpperCase() + languageName.slice(1)}
|
|
|
|
|
{locale}
|
|
|
|
|
</Option>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|