Time format not taken from LC_TIME
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Indicator Date and Time |
Fix Released
|
Undecided
|
Michael Terry | ||
Ubuntu Translations |
Fix Released
|
Undecided
|
Unassigned | ||
indicator-datetime (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: indicator-datetime
This is a break-out bug from bug 579134.
Whether time is formatted as 24h or not should be taken from LC_TIME.
Unfortunately, locales don't provide an easy way to ask the question "Is time in 24h format?". strftime provide a couple format strings like %X that give the preferred format string, but %X always includes seconds. So you can either strip seconds in some clever way or find another way to ask the question.
Asking whether fields like AM_STR, PM_STR, or T_FMT_AMPM are defined is not definitive. 24h locales like en_GB may define those because it wants to provide a known way to format 12h if asked for it (i.e. 12h is not unheard of in en_GB and does have preferred representations if the caller knows they want 12h).
The only way I've seen in my searches is to parse the value of T_FMT and see if it includes 24h format strings. Which is only slightly cleaner than stripping seconds from %X.
I'm attaching a testing program that works for me. Compile it like so: gcc -o is24 is24.c
$ LC_TIME=
T_FMT: %r
Is 24h: no
$ LC_TIME=
T_FMT: %T
Is 24h: yes
$ LC_TIME=
T_FMT: %H:%M:%S
Is 24h: yes
Related branches
- Ted Gould (community): Approve
-
Diff: 183 lines (+76/-26)3 files modifieddata/org.ayatana.indicator.datetime.gschema.xml (+1/-1)
po/Makevars (+7/-0)
src/indicator-datetime.c (+68/-25)
Changed in indicator-datetime: | |
status: | In Progress → Fix Committed |
milestone: | none → 0.1.91 |
Changed in indicator-datetime: | |
status: | Fix Committed → Fix Released |
tags: | added: iso-testing |
Changed in indicator-datetime (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in ubuntu-translations: | |
status: | New → Fix Released |
just see https:/ /bugs.edge. launchpad. net/indicator- datetime/ +bug/579134/ comments/ 19
You can discuss this next week with ted, I think