douhe3313 2013-09-23 20:44
浏览 17
已采纳

CakePHP 2.x i18n验证消息

5h of fight with this and no results. i have tried overloading methods with _d() and _() and didn't help. shell validation_errors neither. normal string working well in views but validation messages nope.

default language for app is polish and alt is english. i have .pot files in Locales/eng/LC_MESSAGES with source strings as polish and translations as english and it works fine

in model before validate

public $validationDomain = 'validation_errors';

and in AppController in beforeRender

Configure::write('Config.language', 'eng');

for force eng lang

anyway, it is default domain for validation... and it doesn't work

i don't know if i do something wrong or it is bug or sth...

any ideas ??

  • 写回答

1条回答 默认 最新

  • dongyan7950 2013-09-24 07:35
    关注

    Try using $this->Session->write('Config.language', 'pol'); or $this->Session->write('Config.language', 'eng'); when using different languages on user level. The Configure::write('Config.language', 'eng'); is a sitewide fallback.

    See this CakePHP cookbook entry for more information.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办