i18n scripts
Contributing
We are not accepting external contributions at this point in time.
Prerequisites
To work correctly this package requires a gettext
installation.
Install
$ npm i @mojang/i18n-scripts
Scripts
add-missing-en
Adds english default translation using keys in pot
file as base translation.
example
$ add-missing-en
merge-translations
Helper function around gettext msgmerge
.
example
$ merge-translations
generate-json
Generates json files from po
files that can be consumed by Jed.
flag | action |
---|---|
--o (optional) | When set, sets output file |
--lowercase (optional) | When set, produces lowercase filename |
--escape-percentage (optional) | When set, appends extra percentage sign |
--filenamesMap (optional) | When set, reads file name maps from a json file |
example
$ generate-json --lowercase --escape-percentage --filenamesMap ./i18n-map.json
example i18n-map.json
{
"zh-CN": ["zh-cn", "zh-hans"],
"zh-TW": ["zh-tw", "zh-hant"]
}