mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
*Total -- 61.18kb -> 44.41kb (27.42%) /demos/headless/icon.png -- 4.26kb -> 1.80kb (57.72%) /demos/interpreter/icon.png -- 3.13kb -> 1.71kb (45.13%) /tests/media/g.png -- 1.14kb -> 0.66kb (42.17%) /tests/media/50px.png -- 1.55kb -> 0.93kb (40.31%) /demos/graph/icon.png -- 1.72kb -> 1.03kb (40.01%) /tests/media/30px.png -- 1.10kb -> 0.67kb (39.4%) /media/sprites.png -- 4.05kb -> 2.53kb (37.41%) /tests/media/m.png -- 1.02kb -> 0.65kb (36.49%) /tests/media/c.png -- 0.84kb -> 0.59kb (29.21%) /tests/media/b.png -- 0.75kb -> 0.55kb (26.79%) /demos/accessible/icon.png -- 1.38kb -> 1.01kb (26.69%) /demos/generator/icon.png -- 3.52kb -> 2.61kb (25.64%) /tests/media/a.png -- 0.76kb -> 0.57kb (25.45%) /demos/fixed/icon.png -- 2.06kb -> 1.57kb (24.08%) /tests/media/d.png -- 0.72kb -> 0.55kb (23.58%) /demos/resizable/icon.png -- 3.18kb -> 2.47kb (22.27%) /demos/toolbox/icon.png -- 2.76kb -> 2.16kb (21.83%) /demos/rtl/icon.png -- 3.07kb -> 2.41kb (21.46%) /tests/media/200px.png -- 2.11kb -> 1.67kb (21.06%) /appengine/apple-touch-icon.png -- 3.93kb -> 3.15kb (19.78%) /demos/code/icon.png -- 3.95kb -> 3.19kb (19.44%) /demos/blockfactory_old/icon.png -- 4.34kb -> 3.55kb (18.17%) /demos/maxBlocks/icon.png -- 1.96kb -> 1.61kb (17.87%) /tests/media/k.png -- 0.60kb -> 0.50kb (16.18%) /demos/plane/icon.png -- 3.32kb -> 2.80kb (15.63%) /demos/storage/icon.png -- 3.19kb -> 2.71kb (14.99%) /media/quote0.png -- 0.78kb -> 0.75kb (3.14%)
This Blockly demo uses Closure Templates to create a multilingual application.
Any changes to the template.soy file require a recompile. Here is the command
to generate a quick English version for debugging:
java -jar soy/SoyToJsSrcCompiler.jar --outputPathFormat generated/en.js --srcs template.soy
To generate a full set of language translations, first extract all the strings
from template.soy using this command:
java -jar soy/SoyMsgExtractor.jar --outputFile xlf/extracted_msgs.xlf template.soy
This generates xlf/extracted_msgs.xlf, which may then be used by any
XLIFF-compatible translation console to generate a set of files with the
translated strings. These should be placed in the xlf directory.
Finally, generate all the language versions wih this command:
java -jar soy/SoyToJsSrcCompiler.jar --locales ar,be-tarask,br,ca,da,de,el,en,es,fa,fr,he,hrx,hu,ia,is,it,ja,ko,ms,nb,nl,pl,pms,pt-br,ro,ru,sc,sv,th,tr,uk,vi,zh-hans,zh-hant --messageFilePathFormat xlf/translated_msgs_{LOCALE}.xlf --outputPathFormat "generated/{LOCALE}.js" template.soy
This is the process that Google uses for maintaining Blockly Games in 40+
languages. The XLIFF format is simple enough that it is trivial to write a
Python script to reformat it into some other format (such as JSON) for
compatibility with other translation consoles.
For more information, see message translation for Closure Templates:
https://developers.google.com/closure/templates/docs/translation