plan/react-rewrite #1

Merged
gnezim merged 138 commits from plan/react-rewrite into main 2026-04-15 12:21:16 +03:00
Showing only changes of commit 7103b9ffb1 - Show all commits
+36
View File
@@ -0,0 +1,36 @@
import {
I18nextProvider,
useTranslation as useTranslationOriginal,
} from "react-i18next";
import type { ReactNode } from "react";
import type i18next from "i18next";
/**
* Wraps the i18next provider. All downstream code accesses translations
* through this provider and the re-exported hooks below.
*/
export function I18nProvider({
i18n,
children,
}: {
i18n: typeof i18next;
children: ReactNode;
}): JSX.Element {
return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
}
/**
* Re-export of react-i18next's useTranslation. Feature code MUST import
* from "@/i18n/provider", never from "react-i18next" directly (enforced
* by the no-restricted-imports ESLint rule in 1A-3).
*/
export const useTranslation = useTranslationOriginal;
/**
* Convenience alias for accessing the i18next instance from context.
* Same as useTranslation().i18n.
*/
export function useI18n(): typeof i18next {
const { i18n } = useTranslation();
return i18n;
}