CakePHP CakeTime实用程序netshort本地化在%jS中

时间:2022-05-20 07:15:13

I use CakeTime::niceshort() and it works very well. I set correct locale values and set translate (po) files and I can see localized month, day names successfully.

我使用CakeTime :: niceshort(),它运行得很好。我设置正确的区域设置值并设置翻译(po)文件,我可以成功查看本地化的月份,日期名称。

But one thing is missing. When I use niceshort():

但缺少一件事。当我使用niceshort()时:

echo $this->Time->niceShort(1387120620);

I get this:

我明白了:

Ara 15th 2013, 15:17

But this isn't valid for Turkish dates. I need this:

但这对土耳其日期无效。我需要这个:

Ara 15 2013, 15:17

It is possible with these:

有可能这些:

$this->Time->format($time,"%b %e %Y, %H:%M")

But I don't want to lose niceShort's features. It gives short information if timestamp is close to now:
https://github.com/cakephp/cakephp/blob/2.5/lib/Cake/Utility/CakeTime.php#L391

但我不想失去niceShort的功能。如果时间戳接近现在它给出简短的信息:https://github.com/cakephp/cakephp/blob/2.5/lib/Cake/Utility/CakeTime.php#L391

Is it possible to remove "th" and "nd" from dates without changing core lib ?

是否可以在不更改核心库的情况下从日期中删除“th”和“nd”?

1 个解决方案

#1


0  

You should use setlocale before calling CakeTime::niceshort()

你应该在调用CakeTime :: niceshort()之前使用setlocale

setlocale("LC_ALL", "tr_TR.UTF-8");

You need to make sure they are properly installed on the server.

您需要确保它们已正确安装在服务器上。

#1


0  

You should use setlocale before calling CakeTime::niceshort()

你应该在调用CakeTime :: niceshort()之前使用setlocale

setlocale("LC_ALL", "tr_TR.UTF-8");

You need to make sure they are properly installed on the server.

您需要确保它们已正确安装在服务器上。