目前,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。
最佳答案
我认为问题出在您的 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'
);
希望这会有所帮助。
关于php - Zend 翻译 Zend 表单!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5065838/