The first time date_timezone_names() is called, it constructs the list of available timezones and saves them in cache_set(). The problem is, it does so after translating them, so subsequent calls fetch the array from the cache and don't translate it, which means that users with a different language won't see the list translated in their language, but rather in what happened to the language used on the first call. It happens in current CVS.

To reproduce, one can switch to language A, clear the cache, and go to one's account edit page. The timezone select will be in language A. Then, switch to language B and revisit the account page - the dropdown is still in language A.

Please consider attached patch against current CVS that fixed it for me. I'm not sure about the purpose of t('!timezone', array('!timezone' => $zone) construct. It may be simplified to t($zone).

Comments

alex.k’s picture

Status: Active » Needs review

Oops, forgot the status.

dmitriy.trt’s picture

This problem also produces $zonenames array with translated keys (in addition to normal) and user gets PHP error after selecting such timezone:
timezone_open() [function.timezone-open]: Unknown or bad timezone ...

Patch seems to fix both problems.

Subscribing

alex.k’s picture

If the patch works for you, please set the status to "reviewed and tested".

dmitriy.trt’s picture

Status: Needs review » Reviewed & tested by the community

Applied patch to 6.x-2.4 and after clearing cache problem was solved. Patch also solves another problem: on non-English languages translated timezones showed twice in list, second time with incorrect value (value was also translated).
Thanks for patch, Alex.

karens’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

quotesbro’s picture

Status: Closed (fixed) » Active

It looks like this patch wasn't commited - the problem with translation is not fixed in 6.x-2.7 and current 6.x-2.x-dev.

TS79’s picture

Status: Active » Needs review
StatusFileSize
new682 bytes

In 6.x-2.8 and the current 6.x-2.x-dev there is no translation of time zones done at all!
The follwing patch (part of the above one) fixes this.

arlinsandbulte’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Assigned: Unassigned » arlinsandbulte

The code for this is the same in Date 7.x-2.x, so should first be fixed there and then ported to 6.x-2.x.

I'll see if I can take care of this.

arlinsandbulte’s picture

Assigned: arlinsandbulte » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.