-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Date options (notably credit card exp month) for users in Whitehorse Yukon #25066
Conversation
(Standard links)
|
I'm not sure about this. We should check what it looks like for somebody far east because there'll be a mismatch between strtotime and UTC. I wonder what's different about Whitehorse. If this doesn't work out then perhaps there's a solution using UTC and gmmktime() instead of strtotime(). |
hmm oh yikes.. this is weird. Just poking around, even passing the local timezone does not work, or using
output:
|
ah but .. I'm thinking this is silly. In #21157 we replaced those list of months with a hardcoded list. It's boring, but it works, and does not rely on the operating system locale. In this case, it will break translations until they are updated, but I think the impact is fairly limited (expiry months in particular, and only if using an old-school payment processor). |
One other thing was we ran into chicken/egg with tests, where you can't test the translation of something until it's available in the translation files. The idea with intl was then it's already translated and "Sunday" is a pretty standard thing to translate that doesn't need civi-specific context. And then also it's already translated in all langs. But yes it does seem a little crazy that it's so hard to just output these known words. |
Updated the PR to hardcore strings and use I looked at how WordPress and Drupal9 handled this, and opted for Drupal's method (and context naming), because WordPress only relied on code comments for context. Tested
|
I agree it's kind of silly to re-translate strings that have already been translated in PHP, but it does require that the operating system have the locale enabled, which is why most systems tend to re-implement them (including Drupal and WordPress). I didn't touch the week-names for now, but they probably have the same bug, it's just that we don't have admins (for now) in Whitehorse. I can update Transifex asap so that tests will pass. |
intl doesn't require the OS to have locales enabled. But I'm not going to push back much here. |
oh ok, hmm, I don't have strong opinions about it. I just felt like playing with those functions was a bit like trying a bunch of random things until one worked :) |
@eileenmcnaughton and I had a similar round of discussion a few months ago. I initially/instinctively felt that the So it sounds like we have 3-ish sources of translated month names - and some differing experiences with each:
If FWIW, anecdotally, I've never done anything to install
Ah, yes, the Scientific Method. 😃 I like your idea of using UTC when requesting bare names. Would #25154 be a way to adopt UTC (and fix TZ subtleties for Whitehorse Yukon) while still using IntlDateFormatter's larger dataset? |
Merged #25154 |
https://lab.civicrm.org/dev/core/-/issues/4012
Overview
Found an interesting bug that only happens with users who have chose the America/Whitehorse timezone (-0700). It does not happen if we chose another similar timezone (America/Vancouver, America/Yellowknife, etc).
https://lab.civicrm.org/dev/core/uploads/ea61f948003f258501391a3c90e2a6e3/image.png
To reproduce on dmaster / drupal7:
Then go to a contribution page:
https://dmaster.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=2
Before
Months are incorrectly "translated" (due to the timezone offset)
After
Fixed
Technical Details
Date formatting does not need to take timezones into account, so using UTC seems like the safest option.