更改 date_lang.php 的时区字符串
CodeIgniter 将其日期类的时区存储在
system/language/english/date_lang.php
我想更改此文件中的字符串,以便
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
改为
$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';
Is this possible at all?
我对一行的 UM__
部分所做的任何更改都会使其在下拉列表中显示为空白。其余(未更改)行显示正常。
我还尝试将此文件克隆到 application/language/english/
,但结果类似。
对此有什么见解吗?
CodeIgniter stores timezones for its date class in
system/language/english/date_lang.php
I would like to change the strings in this file so that
$lang['UM12'] = '(UTC -12:00) Baker/Howland Island';
$lang['UM11'] = '(UTC -11:00) Samoa Time Zone, Niue';
would instead be
$lang['-12:00'] = '(UTC -12:00) Baker/Howland Island';
$lang['-11:00'] = '(UTC -11:00) Samoa Time Zone, Niue';
Is this possible at all?
Any change I make to the UM__
portion of one line makes it show as a blank on the dropdown. The remaining (unchanged) lines appear OK.
I have also tried to clone this file to application/language/english/
with similar bad results.
Any insights on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来这需要对
date_helper.php
文件进行黑客攻击,但我不愿意这样做。相反,CI 中的日期类具有
timezones()
函数,该函数允许您从UM5
转换为-5
。在这种情况下,可以将此函数包装在来自视图/下拉列表的U__
值周围,然后将其作为-5
或其他INT 保存到数据库中
。由于我想在同一个下拉列表中向用户显示他们选择的时区,因此我被迫拥有
U__
和INT
时区格式的数据库字段。据我所知,没有 CI 函数可以将-5
转换为UM5
。因此,对于用户,我将
U__
格式拉入视图中以自动填充下拉列表。对于时区转换等,我使用
INT
格式。It looks like this would require hacks to the
date_helper.php
file which I am not willing to do.Instead, the date class in CI has the
timezones()
function which allows you to convert from, for example,UM5
to-5
. In that case one can wrap this function around theU__
value coming from the view/dropdown -- and then save it to DB as-5
or some otherINT
.Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the
U__
andINT
timezone formats. As far as I know, there is no CI function to convert from-5
toUM5
.So, for the user, I pull the
U__
format into the view to autopopulate the dropdown.For timezone conversions and such, I use the
INT
format.