From fd2baf9e9ec8ed12f4165cc1425bfaec20f478b2 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Sun, 16 Jul 2023 21:52:34 +1000 Subject: [PATCH] Add missing file. --- src/ReactViews/workingWithTranslation.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/ReactViews/workingWithTranslation.tsx diff --git a/src/ReactViews/workingWithTranslation.tsx b/src/ReactViews/workingWithTranslation.tsx new file mode 100644 index 00000000000..11389e884f2 --- /dev/null +++ b/src/ReactViews/workingWithTranslation.tsx @@ -0,0 +1,18 @@ +import { i18n } from "i18next"; +import React from "react"; +import { useTranslation, TFunction } from "react-i18next"; + +// The normal withTranslation causes TypeScript to generate an invalid .d.ts file, for unknown reasons. +export default function workingWithTranslation< + Props extends { t?: TFunction; i18n?: i18n } +>( + WrappedComponent: React.ComponentType +): React.FC> { + const WorkingWithTranslation: React.FC> = ( + props: Omit + ) => { + const { t, i18n } = useTranslation(); + return ; + }; + return WorkingWithTranslation; +}