头图
---这款插件主要用户是谁?有多语言场景(项目支持中文、英文、日文、韩文等多种语言)的前端开发者。
---我的项目没有多语言场景,安装你这个插件干嘛?可以体验一下嘛,然后看看源码,插件包含的知识点还有趣的。
---包含哪些知识点呢?1.完整的VSCode插件开发流程 2.tsc编译ts文件 3.VSCode文件热更新监测 4.利用缓存增量编译文件

Github address: https://github.com/FrankKai/i18n-chain

Welcome to submit PR and issue! ! !

i18n-chain

Reverse selection path chain multilingual vscode plugin.

By analyzing the multi-language files (js, ts, json) of the local project, and generating snippet.json, it helps developers to achieve multi-language rapid reuse and improve development efficiency.

demo map

https://imgur.com/tO0oXjk.gif

two ways

  • i18n-json: For projects with locales file type json.
  • i18n-ts: For projects with locales file type ts file.

installation and use

  1. Search for i18n-chain in the plugin market and install it
  2. Configure the multilingual file directory Preferences->Settings->User->Extensions->i18n-chain (for example, configure Locale Path, the default path is /src/locales/zh)
  3. Command+Shift+P => i18n-json (the content in the Locale Path directory is a json file) or Command+Shift+P => i18n-ts (the content in the Locale Path directory is a ts file)
  4. Type i18n- and select the desired chain.

E.g:

 {
  "foo": "知道了",
  "foo.bar": "知道了",
  "foo.bar.baz": "知道了",
}
 i18n-知道了

=>

 1.foo

2.foo.bar

3.foo.bar.baz

=>

 foo.bar.baz

Schematic

多语言插件 (1).png

FAQ

Build failed

After running the command, you can check whether there is any content in i18n-chain.code-snippets in the .vscode directory.
If not, check whether the directory format of the Locale Path configuration is consistent with the executed command.

Development Notes

Development and debugging

  • vscode executes Extension
  • Find an extension development host project to test
  • When the plug-in code is updated, you need to compile it yarn compile and click the refresh button in the upper right corner to keep the plug-ins in the extension development host up to date

compile only

 yarn test-compile

Generate local vsix package

 yarn build

Welcome to submit PR and issue! ! !


趁你还年轻
4.1k 声望4.1k 粉丝