Bug 497514 - Digital clock: AM/PM is not localized and interrelated issues
Summary: Digital clock: AM/PM is not localized and interrelated issues
Status: REOPENED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Digital Clock widget (show other bugs)
Version: 6.2.4
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-15 17:14 UTC by Faidon Liambotis
Modified: 2025-02-26 13:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Faidon Liambotis 2024-12-15 17:14:30 UTC
SUMMARY

AM/PM is not localized to my locale setting (LC_TIME=el_GR.UTF-8). See below in steps to reproduce for examples.

Moreover, while attempting to workaround this I came across the following issues:
1. Digital Clock allows one to configure the date format, but not the time format (the field is called "Date format", but the link below it has a label of "Time Format documentation", which is a bit jarring by itself). Putting "h:mm ap" or "hh:mm AP" in there manually results in the correct, localized AM/PM setting which could serve as a workaround. However, it's not possible to hide the default time format from the widget.
2. Setting the clock to a 24-hour format, as another attempt to  attempt to mask the AM/PM issue, is setting the clock to e.g. "9:45" instead of "09:45", which is quite confusing, at least in my locale. Again, one can configure "date format" to "HH:mm", but cannot hide the default clock formatting.

STEPS TO REPRODUCE
1. Set locale to el_GR.UTF-8. In my case: LANG=el_GR.UTF-8 LANGUAGE=en_US:en LC_MESSAGES=en_US.UTF-8.
2. Set date format to "Long date".
2. Set digital clock to 12-Hour mode.
3. Observe the clock.
4. Set date format to "Custom". Set date format to "dddd MMMM d hh:mm ap", to demo that the time is localized when formatted manually, but not when formatted automatically.
5. Observe the clock.

OBSERVED RESULT
After step 3: Κυριακή 15 Δεκεμβρίου 2024 7:07 PM
After step 5: Κυριακή 15 Δεκεμβρίου 2024 7:07 μ.μ. 7:07 PM

EXPECTED RESULT
After step 3: Κυριακή 15 Δεκεμβρίου 2024 7:07 μ.μ.
After step 5: Κυριακή 15 Δεκεμβρίου 2024 7:07 μ.μ. 7:07 μ.μ.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2
Kernel Version: 6.12.3-amd64 (64-bit)

ADDITIONAL INFORMATION

Note that I have a slightly unusual setup with LANG=el_GR.UTF-8 LANGUAGE=en_US:en LC_MESSAGES=en_US.UTF-8 on a Debian unstable system. However, I've verified that this happens on a live VM with KDE Neon, when changing language from system settings to Greek, and logging out/in again.

Also note that in my locale, the normal case for AM/PM is lowercase, i.e. "π.μ./μ.μ". Qt calls this "ap", I believe, in constrast to "AP". The Plasma widget code seems to hardcode "AP" as far as I can tell, so I'm noting this in case it matters when fixing the broader localization issue.

On a yet another unrelated issue, on my Debian unstable desktop, with Plasma 6.2.4, systemsettings under Region & Language -> Time, the time is formatted as "Π.Μ./Μ.Μ (uppercase), but in KDE Neon as "π.μ./μ.μ." (lowercase). This is probably not a plasmashell issue, but I have no idea where it lies or how to report it...
Comment 1 Nate Graham 2024-12-16 19:11:42 UTC
*** This bug has been marked as a duplicate of bug 340982 ***
Comment 2 Faidon Liambotis 2024-12-16 23:18:16 UTC
I read the description as well as a good chunk of the comments* of the bug report this was merged to, and failed to see the connection. Are you sure this is a duplicate? Could you perhaps elaborate? Thanks!

*: admittedly not all of them, as there are... 274 of them.
Comment 3 Nate Graham 2024-12-17 16:26:00 UTC
As I understand it, it's the same issue of being unable to set just the format of the date and not also its language. The two are linked which causes this issue.
Comment 4 Faidon Liambotis 2024-12-17 20:19:21 UTC
(In reply to Nate Graham from comment #3)
> As I understand it, it's the same issue of being unable to set just the
> format of the date and not also its language. The two are linked which
> causes this issue.

No that's not it. First of all, this bug is about time (not date). Second, the primary issue that the time display does not respect the current locale and shows AM/PM in (presumably) the English locale even if the system is not set to English. Sorry if this was confusing.
Comment 5 pallaswept 2025-02-26 13:58:33 UTC
(In reply to Faidon Liambotis from comment #0)
> 4. Set date format to "Custom". Set date format to "dddd MMMM d hh:mm ap",
> to demo that the time is localized when formatted manually, but not when
> formatted automatically.

Thanks for sharing this detail, it gave me a hint about how to deal with it. This helped me fix several problems, really appreciate it.

I'll be submitting a fix for this soon. I've never contributed to KDE before so it might take a little while, but I have this working here already so it's not far away.