From 8b1588806df6071d645fd25b8f9b28865d509d05 Mon Sep 17 00:00:00 2001 From: Siarhei Karol Date: Mon, 11 Nov 2024 18:11:20 +0500 Subject: [PATCH] Load i18n messages for the default locale --- src/App.tsx | 3 ++- src/providers/AsyncIntlProvider.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 41384545..c375c6e9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,7 @@ import { OKAPI_CONFIG } from '@common/constants/api.constants'; import { localStorageService } from '@common/services/storage'; import { Root, Search, EditWrapper, ExternalResourcePreview } from '@views'; import state from '@state'; +import en from '../translations/ui-linked-data/en.json'; import { AsyncIntlProvider, ServicesProvider } from './providers'; import './App.scss'; @@ -54,7 +55,7 @@ const createRouter = (basename: string) => createBrowserRouter(routes, { basenam const Container: FC = ({ routePrefix = '', config }) => { const setCustomEvents = useSetRecoilState(state.config.customEvents); const setHasNavigationOrigin = useSetRecoilState(state.config.hasNavigationOrigin); - const cachedMessages = useRef({}); + const cachedMessages = useRef({ en }); useEffect(() => { setCustomEvents(config?.customEvents as Record); diff --git a/src/providers/AsyncIntlProvider.tsx b/src/providers/AsyncIntlProvider.tsx index 03ee505d..283fdb09 100644 --- a/src/providers/AsyncIntlProvider.tsx +++ b/src/providers/AsyncIntlProvider.tsx @@ -5,7 +5,7 @@ import { useLoadI18nMessages } from '@common/hooks/useLoadI18nMessages'; import state from '@state'; type AsyncIntlProviderProps = { - cachedMessages: Record>; + cachedMessages: I18nMessages; children: React.ReactNode; }; @@ -16,7 +16,7 @@ export const AsyncIntlProvider: FC = ({ cachedMessages, const i18nMessages = getMessages(locale); return ( - + {children} );