From ca336af4faa98818ec1dca422f1fb4ce958802eb Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 10 Sep 2023 10:53:37 +0800 Subject: [PATCH] chore: update locale checks --- web/src/components/LocaleSelect.tsx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/web/src/components/LocaleSelect.tsx b/web/src/components/LocaleSelect.tsx index de50785d..1251ff88 100644 --- a/web/src/components/LocaleSelect.tsx +++ b/web/src/components/LocaleSelect.tsx @@ -24,17 +24,22 @@ const LocaleSelect: FC = (props: Props) => { onChange={(_, value) => handleSelectChange(value as Locale)} > {availableLocales.map((locale) => { - const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale); - if (languageName === undefined) { - return ( - - ); + try { + const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale); + if (languageName) { + return ( + + ); + } + } catch (error) { + // do nth } + return ( ); })}