开发者

Using Helper $time->niceShort with german settings in CakePHP 1.2

I want to use the CakePHP Helper "time" and his method niceShort to transform a date into a nice, easy to read one. Instead of the eng开发者_高级运维lish default transformation I want to use a localized version (in my case: "german") but I don't know where to set this. How can I localize this method?

echo $time->niceShort($comment['created']);


I don't think cake handles date localization very well you might need to use $time->format() see http://cakeqs.org/eng/questions/view/localizing_time_helper and this ticket http://cakephp.lighthouseapp.com/projects/42648/tickets/638-time-helper-i18n


If you can successfully set localization parameters, niceShort finds right month/day names.

Regarding to CakePHP docs change these:

$this->Session->write('Config.language', 'ger')

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

setlocale(LC_TIME, 'de_DE.utf8','de_DE','de_DE','deu_deu');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜