[英]How to extract Text in a React application to json react-intl translation files
So I'm trying to add languages support to a React application using react-intl.所以我正在尝试使用 react-intl 为 React 应用程序添加语言支持。
The application has the Text in the JSX code.该应用程序在 JSX 代码中有文本。
Is there a tool that can scan the code and generate ids for each Text and replace the text with the generated id??有没有工具可以扫描代码并为每个Text生成id并用生成的id替换文本? Or do I have to do it manually?还是我必须手动完成?
Probably https://formatjs.io/docs/tooling/babel-plugin is what you need but I'm not sure.可能https://formatjs.io/docs/tooling/babel-plugin是您需要的,但我不确定。 It's a babel plugin which can remove translation messages and generate message ids.这是一个 babel 插件,可以删除翻译消息并生成消息 ID。
Edit : Wrong answer.编辑:错误的答案。 In project there is no FormattedMessage components but only pure texts.在项目中没有 FormattedMessage 组件,只有纯文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.