File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 22
33![ ] ( https://s3.bmp.ovh/imgs/2021/09/c9214e94371f0e22.png )
44# react-intl-linter💡
5- 自动替换中文字符串为 react-intl 代码的 VS Code 插件
5+ 自动替换中文字符串为 react-intl 代码的 VS Code 插件,Market 👉 [ Link ] ( https://marketplace.visualstudio.com/items?itemName=styx11.react-intl-linter )
66
77</div >
88
99
1010## 功能
1111
12- 这个插件可以自动检测打开的文件中的包裹在单/双引号之间的 ** 中文文本 ** ,并提供用户一个提示,用户可以点击提示进行中文文本翻译并选择写入的 intl 内容,插件会自动更新配置文件
12+ 这个插件可以自动检测代码中的 ** 中文字符串 ** ,通过 CodeAction 该插件可以自动翻译并选择替换的 intl 代码,另外插件会自动更新配置文件
1313- 中文字符串提示
1414- 自动检测已有国际化配置是否已包含目标文本
1515- 翻译目标文本至英文,用户可以选择或自定义 intl id 内容
16+ - 插件自动更新对应的 react-intl 配置文件
1617- 替换中文字符串为` intl.formatMessage({ id: ... }) `
1718
19+ ## 使用
20+ * 注意:* 此插件默认在工作区` src/intl ` 目录下存放国际化配置文件
21+
22+ ### 文本不存在已有配置
23+ 当一个中文文本既不存在已有国际化配置,也没有翻译缓存时,该插件会翻译文本生成用来替换的 react-intl 代码,并修改国际化配置
24+ ![ ] ( https://s3.bmp.ovh/imgs/2021/09/26497bcd6aded4c0.gif )
25+
26+ ### 文本不存在已有配置,但存在翻译缓存
27+ 若文本已存在翻译缓存,但不存在已有配置,该插件会替换文本为 react-intl 代码,并修改国际化配置
28+ ![ ] ( https://s3.bmp.ovh/imgs/2021/09/6f05013aca01e4b5.gif )
29+
30+ ### 本文已存在现有配置
31+ 插件会检查文本是否已有对应国际化配置,若有会直接替换为对应 react-intl 代码
32+ ![ ] ( https://s3.bmp.ovh/imgs/2021/09/4d62fb749425d312.gif )
33+
1834
1935## Structure
2036
You can’t perform that action at this time.
0 commit comments