transloco icon indicating copy to clipboard operation
transloco copied to clipboard

Feature: Extract and merge library json into app's json

Open MickL opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe.

I have multiple libraries that extract i18n json files. Using @ngneat/transloco-scoped-libs it will extract those files into separate folders:

i18n/
|-- de.json
|-- en.json
|--  library1/
     |-- de.json
     |-- en.json
|--  library2/
     |-- de.json
     |-- en.json

And now I need to load those files separatly to my regular translations.

If I understand right there is also a join option that create a single vendor.lang.json but I dont want an extra file. Also there is ng generate @ngneat/transloco:join but I dont want another i18n-dist folder.

Further in the libraries package.json I need to define a scope but I dont want to define a scope. I already defined the keys I want when using the translation API:

  "i18n": [
    {
      "scope": "core", <---- I dont have a fixed scope
      "path": "src/lib/i18n",
      "strategy": "join"
    }
  ]

Describe the solution you'd like

Instead I would like to just merge all json files found into my app's json. E.g.:

transloco.config.js

module.exports = {
   mergeLibs: ['@myname/library1', '@myname/library2'],
}

Simply creates:

i18n/
|-- de.json
|-- en.json

MickL avatar May 12 '21 12:05 MickL