Small Node script to handle @angular-localize
generated JSON. This way you can savely manage i18n translations.
Problem:
@angular-localize
generates a translation file that:
- Overrides current translations file.
- Does not create localized files (es, de, ch, ...)
Script solution:
- Reads
base.json
file. Which is the generated one. - Creates files for each locale configured. Locale
defaultLocale
gets thebase.json
value if key is missing. - Get all the keys and adds those to the files
- Write json file
This is a skeleton script, reay to use and prepared to be modified and used into your project workflow.
node index.js
#Test online Run this code on Stackblitz.