dongpangbu4016
dongpangbu4016
2012-01-11 01:30
浏览 52
已采纳

CakePHP 2.0.5表单输入日期时间语言

How I change language of input datetime in Cakephp 2.0.5?

In CakePHP 1.3, I use default.po, and works great.

 // app/Config/core.php
 Configure::write('Config.language', 'pt-br');

 // app/Locale/pt_br/LC_MESSAGES/default.po    
 msgid "January"
 msgstr "Janeiro"
 ....

In Cakephp 2.0.5, default.po doesn't work.

My input is that:

 <?php echo $this->Form->input('melhor_horario', array('dateFormat' => 'DMYHS',
 'separator' => ' de ', 'minYear' => date('Y'), 'maxYear' => date('Y') + 1, 
 'timeFormat' => 24, 'interval' => 15, 'class' => 'span2', 
 'default' => date('Y-m-d 15:00', strtotime('sunday')))) ?>

图片转代码服务由CSDN问答提供 功能建议

我如何更改Cakephp 2.0.5中输入日期时间的语言?

在CakePHP 1.3中,我使用default.po,效果很好。

  // app / Config / core.php 
配置:: write('Config.language',  msgstr“一月”
 msgstr“Janeiro”
 .... 
   
 
 

在Cakephp 2.0.5中, default.po 不起作用。

我的输入是:

 &lt;?php echo $ this-&gt; Form-&gt; input('melhor_horario',array('dateFormat'=&gt;'DMYHS',
'separator'=&gt;  'de','minYear'=&gt; date('Y'),'maxYear'=&gt; date('Y')+ 1,
'timeFormat'=&gt; 24,'interval'=&gt; 15,  'class'=&gt;'span2',
'默认'=&gt;日期('Ymd 15:00',strtotime('sunday'))))?&gt; 
   \  n 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushanlv5184
    doushanlv5184 2012-02-29 15:36
    已采纳

    You need to put the translations in a correct domain. Cake 2 uses "cake" domain internally, so the correct path is Locale/[lang]/LC_MESSAGES/cake.po

    点赞 评论

相关推荐