The date and time indicator should respect the locale setting for time format

Bug #579134 reported by Pierre
236
This bug affects 63 people
Affects Status Importance Assigned to Milestone
Indicator Date and Time
Fix Released
Wishlist
Unassigned
Ubuntu Translations
Fix Released
High
Unassigned
indicator-datetime (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I live in Belgium and I want the clock to display a 24h time stamp instead of the default am/pm display in the indicator-applet.
Then I can remove the other time-applet from the gnome-panel cause now I have 2 clocks !

Tags: patch

Related branches

affects: indicator-applet → indicator-datetime
Changed in indicator-datetime:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Didier/Ted, can you please crank up the priority? This is not "wishlist", showing 12 hour format in 24 h countries is just wrong and confusing. Worse, it does not even show AM/PM (not that these would have a generally understood meaning in e. g. Germany)

Revision history for this message
Maciej Wakula (adderek-spam+launchpad-net) wrote :

I don't see why the indicator applet would need a clock in it - there is a separate panel for that.
Regarding the click that is implemented in this indicator applet - it is terrible. You have forced some weird time format. Please, read about ISO-8601. I am uting ISO-8601 although it is not the format used in my country.
In my opinion this clock decreased functionality of indicator applet, is user-unfriendly and ruined the applet.
I fully support the statement that it is not a "wishlist" - it should be rather "major bug in the design".

Revision history for this message
Luca Ferretti (elle.uca) wrote :

Could someone test if something like the attached patch will work?

In order to test it you have to
  * apply the patch
  * go to po/ directory
  * run `intltool-update es` (update the Spanish translation adding new translatabe strings)
  * edit es.po translating "%l:%M %p" as "%k:%M"
  * run make && make install
  * logout and login using Spanish as session language.

However, here[1] is the snipped from gnome-panel used to update the date/time label.

http://git.gnome.org/browse/gnome-panel/tree/applets/clock/clock.c#n428

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 579134] Re: Indicator Applet - Time Settings no 24h

Hello Luca,

I think the _(utf8) in the gtk_menu_item_set_label isn't necessary
(and will also probably just confuse xgettext). It's built from
longstr, which is already localized.

Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

Revision history for this message
Luca Ferretti (elle.uca) wrote : Re: Indicator Applet - Time Settings no 24h

Hi Martin,

yes, it should be tested. Sometimes it appens that you need to specify the _() twice, the first to "pick up" the translatable message, the second one to actually use the translated message. I'm not sure this is the case, but... prevention is better then cure :)

Revision history for this message
Ted Gould (ted) wrote : Re: [Bug 579134] Re: Indicator Applet - Time Settings no 24h

On Tue, 2010-07-06 at 00:31 +0000, Luca Ferretti wrote:
> Could someone test if something like the attached patch will work?

Haven't tested, but I'm pretty sure it won't. The translated string
there is used for measuring the size of the applet so it doesn't adjust
size as the time change. It isn't used for rendering.

Revision history for this message
Pierre Prinetti (pierreprinetti) wrote : Re: Indicator Applet - Time Settings no 24h

Just wanted to say that the real problem is How the hell do I remove that clock from indicator-applet

Revision history for this message
Markus Birth (mbirth) wrote :

The time format should be retrieved from the LC_TIME locale. That's where the correct format for the selected region is contained.

David Planella (dpm)
Changed in ubuntu-translations:
status: New → Triaged
importance: Undecided → High
David Planella (dpm)
summary: - Indicator Applet - Time Settings no 24h
+ The date and time indicator should respect the locale setting for time
+ format
Revision history for this message
Erlan Sergaziev (sergeant) wrote :

I am by no means anti-American, but am sick of their locale.
Week starts on Sunday? Inches? Gosh.

To developers: please can you make a general applet where one can configure all the locale settings (time, date, number format, measurement system etc.) and make all Gnome apps honour these settings.

Revision history for this message
Michael Terry (mterry) wrote :

Erlan, that's System->Administration->Language Support->Text. It lets you set a special time/date/numbers locale that's different from the locale used for translations.

tags: added: patch
Revision history for this message
Luca Ferretti (elle.uca) wrote :

More info about this issue. I was playing with dconf-editor (package:dconf-tool) and it seems the "time-format" key default value is "locale-default", but indicator-datetime is unable to read it or apply.

In fact, if you change it in dconf-editor to 24-hours or 12-hours and switch back to local-default, the indicator shows the current time in proper format.
Maybe something gone wrong in GSettings?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

ok, looking at it, all seems good for French locale (it's translated and such), but indicator is still 12 hour format.

In src/indicator-datetime:
The thing is this function (which is working fine), is only picked up on property changes
(call in set_property for gchar * newformat = generate_format_string(self);)
But on initialization, all property are already set by the constructor and no update is required (no gsetting value change), so:

    if (!update) {
        return;
    }
sadly exit before getting any chance to execute the right function :-)

So, two solution: for a refresh on first set or call generate_format_string() somewhere else during object init.

Revision history for this message
Martin Pitt (pitti) wrote :

This was recently discussed in #ubuntu-desktop, and the result was that the most robust solution is to ask

  nl_langinfo (T_FMT)
     == '%T' -> 24 hour
     == '%r' -> AM/PM

T_FMT is what strftime(%X) uses as well.

  http://sourceware.org/git/?p=glibc.git;a=blob;f=time/strftime_l.c;h=08c2aeb32be6421cb8075dfae3579da4ee02644a;hb=HEAD#l1177

Revision history for this message
Michael Terry (mterry) wrote :

For a LC_TIME="en_GB.utf8" locale, nl_langinfo(T_FMT) just returns "%H:%M:%S" directly without the intermediary"%T. So perhaps just grep the return value of T_FMT for any of %H, %k, %R, or %T.

Revision history for this message
Ted Gould (ted) wrote :

@Didier, yes, let me look
@Martin and Michael, I'm not really comfortable parsing a format string and using that to determine what should happen. It seems that if it reliable, it makes sense to have that function in libc where we can then call it. This way if the format strings change or the behavior changes it's all in the same library.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-datetime - 0.0.6-0ubuntu3

---------------
indicator-datetime (0.0.6-0ubuntu3) maverick; urgency=low

  * Cherry-picked from upstream:
    - Fix date string format (12/24h) not taken from translation (LP: #579134)
 -- Didier Roche <email address hidden> Thu, 30 Sep 2010 16:09:41 +0200

Changed in indicator-datetime (Ubuntu):
status: New → Fix Released
Revision history for this message
Michael Terry (mterry) wrote :

In my LC_TIME="en_GB.UTF-8" locale, I still see 12h format when I should see 24h (with 0.0.6-0ubuntu3). Did Didier's fix just fix some issue with the existing translation method not working?

There's still the underlying bug that indicator-datetime doesn't respect LC_TIME and instead uses LC_MESSAGES to determine 24hourness (let alone that it doesn't have translations for all locales). I thought this bug was about that, but shall I open a different bug to track that issue?

Revision history for this message
Michael Terry (mterry) wrote :

I filed bug 652976 about the LC_TIME issue.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

it's unlikely LC_TIME will work as ted's approach is to realy on LANG locale and picking up a string from translation. If you run it under LANG="en_GB.UTF-8", that should work (even if it doesn't respect the spec)

David Planella (dpm)
Changed in ubuntu-translations:
status: Triaged → Fix Released
Revision history for this message
jango (pjalegria) wrote :

Maverick Netbook Edition PT-pt and still have this issue...

Revision history for this message
Link Porterfield (artgravity) wrote :

Maverick Netbook Edition LC_TIME is not being respected. The dconf-editor workaround did not fix it when set to locale-default. Using dconf-editor to force 24 hour time resolves the issue, but it is still a workaround rather than a fix. Checking LC_TIME time is preferable.

Revision history for this message
Alexander Zayats (z4y4ts) wrote :

Maverick Netbook Edition uk_UA and still have this issue...

Revision history for this message
Grey Nicholson (greytheearthling) wrote :

How would we go about getting this bug reopened?

Either the en-GB locale incorrectly specifies the 12-hour format—in which case please point us to that bug report—or the time indicator still doesn't respect my locale settings.

Revision history for this message
Martin Pitt (pitti) wrote :

Greg, bug 652976 is still open and basically the same issue.

Ted Gould (ted)
Changed in indicator-datetime:
status: Triaged → Fix Released
Revision history for this message
peterzay (peterzay) wrote :

My version of this bug is somewhat different. When I installed 11.04, I left the suggested America/Montreal location as is. Next boot, when the login window appeared, I set the language option (bottom left) to English US. The keyboard option was already set to USA. When I got the desktop, I was expecting to see Sat Apr 16 (US locale) but got Sat 16 Apr (Canada locale) instead. In prior versions of Ubuntu, this language setting change always gave the desired locale on the desktop panel.

Revision history for this message
dawez (dawez1) wrote :

This is still happening today on 10.10 Maverick . Still not get why there are 2 applet for the clock : clock and indicator-datetime. clock has nice settings and you can setup properly 12/24 hours but the indicator-datetime does not have any tabs in the preferences. When I click on "Time and Date Settings" I can only specify the timezone/configuration/time servers.

I am using English-IE locale and Germany as location.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.