ionic 4/5 using ngx-translate auto add to subtitle files in i18n


Is there a way to auto add translation words to i18n folders? Is there a way to automatically add subtitle words to i18n folders?

Using below url

When I add below lines as an example:

<ion-title>{{ 'HELLO' | translate }}</ion-title>
<p>{{ 'HI' | translate }}</p>

I expect to find under files ./assets/i18n/en.json ./assets/i18n/es.json

  "HI": "HI"

After that, it is easier to update json files.


Sure, ngx-translate-extract does exaclty what you need.

    "scripts": {
      "i18n:init": "ngx-translate-extract --input ./src --output ./src/assets/i18n/template.json --key-as-default-value --replace --format json",
      "i18n:extract": "ngx-translate-extract --input ./src --output ./src/assets/i18n/{en,da,de,fi,nb,nl,sv}.json --clean --format json"

Answered By – IAfanasov

Leave a Comment