更改 date_lang.php 的时区字符串

发布于 2024-11-07 05:48:44 字数 591 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽容 2024-11-14 05:48:44

看起来这需要对 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 the U__ value coming from the view/dropdown -- and then save it to DB as -5 or some other INT.

Since I want to show the user their selected timezone on that same dropdown, I am forced to have DB fields for the U__ and INT timezone formats. As far as I know, there is no CI function to convert from -5 to UM5.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文