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 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据