简体   繁体   English

如何配置`I18n Ally` VsCode插件从一个文件中读取我的本地人?

[英]How to configure `I18n Ally` VsCode plugin to read my locals from one single file?

I'm using vue-i18n package to translate my Vue project and want to use "I18n Ally" vs code extention to manage translations.我正在使用vue-i18n package 来翻译我的 Vue 项目,并希望使用“I18n Ally”与代码扩展来管理翻译。 The default folder structure for this extension is this:此扩展的默认文件夹结构是这样的:

  locales         # i18n, langs, locale are also acceptable
  ├── en.json
  ├── de-DE.json
  ├── zh-CN.yml   # YAML
  ├── zh-TW.ts    # You can mix different formats
  ├── ...
  └── <country-code>.json

But I have one single translation file with this format:但我有一个具有这种格式的翻译文件:

{
 "en": {
    "users": {
      "title": "Users list",
      "menu": {
        "show_users": "Display users",
        "hands_down": "Hands down",
        "unblock_all": "Unblock all"
      },
...

And I cannot configure the extension to read this configuration.而且我无法配置扩展来读取此配置。

Author of i18n Ally here. i18n Ally 的作者在这里。 Currently, we don't support the locale code as top-level keys in json files.目前,我们不支持将语言环境代码作为 json 文件中的顶级键。 I'd suggest using the following format in dedicated files for each locale, which will also get better support over other i18n tools.我建议在每个语言环境的专用文件中使用以下格式,这也将获得比其他 i18n 工具更好的支持。

{
   "users": {
      "title": "Users list",
      "menu": {
        "show_users": "Display users",
        "hands_down": "Hands down",
        "unblock_all": "Unblock all"
      },
...

This should be a better practice as your application grows as well.随着您的应用程序的增长,这应该是一个更好的做法。 Thanks for the understanding and hope you enjoy the extension.感谢您的理解,并希望您喜欢扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM