Added fallback for invalid locale (#3962)
This commit is contained in:
parent
b0ce0bb181
commit
3d031c79e1
1 changed files with 7 additions and 2 deletions
|
@ -68,8 +68,13 @@ export type BundleForm = {
|
|||
messageBundle: KeyValueType;
|
||||
};
|
||||
|
||||
const localeToDisplayName = (locale: string) =>
|
||||
new Intl.DisplayNames([locale], { type: "language" }).of(locale);
|
||||
const localeToDisplayName = (locale: string) => {
|
||||
try {
|
||||
return new Intl.DisplayNames([locale], { type: "language" }).of(locale);
|
||||
} catch (error) {
|
||||
return locale;
|
||||
}
|
||||
};
|
||||
|
||||
export const LocalizationTab = ({ save, realm }: LocalizationTabProps) => {
|
||||
const { t } = useTranslation("realm-settings");
|
||||
|
|
Loading…
Reference in a new issue