Search code examples
i18nextreact-i18nexti18n-ally

How to configure `I18n Ally` VsCode plugin to read nested locales from multiple locale files?


I have few language folders with locale files inside

  locales         
  ├── en
  |   ├── common.json
  |   ├── ...
  |   └── article.json
  └── de
      ├── common.json
      ├── ...
      └── article.json

And i have a nested structure of locale.json like this

{
  "title": "Something",
  "menu": {
    "first": "First",
    "second": "Second",
    "third": "Third"
  }
}

I can't configure the extension settings to read this locales structure


Solution

  • I was struggling to make this work too, then finally found out the right config.

    Important thing is to set localesPaths as well as pathMatcher in settings accordingly.

    "i18n-ally.localesPaths": "src/locales",
    "i18n-ally.namespace": true,
    "i18n-ally.pathMatcher": "{locale}/{namespace}.json",
    

    Also, developers notice in docs that it is important to set namespace to true before pathMatcher.