mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-16 09:41:31 +10:00
chore(i18n): update zu-ZA translations
This commit is contained in:
@ -1,27 +1,34 @@
|
||||
import "@/client/libs/dayjs";
|
||||
|
||||
import { i18n } from "@lingui/core";
|
||||
import { detect, fromNavigator, fromStorage, fromUrl } from "@lingui/detect-locale";
|
||||
import { detect, fromNavigator, fromUrl } from "@lingui/detect-locale";
|
||||
import { I18nProvider } from "@lingui/react";
|
||||
import get from "lodash.get";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { defaultLocale, dynamicActivate } from "../libs/lingui";
|
||||
import { useAuthStore } from "../stores/auth";
|
||||
import { useResumeStore } from "../stores/resume";
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export const LocaleProvider = ({ children }: Props) => {
|
||||
const userLocale = useAuthStore((state) => get(state.user, "locale", null));
|
||||
const resumeLocale = useResumeStore((state) => get(state.resume, "data.metadata.locale", null));
|
||||
|
||||
useEffect(() => {
|
||||
const detectedLocale = detect(
|
||||
resumeLocale,
|
||||
userLocale,
|
||||
fromUrl("lang"),
|
||||
fromStorage("lang"),
|
||||
fromNavigator(),
|
||||
defaultLocale,
|
||||
)!;
|
||||
|
||||
dynamicActivate(detectedLocale);
|
||||
}, []);
|
||||
}, [userLocale, resumeLocale]);
|
||||
|
||||
return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user