Issue
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 https://ionicframework.com/docs/v3/developer-resources/ng2-translate/
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
{
...
"HELLO": "HELLO",
"HI": "HI"
}
After that, it is easier to update json files.
Solution
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
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.