Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
function nuTranslate(s){
for(var i = 0 ; i < nuLANGUAGE.length ; i ++){
if(nuLANGUAGE[i].english == s){
return nuLANGUAGE[i].translation;
}
}
return s;
}
This can be improved by avoiding the for loop and directly getting the translation using the likes of nuLANGUAGE.find(s) or similar construct. Alternatively store it in an array where the english string is the index - it can then be a mere lookup.
SET @LANG:='Vietnamese';
SELECT CONCAT('$',"t['",trl_english,"']=",'"',trl_translation,'";') AS Translation FROM `zzzzsys_translate` WHERE trl_language=@LANG ORDER BY trl_english;
Attachment has all 14 languages parsed from table into files with sample code and links.
You do not have the required permissions to view the files attached to this post.
The setup page has the language setting. Map that to the language files you need on demand and create a cache, overwriting the earlier one that exists with the complete English set as an auto fallback (the key).