php - 使用 PHP (Zend Framework) 的 Ext JS 翻译

标签 php zend-framework extjs extjs4 translation

翻译技巧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/

相关文章:

javascript - ExtJS ComboBox(配置了 queryMode remote 和 forceSelection true)自动清除输入字段

php IS NULL 全局化选项?

php - 将 pear/xml_parser 添加到composer.json

php - 如何在与 artisan 一起运行的 laravel 5 中包含 CSS?

zend-framework - Zend Tool 在模块内创建 Controller

html - Sencha - 将底部标题边框添加到面板

extjs - 使用 UglifyJS 缩小 ExtJS 应用程序?

php - 如何管理动态排序、mysql 和 php 的 order_by 列

php - Zend 两个提交按钮同名

mysql - 使用 Zend_Db 将 TIME 字段设置为 NULL