The bottom file is the default file for /languages/javascript/sound.json. The top one, sound (localized).json, has been stripped of unimportant fields and what remains are the strings related to localizing.
NOTE: When localizing files, they should be the same name as the default file. e.g.
sound.json, notsound_localized.json
The fields related to localizing are:
id- identifies each block so the original can be overwritten.name- name of section and actual text that appears on block.help- description of section and hover information text for blocks.
- Create a branch of master
- Create a new directory under
languages/javascript/localizations/with the name of the two character locale code of the language you are translating.mkdir languages/javascript/localizations/esfor Spanish- Can be found here under "Code 2" column
- Copy files from
languages/javascript/into the new directory - Strip unimportant parts of JSON. To make sure it is still valid JSON, please use a validator (usually its commas that mess things up)
- Replace any text of the fields "name" or "help" with the appropriate language
- Add appropriate filenames to
localizationsvariable in the build script (format shown below). - Pull request
Below is an example format of the build script localizations variable. The variable in this format states that for javascript language, there are localization files for Spanish (es) with the file names of array.json and boolean.json.
If the files are not listed in the build script, then they will not be found by the program
var localizations = {
javascript: {
es: ['array', 'boolean']
}
};languages
└── javascript
├── localizations
│ └── es
│ ├── sound.json
│ └── ...
├── array.css
├── array.js
├── array.json
├── array_runtime.js
└── ...
I want to see how it looks in my local server but I can't seem to get my translation show up.
I've changed my broswer's language preference, and verified that in the header:
Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4,zh-CN;q=0.2I've updated the build script:
var localizations = { javascript: { 'zh': ['control'] } };But the block names are still in English after rebuilding...
ok, I figured it out.
First of all, I think the locale is not extracted from header, so I just use debugger to hack the locale value in initLanguageFiles.
Also, I copied an older version of the json file, so sectionkey is not included.
And the answer to my previous question is that, it works if I add suffix to a block that doesn't have suffix in English.
HOWEVER, if I remove suffix field from a block that has suffix in English, the English suffix will show up. Not sure if this is desired. (my current workaround is set the suffix field to the empty string)