FWIW ... to achieve this goal, we are using a program called Sisulizer to extract all the required strings out of our Sencha JS code into a Sisulizer project. Get our translations done, then from Sisulizer we export the translations into a single JSON array (via a few steps : XLS > OpenOffice CSV UTF-8 > an Online CSV-to-JSON converter "Mr Data Converter")
Paste the case insensitive sorted JSON Array into the sencha project... looks like this.
PHP Code:
function getTranslations() {
return [
{"EN":"Abort?", "PT":"Abortar?", "ES":"Abortar?", "RU":"?????????"},
{"EN":"About", "PT":"Sobre", "ES":"Acerca de", "RU":"? ????."},
{"EN":"Activities", "PT":"Atividades", "ES":"Actividades", "RU":"??????."},
{"EN":"Actual", "PT":"Atual", "ES":"Real", "RU":"???????????"}
etc, etc, etc
]
}
Our array has about 800 records.
At program launch we load the array into a global variable... translationArray = getTranslations();
Throughout the code, each string that we want translated is wrapped in a function called "_ "
e.g. throughout the code there are these types of things... text : _('Abort?')
the _ function looks like this.
PHP Code:
function _(msgid) {
var locale = global.getLocale()
if (!locale || locale == 'EN') {
return msgid
}
else {
var rec = findIndexByKeyValue(translationArray, 'EN', msgid); // <<< this is a binary searcher
if (rec == -1) {
return msgid
}
else {
return translationArray[rec][locale];
}
}
}
Using a binary search it takes usually no more 3-4 attempts to find a string. Very fast.
With this setup, users can change language on-the-fly. using a settings screen with a selectfield of languages... which loads the value retrieved above ( global.getLocale() )