8

For a long time, Vue I18n has been used in Vue.js to achieve international multi-language settings. In the past, it was cumbersome and complicated to find files and write translations manually.

Now I know a very useful vs code plug-in i18n-ally from my colleagues, which can build and automate translation, share it with everyone, and make a record by myself.


Moreover, i18n-ally is an officially recommended third-party tool, it is really easy to use, who knows who uses it.

First install the plugin i18n-ally in vs code.

Secondly, this is the configuration, as follows:
settings.json:

  // 安装插件后可能会自动在工作区生成这行配置
  "i18n-ally.localesPaths": [
    "src/i18n"
  ],
  // 以下需要自己配置
  "i18n-ally.keystyle": "nested",
  "i18n-ally.namespace": true,
  "i18n-ally.enabledParsers": [
    "json",
    "js"
  ],
  "i18n-ally.sortKeys": true,
  "i18n-ally.sourceLanguage": "zh-hans",
  "i18n-ally.displayLanguage": "en-us",

Then, change the previous js file to json format, and it can be used. The documentation on github gives many demonstrations, which will not be repeated here.


北堂棣
6.6k 声望116 粉丝

2016年应届毕业生。