All files / apps/web/src/hooks use-i18-helper.ts

83.33% Statements 5/6
0% Branches 0/2
100% Functions 2/2
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                          332x 1666x 1666x 328x     328x      
import React from "react";
 
import type { i18n } from "i18next";
import { useTranslation } from "react-i18next";
 
declare global {
	// external interface extension
	// oxlint-disable-next-line typescript/consistent-type-definitions
	interface Window {
		i18n?: i18n;
	}
}
 
export const useI18nHelper = () => {
	const { i18n } = useTranslation();
	React.useEffect(() => {
		if (import.meta.env.MODE !== "test") {
			return;
		}
		window.i18n = i18n;
	}, [i18n]);
};