我需要使用react i18n搜索并移动文件.json以进行国际化。硬编码文本和手动制作的内容太长且不确定。我想使用自动解决方案。
例如: 在我检查之前
function NotFoundPage(props) {
const { t } = useTranslation("notFoundPage");
return (
<Result
status="404"
title="404"
subTitle="Sorry, the page you visited does not exist."
extra={
<Button
type="primary"
style={{ margin: "auto" }}
onClick={() => props.history.push("/")}
>
Back to Projects
</Button>
}
/>
);
}
我检查后
function NotFoundPage(props) {
const { t } = useTranslation("notFoundPage");
return (
<Result
status="404"
title="404"
subTitle={t("Sorry, the page you visited does not exist.")}
extra={
<Button
type="primary"
style={{ margin: "auto" }}
onClick={() => props.history.push("/")}
>
{t("Back to Projects")}
</Button>
}
/>
);
}
带有“对不起,...”和“返回...”的行,我将其更改为将其放入.json文件中,但有时在长文件中有时很难找到硬编码的文本。 / p>