Commit graph

6 commits

Author SHA1 Message Date
chrisgarrity
5659036d91 Separate updating translations from generating src.
* setLocale uses Object.assign so any new keys in Blockly.Msg are maintained after changing locale. I.e. if a translation doesn’t exist in the translation English default will be used. In theory, it could end up with something other than English if the key is in one translation, but not another.
However, it’s unlikely as we’re pulling the translations from transifex and either they will all have the key (if the key exists in the `en.json` source on transifex), or none of them will have the key.

* translate script only generates `en` sources.
* translate:update script generates new scratch_msgs.js file. It will fail if the keys in the downloaded files don’t match the ones in messages.
2018-07-12 11:04:50 -04:00
chrisgarrity
9dfe7efab8 fixing jsdoc 2018-06-25 11:52:22 -04:00
chrisgarrity
eca1eec39c Add function to support translation of dynamic menus
Dynamic menus are constructed in the VM. Add a function to ScratchMsgs that it can use to look up localized strings for jsonInit. Add missing strings for dynamic menus.
2018-06-24 18:15:46 -04:00
chrisgarrity
4f146fbcce Update ScratchMsgs export
- Update shims to make sure `msg/scratch_msg.js` is included
- Add missing empty `locales` to ScratchMsgs
2018-06-21 15:13:12 -04:00
chrisgarrity
5cb1651e56 Clarifications and consistency
*  removed all the generated files (<locale>.json, <locale>.js) except for ‘en’ versions and added them to git ignore.
* updated cleanup.sh to use our messages.
* added validation check to fail if any translations include newlines
* skip generating js files other than ‘en’ as we don’t use them
* Revised messages.js to use _single_ quoted strings instead of double (consistent with Blockly - if we need to import more strings), and switch the validations to check for single not double quotes.
* additional small changes for simplicity and ergonomics

Not handling category menu at this time as it’s managed differently in scratch-gui.
2018-06-13 10:50:20 -04:00
chrisgarrity
aa4ecd7e2e * Added Blockly.ScratchMsgs
* Added script to create combined locales `Blockly.ScratchMsgs.locales`
* Regenerated en.json after changing single quoted strings in messages.js to double quoted strings.
* Include `create_scratch_msgs.js` in `npm run translate`
locale=<locale-string>` to the URL.
* Added assertions so translate fails if `messages.js` has incorrect strings, or if any of the downloaded locale json files have errors in the translations.
* Playground will load different locales.
2018-06-08 13:58:59 -04:00