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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程