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

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')))) ?>

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

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

  // app / Config / core.php 
配置:: write('Config.language',  msgstr“一月”
 msgstr“Janeiro”
 .... 
  code>  pt-br');  pre> 
 
 

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

我的输入是: p>

 &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; 
  code>  pre> \  n  div>

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