From e6f906dbb565abdb29297ec67db3c922135c628c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 2 Sep 2021 23:20:12 -0700 Subject: Migrate components --- modern/src/LocalizationProvider.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modern/src/LocalizationProvider.js') diff --git a/modern/src/LocalizationProvider.js b/modern/src/LocalizationProvider.js index 84419683..bf454e71 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); }; -- cgit v1.2.3