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

1.2k Views Asked by At

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

1

There are 1 best solutions below

0
On BEST ANSWER

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.