Skip to content

Commit

Permalink
feat: provide i18next module typing
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Jan 30, 2024
1 parent 1dd0154 commit 722ec46
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/vva-fe/src/components/atoms/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from "react";

import { ICONS } from "@consts";
import { useSnackbar } from "@context";
import { usei18n } from "@translations";
import { useTranslation } from "react-i18next";

interface Props {
isChecked?: boolean;
Expand All @@ -12,7 +12,7 @@ interface Props {

export const CopyButton = ({ isChecked, text, variant }: Props) => {
const { addSuccessAlert } = useSnackbar();
const { t } = usei18n();
const { t } = useTranslation();

const iconSrc = useMemo(() => {
if (variant === "blue") {
Expand Down
1 change: 1 addition & 0 deletions src/vva-fe/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { useTranslation } from "react-i18next";
export * from "./useScreenDimension";
export * from "./useSlider";
export * from "./useSaveScrollPosition";
Expand Down
2 changes: 1 addition & 1 deletion src/vva-fe/src/translations/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { en } from "./locales/en";

i18n.use(initReactI18next).init({
resources: {
en: en,
en,
},
fallbackLng: "en",
interpolation: {
Expand Down
11 changes: 11 additions & 0 deletions src/vva-fe/src/types/i18next.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { en } from "@/translations/locales/en";

declare module "i18next" {
interface CustomTypeOptions {
defaultNS: "en";

resources: {
en: (typeof en)["translation"];
};
}
}

0 comments on commit 722ec46

Please sign in to comment.