Skip to content

Commit

Permalink
Show error on i18n language change
Browse files Browse the repository at this point in the history
  • Loading branch information
schroda committed Dec 20, 2024
1 parent 3949363 commit 083f98e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@
"warning": "Warning"
},
"language": {
"error": {
"load": "Could not load language"
},
"label": {
"language": "Language",
"language_with_code": "Language with code: {{code}}"
Expand Down
8 changes: 7 additions & 1 deletion src/modules/settings/screens/Appearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ export const Appearance = () => {
/>
<Select
value={i18nResources.includes(i18n.language as I18nResourceCode) ? i18n.language : 'en'}
onChange={({ target: { value: language } }) => i18n.changeLanguage(language)}
onChange={({ target: { value: language } }) =>
i18n.changeLanguage(language, (e) => {
if (e) {
makeToast(t('global.language.error.load'), 'error', getErrorMessage(e));
}
})
}
>
{i18nResources.map((language) => (
<MenuItem key={language} value={language}>
Expand Down

0 comments on commit 083f98e

Please sign in to comment.