Zend 翻译 Zend 表格!

发布于 2024-10-18 04:12:30 字数 643 浏览 4 评论 0原文

目前, isEmpty 错误抛出:

    Value is required and can't be empty

我正在像这样加载我的翻译器:

[translation]

adapter = array
content.english["emailNotUnique"] = "Your user already exists"
content.english["Value is required and can't be empty"] = "You must specify your ID"
locale = en

上面的配置根据 zend 翻译规范生成一个有效的数组,所以:

$this -> form -> setTranslator(new Zend_Translate($this -> getConfig() -> translation));

预期的结果是 isEmpty 错误现在应该显示为

    You must specify your ID

但是我没有得到爱。没有错误,也没有翻译。我使用的是 Zend 1.11.1 和 PHP5.3.5。

Currently, isEmpty errors throw:

    Value is required and can't be empty

I'm loading my translator up like this:

[translation]

adapter = array
content.english["emailNotUnique"] = "Your user already exists"
content.english["Value is required and can't be empty"] = "You must specify your ID"
locale = en

The config above produces a valid array according to zend translate spec, so:

$this -> form -> setTranslator(new Zend_Translate($this -> getConfig() -> translation));

expected result is that isEmpty errors should now show up as

    You must specify your ID

However I'm getting no love. No errors and no translation. I'm on Zend 1.11.1 and PHP5.3.5.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

北城孤痞 2024-10-25 04:12:30

我认为问题出在 ini 文件中的 english 键上。具体来说,它不应该在那里,因为您实际上作为 content 传递给 Zend_Translate 的内容是:

    'content' => array(
        'english' => array(
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID' 
        )            
    );

它应该是:

    'content' => array(          
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID'             
    );

希望这会有所帮助。

I think that the problem is with english key in your ini file. Specifically it should not be there, because what you are actually passing to Zend_Translate as a content is:

    'content' => array(
        'english' => array(
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID' 
        )            
    );

And it should be:

    'content' => array(          
            "emailNotUnique" => 'Your user already exists' ,
            "Value is required and can't be empty" => 'You must specify your ID'             
    );

Hope this will help.

羞稚 2024-10-25 04:12:30

尝试改变

content.english["isEmpty"] = "You must specify your ID"

Try to change

content.english["isEmpty"] = "You must specify your ID"
聆听风音 2024-10-25 04:12:30

您可以在初始化引导程序时使用语言文件(MO)将其简单翻译为多种语言

,一次初始化所选语言

you can user language file(MO) its simple translate in multiple language

when initialize bootstrap at a time initialize selected language

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文