Skip to content

Commit

Permalink
Load i18n messages for the default locale
Browse files Browse the repository at this point in the history
  • Loading branch information
SKarolFolio committed Nov 11, 2024
1 parent 5233982 commit 8b15888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -54,7 +55,7 @@ const createRouter = (basename: string) => createBrowserRouter(routes, { basenam
const Container: FC<IContainer> = ({ 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<string, string>);
Expand Down
4 changes: 2 additions & 2 deletions src/providers/AsyncIntlProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLoadI18nMessages } from '@common/hooks/useLoadI18nMessages';
import state from '@state';

type AsyncIntlProviderProps = {
cachedMessages: Record<string, Record<string, string>>;
cachedMessages: I18nMessages;
children: React.ReactNode;
};

Expand All @@ -16,7 +16,7 @@ export const AsyncIntlProvider: FC<AsyncIntlProviderProps> = ({ cachedMessages,
const i18nMessages = getMessages(locale);

return (
<IntlProvider messages={i18nMessages || {}} locale={locale} defaultLocale="en-US">
<IntlProvider messages={i18nMessages || {}} locale={locale} defaultLocale="en">
{children}
</IntlProvider>
);
Expand Down

0 comments on commit 8b15888

Please sign in to comment.