aboutsummaryrefslogtreecommitdiff
path: root/modern/src/LocalizationProvider.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-09-02 23:20:12 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-09-02 23:20:12 -0700
commite6f906dbb565abdb29297ec67db3c922135c628c (patch)
treea6d1c89436d066ec9171b6a68e8d5e7eeb56d2de /modern/src/LocalizationProvider.js
parente5f07d30df69c1fff28cf1ff8502e4843a8b543c (diff)
downloadetbsa-traccar-web-e6f906dbb565abdb29297ec67db3c922135c628c.tar.gz
etbsa-traccar-web-e6f906dbb565abdb29297ec67db3c922135c628c.tar.bz2
etbsa-traccar-web-e6f906dbb565abdb29297ec67db3c922135c628c.zip
Migrate components
Diffstat (limited to 'modern/src/LocalizationProvider.js')
-rw-r--r--modern/src/LocalizationProvider.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/modern/src/LocalizationProvider.js b/modern/src/LocalizationProvider.js
index 8441968..bf454e7 100644
--- a/modern/src/LocalizationProvider.js
+++ b/modern/src/LocalizationProvider.js
@@ -158,10 +158,12 @@ export const useLocalization = () => {
export const useTranslation = () => {
const context = useContext(LocalizationContext);
- return (key) => context.languages[context.language].data[key];
+ const data = context.languages[context.language];
+ return (key) => data[key];
};
export const useTranslationKeys = (predicate) => {
const context = useContext(LocalizationContext);
- return Object.keys(context.languages[context.language].data).filter(predicate);
+ const data = context.languages[context.language];
+ return Object.keys(data).filter(predicate);
};