Generate/append XTB (translation XML file) for google closure compiler https://developers.google.com/closure/compiler/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE translationbundle>
<translationbundle lang="cs">
<translation id="1234567890">Message ...</translation>
<translation id="1234567891">Message with <ph name="PLACE_HOLDER" />.</translation>
...
</translationbundle>
/** @desc Description for Test 1 */
var MSG_TEST_1 = goog.getMsg('Test 1');
/** @desc Message with placeholder */
var MSG_TEST_2 = goog.getMsg('Message with {$placeHolder}.', {placeHolder: 'replaced text'});
Usage: XtbGenerator --lang <arg> [--projectId <arg>] --js <FILE1> [--js <FILE2>]
or: XtbGenerator --lang <arg> [--projectId <arg>] FILE1 [FILE2]
Params:
--lang : Lang
--projectId : Project ID
--js : Input JS file, possibly with * or ** wildcards for glob search
--translations_file : XTB translation file
--xtb_output_file : XTB output file
Create message file
java -jar XtbGenerator.jar \
--lang cs \
--xtb_output_file messages.xtb \
--js messages.js
Append to existing message file
java -jar XtbGenerator.jar \
--lang cs \
--translations_file messages.xtb \
--xtb_output_file messages.xtb \
--js messages.js
You may also use minimatch-style glob patterns for input files. For example, use --js='**.js' --js='!**_test.js'
to recursively include all js files that do not end in _test.js
closurebuilder.py \
--root js/ \
--root js-closure/ \
--input js/app.js \
--output_mode=compiled \
--compiler_jar=XtbGenerator.jar \
--jvm_flags="-d64" \
--compiler_flags="--translations_file=messages.xtb" \
--compiler_flags="--xtb_output_file=messages.xtb" \
--compiler_flags="--lang=cs"
You can find more about using closurebuilder.py
on http://www.closurecheatsheet.com/skeleton
More about google closure:
https://raw.github.com/kuzmisin/xtbgenerator/master/bin/XtbGenerator.jar
- add meaning into XTB file (depend on visibility of JsMessage.java::getMeaning)