我正在设置react-i18n-next 钩子来翻译我的应用程序,我按照react-i18n-next使用的示例进行操作,但它抛出如下错误:
i18next::translator: missingKey
en-US
translation
Run Code Online (Sandbox Code Playgroud)
应用程序.js
import React, { Component, Suspense } from "react";
import { useTranslation, withTranslation, Trans } from "react-i18next";
// use hoc for class based components
class LegacyWelcomeClass extends Component {
render() {
const { t } = this.props;
return <h2>{t("title")}</h2>;
}
}
const Welcome = withTranslation()(LegacyWelcomeClass);
// Component using the Trans component
function MyComponent() {
return <Trans i18nKey="description.part1" />;
}
// page uses the hook
function Page() {
const { t, i18n } = …Run Code Online (Sandbox Code Playgroud)