diff options
author | Jamie Guthrie <jamie.guthrie@gmail.com> | 2023-08-16 18:58:41 +0200 |
---|---|---|
committer | Jamie Guthrie <jamie.guthrie@gmail.com> | 2023-08-16 18:58:41 +0200 |
commit | 348b8ea777ed7695f50db430fbff6a1c59938c54 (patch) | |
tree | 7670b8d20077662977147a9948d9c0fd0e6d5f8f | |
parent | f97f41ca860f262ce51fce481b1d4817e9ae9bfb (diff) | |
download | trackermap-web-348b8ea777ed7695f50db430fbff6a1c59938c54.tar.gz trackermap-web-348b8ea777ed7695f50db430fbff6a1c59938c54.tar.bz2 trackermap-web-348b8ea777ed7695f50db430fbff6a1c59938c54.zip |
Localization falls back to 'en' if translation cannot be found
-rw-r--r-- | modern/src/common/components/LocalizationProvider.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modern/src/common/components/LocalizationProvider.js b/modern/src/common/components/LocalizationProvider.js index 6bc64831..9c51841c 100644 --- a/modern/src/common/components/LocalizationProvider.js +++ b/modern/src/common/components/LocalizationProvider.js @@ -178,7 +178,7 @@ export const useLocalization = () => useContext(LocalizationContext); export const useTranslation = () => { const context = useContext(LocalizationContext); const { data } = context.languages[context.language]; - return useMemo(() => (key) => data[key], [data]); + return useMemo(() => (key) => (data[key] ? data[key] : context.languages.en.data[key]), [data]); }; export const useTranslationKeys = (predicate) => { |