Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Timestamp handling - 12 hour clock with AM/PM, i18n variations
I noticed something odd that I would appreciate guidance on, especially if you live in another country/territory to me.
Where I live, one of the ways the time of day can be written in with a 12-hour clock, followed by an AM or PM notification: AM means after midnight and before midday/noon, and PM means midday/noon to midnight.
So, when our friend Donald leaves his default comment with a timestamp:
Donald Swain
Jul 17, 05:00 PM (1 hour ago)
I enjoy your site very much.
Note the ‘PM’ suffix. This is expected behaviour.
When I change the front end language to some (most? all?) other languages, the AM/PM marker disappears. For example, in Russian:
Donald Swain
июл 17, 05:00 (1 час назад)
I enjoy your site very much.
…and Spanish:
Donald Swain
jul 17, 05:00 (1 hora hace)
I enjoy your site very much.
…Estonian:
Donald Swain
juuli 17, 05:00 (1 tund tagasi)
I enjoy your site very much.
…Finnish:
Donald Swain
heinä 17, 05:00 (1 tunti sitten)
I enjoy your site very much.
This seems wrong to me – 05:00 could be in the morning or afternoon.
Have I just found a combination of languages where the time-of-day marker isn’t used, or do we have a problem with timestamps?
Thank you for any input.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
I think that this can be corrected by modifying the format used in posted
, modified
and comment_time
, alas manually.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
Niiice! This must be the most ancient bug. English uses %p
(for AM/PM
) in time formats, which does not seem to work in other languages. When switching from English to, say, Russian, the pref stays unchanged, but looses its AM/PM
part when output.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
etc wrote #324663:
This must be the most ancient bug.
Do I win a prize?
Let me guess…find a solution.
Alright. Challenge accepted.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
Sorry, Pete, the bug-squashing reflex was too strong. Next time..:-)
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
etc wrote #324667:
Sorry, Pete, the bug-squashing reflex was too strong. Next time..:-)
Oleg, thank you – you’ve made a somewhat testing evening much better.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
Weird, it becomes possible to remove all languages, even the public one. And then half of the strings are untranslated, while another half is in a removed language. Dunno since when, but it happens only in 4.8.2. Good luck, Pete.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
This actually prompted me to check the greek translation which was slightly wrong but now corrected.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations
etc wrote #324669:
It becomes possible to remove all languages, even the public one
Cache issue, like the one in 4.8.1 where it showed the recently uninstalled language until you refreshed.
Fixed with a rather large sledgehammer: force refresh the language object every time the list is displayed. Please test.
Last edited by Bloke (2020-07-18 10:37:05)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online