翻译技巧1:
我遇到了一个问题,我需要将我的应用程序翻译为其他国家/地区的客户。应用程序中的所有自定义字符串均未包含在 Ext JS 的语言环境文件中,因此我必须想出自己的方式来翻译这些字符串。
最佳答案
在我的应用程序中,我使用 mo/po 文件来处理服务器端的翻译。由于我想将所有语言字符串保留在一个中心位置(我的 .po 文件),因此我使用了“Language.js”文件,而不是“English.js”和“French.js”。文件的内容如下所示:
window.applanguage = {
/*General form elements*/
login : <?=$this->translate("Login")?>,
OK: <?=$this->translate("OK")?>,
changepassword: <?=$this->translate("Change password")?>,
currentpassword: <?=$this->translate("Current password")?>,
sam: <?=$this->translate("System Access Manager")?>,
userid: <?=$this->translate("User ID")?>,
adminid: <?=$this->translate("Admin ID")?>,
email: <?=$this->translate("Email")?>,
password: <?=$this->translate("Password")?>,
newpassword: <?=$this->translate("New password")?>,
confirmpassword: <?=$this->translate("Confirm password")?>,
confirm: <?=$this->translate("Confirm")?>,
confirmation: <?=$this->translate("Confirmation")?>,
wentwrong: <?=$this->translate("Something went wrong")?>,
username: <?=$this->translate("Username")?>,
passvalidity: <?=$this->translate("Password Validity (days)")?>,
product: <?=$this->translate("Product")?>,
accesslevel: <?=$this->translate("Access Level")?>,
timeoutmins: <?=$this->translate("Timeout (mins)")?>,
cancel: <?=$this->translate("Cancel")?>,
save: <?=$this->translate("Save")?>,
reset: <?=$this->translate("Reset")?>,
passwordutility: <?=$this->translate("Change password utility")?>,
expireform: <?=$this->translate("Session expired, please log in to continue.")?>,
adduser: <?=$this->translate("Add user")?>,
edituser: <?=$this->translate("Edit user")?>,
removeuser: <?=$this->translate("Remove user")?>,
resetuser: <?=$this->translate("Reset user")?>,
add: <?=$this->translate("Add")?>
};
这样,我将所有翻译保留在同一位置,并且 poedit 可以处理该文件以建议需要翻译的字符串。
关于php - 使用 PHP (Zend Framework) 的 Ext JS 翻译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16013723/