Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-07-17 16:30:59

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

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

#2 2020-07-17 17:00:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

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

#3 2020-07-17 17:02:37

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

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

#4 2020-07-17 18:36:20

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

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

#5 2020-07-17 20:12:06

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

Re: Timestamp handling - 12 hour clock with AM/PM, i18n variations

Sorry, Pete, the bug-squashing reflex was too strong. Next time..:-)

Offline

#6 2020-07-17 20:15:11

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

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

#7 2020-07-17 21:39:04

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

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

#8 2020-07-18 05:23:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

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

#9 2020-07-18 10:36:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

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

Board footer

Powered by FluxBB