Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: update locale checks

Stevenca336af4faa9
diff --git a/web/src/components/LocaleSelect.tsx b/web/src/components/LocaleSelect.tsx
index de50785d3..1251ff888 100644
--- a/web/src/components/LocaleSelect.tsx
+++ b/web/src/components/LocaleSelect.tsx
@@ -24,17 +24,22 @@ const LocaleSelect: FC<Props> = (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 (
- <Option key={locale} value={locale}>
- {locale}
- </Option>
- );
+ try {
+ const languageName = new Intl.DisplayNames([locale], { type: "language" }).of(locale);
+ if (languageName) {
+ return (
+ <Option key={locale} value={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>
);
})}