Localisation of Speech Rule Engine
These are the localisation facitlities for the speech rule engine. It contains code and files for localising speech rule files. These are now available in a Yaml format and can be more easily localised than in their previous JSON format.
For explanations of the format and what needs to be done to localise them into your language, see here for details.
Full translation of Speech Rules
Forward translation of all locales:
let trans = require('./js/base/translate'); trans.translateForwardAll();
Backward translation of all locales:
let trans = require('./js/base/translate'); trans.translateBackwardAll();
Translation of mathmaps is done with the functions in
let maps = require('./js/base/maps');
Forward translation is done with the
maps.convertSymbols(iso); maps.convertFunctions(iso); maps.convertUnits(iso);
Backward translation is done with the
maps.retrieveSymbols(iso); maps.retrieveFunctions(iso); maps.retrieveUnits(iso);
This is currently still done with the
SplitJson module from the
sre-resources repository using the spreadsheets split into single
Adding a new Locale
Use the convert methods to do the initial conversion of the (potentially empty)
mathmaps. Merge into
crowdin branch and push to crowdin.
- Add new locale to variable in
- Prepare empty rule and actions files for new locale.
- Generate basic rules files with forward translation.
- Replace the corresponding yaml files with the translated ones or create them new.
- Translate backwards, this will result in the correct rule files in SRE.
- Translate forwards once more to update comment files, json files, etc. in the
Things to Pay Attention to
- When making changes in the rule files in SRE, run
trans.translateForwardAll();twice to also update the comments files correctly.
- When making changes in the comment yaml file, update comments file and rerun translation:
let comment = require('./js/base/comment'); comment.updateComments(); trans.translateForwardAll();