Can't change locale settings (e.g. language, 12/24-hour time, date format) independently

Bug #1392699 reported by Matthew Paul Thomas
152
This bug affects 31 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Medium
Unassigned
Ubuntu UX
Triaged
Low
Matthew Paul Thomas
ubuntu-system-settings (Ubuntu)
In Progress
Medium
William Hua
unity8 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

A. Try to use US English, but with all apps using 24-hour instead of 12-hour time. Or:
B. Try to use UK English, but with all apps using YYYY-MM-DD date format.

What happens: You can't.
What should happen: You can.

Since Ubuntu has existed, it has used the GNU locale system. This system assumes that every single person using a particular locale wants exactly the same settings for time display, date display, currency display, alphabetizing, and number formatting. <http://www.gnu.org/software/libc/manual/html_node/Effects-of-Locale.html>

Windows, Mac OS, and (to a lesser extent) iOS have always been more flexible: setting a locale sets appropriate defaults for these settings, but you can also change them individually. Ubuntu should do the same.

This might involve changing the locale system itself, or it might involve changing all relevant toolkits so that they ignore the locale system when appropriate.

It would also involve adding settings in System Settings to customize the individual locale details.

Related branches

Revision history for this message
Michał Sawicz (saviq) wrote :

I don't thin blaming the GNU locale system is right:

⟫ locale
LANG=pl_PL.UTF-8
LANGUAGE=pl:en
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC=pl_PL.UTF-8
LC_TIME=pl_PL.UTF-8
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY=pl_PL.UTF-8
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER=pl_PL.UTF-8
LC_NAME=pl_PL.UTF-8
LC_ADDRESS=pl_PL.UTF-8
LC_TELEPHONE=pl_PL.UTF-8
LC_MEASUREMENT=pl_PL.UTF-8
LC_IDENTIFICATION=pl_PL.UTF-8
LC_ALL=

For each of those we could provide a setting separate to the language selected. Case in point, using Qt.formatTime():

⟫ qmlscene test.qml
qml: 14:02
⟫ LC_TIME=en_US.UTF-8 qmlscene test.qml
qml: 2:03 PM

Granted, the "en_US" part should probably be "12hour" instead, but I believe this should be doable just fine.

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

That's promising! So imagine System Settings had a setting for 12-hour vs. 24-hour time, for example, and you toggled the setting. What would need to happen for a running app to pick up that change? Would you need to restart the app? Or restart the system?

Revision history for this message
Michał Sawicz (saviq) wrote :

As things stand now, yes, we'd need to restart the app. For the greeter and indicator to notice, we might need to restart the shell, so more or less restart the phone. We're basically in the same boat as changing display language.

Whether it makes sense to "fix" to be able to dynamically react to such a change... in real life I'd say it's a moot problem, as people never change that setting once they're through with it.

Revision history for this message
Cris Dywan (kalikiana) wrote :

It's the same way changing the language… you're expected to reboot because there's no simple way of ensuring everything will update at runtime.

I assume all we need is a new setting. Support for this is up to the apps.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Invalid
Changed in libc (Ubuntu):
status: New → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-system-settings (Ubuntu):
status: New → Confirmed
Revision history for this message
FransSchreuder (fransschreuder1) wrote :

The same is true for the metric system. Ubuntu touch thinks that everyone who speaks English, calculates their distance in miles / feet / whatever unit from the stone age.
Even though I am Dutch, I like my phone to be in the English language, but I do want my distances to show in metres, kilometres etc.
There is even a language called "English (Denmark)", but even that language uses miles

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

FransSchreuder, if English (Denmark) uses (or once this bug is fixed, defaults to) imperial measurements when it shouldn't, please report that as a separate bug.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

The en_DK.UTF-8 locale does the right thing.

$ LC_MEASUREMENT=en_DK.UTF-8 locale measurement
1
$ LC_MEASUREMENT=en_US.UTF-8 locale measurement
2
$

Revision history for this message
Alexey Dokuchaev (danfe) wrote :

By reading ubuntu-system-settings/trunk/plugins/language/language-plugin.cpp source code, it appears that this rather common problem (preferred en_US locale and 24-hour military clock) happens because selected language (translated to locale) is assigned *both* to the Language and FormatsLocale of the org.freedesktop.Accounts.User properties.

It can be fixed (until you change it with ubuntu-system-settings again) by changing FormatsLocale after you've set your desired language, and restarting device:

$ dbus-send --print-reply --system --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User$UID org.freedesktop.Accounts.User.SetFormatsLocale string:'ru_RU.UTF-8'

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Please note that for 5 years or so Ubuntu has provided GUIs for setting language on one hand, and the formats related locale categories as a whole on the other hand, separately. It's true that there has been no GUI for setting the various formats related locale categories independently. OTOH, I have followed the language/locale related bug reports and Ask Ubuntu questions closely for quite a while, and my impression is that few users would rate that feature high. (It's also possible to fine tune the settings by editing e.g. ~/.profile.)

It should be noted that the example in the summary of this bug report - changing 12/24-hour time and date format independently - can't be accomplished by picking the different locale categories individually anyway, since both are controlled by LC_TIME. To do that we would either need to add a feature that creates and maintains a custom locale for each user, or handle it in respective application.

As a first step, to make some progress and make it possible to fix bug #1350275, I would recommend that a GUI is added to ubuntu-system-settings for simply selecting regional formats independently from selecting the display language. As illustrated by Alexey's workaround, the backend in accountsservice for such a feature is already in place.

Changed in ubuntu-ux:
assignee: nobody → Matthew Paul Thomas (mpt)
Changed in ubuntu-ux:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Seems to be waiting on a design

Changed in canonical-devices-system-image:
assignee: nobody → Bill Filler (bfiller)
status: New → Incomplete
Changed in canonical-devices-system-image:
importance: Undecided → Low
no longer affects: libc (Ubuntu)
Revision history for this message
Gregory Opera (gregoryopera) wrote :

Introduce 24-hour ("military") time... My (Ubuntu) computer can do it, and I use it daily in my line of work; not having this is frustrating.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Can we implement the suggestion at the end of comment #10

Changed in canonical-devices-system-image:
importance: Low → Medium
milestone: none → 11
status: Incomplete → Confirmed
tags: added: bq-feedback
Bill Filler (bfiller)
Changed in ubuntu-system-settings (Ubuntu):
assignee: nobody → Ken VanDine (ken-vandine)
importance: Undecided → Medium
Bill Filler (bfiller)
tags: added: system-apps-11
Changed in canonical-devices-system-image:
milestone: 11 → 12
no longer affects: ubuntu-ui-toolkit (Ubuntu)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Any update on getting a design for this mpt?

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

@william would you be able to take a look at adding the regional formats as a separate setting

Changed in ubuntu-system-settings (Ubuntu):
assignee: Ken VanDine (ken-vandine) → William Hua (attente)
Revision history for this message
Will Cooke (willcooke) wrote : Automatically added comment
tags: added: desktop-trello-import
tags: removed: desktop-trello-import
Revision history for this message
Will Cooke (willcooke) wrote :

As I understand it then, a user would have to restart in order to change the language, then restart to change the formats.

Could we add an option to "Apply but don't reboot" so that you can change both of these things and then do one restart?

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Alternately can we offer the option to change the other setting like
"Would you like to change the Date and number format now?" if no prompt to reboot if yes go to that panel and queue both changes. Cancel would cancel both.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Add to the oobe as well

Changed in canonical-devices-system-image:
assignee: Bill Filler (bfiller) → Will Cooke (willcooke)
Changed in unity8 (Ubuntu):
assignee: nobody → Michael Terry (mterry)
Changed in canonical-devices-system-image:
status: Confirmed → In Progress
Changed in ubuntu-system-settings (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Will Cooke (willcooke) wrote :

Asked Ken to do a review.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity8 (Ubuntu):
status: New → Confirmed
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

This bug is about changing locale formats, similar to how its done on the desktop. We would like to also provide the visual display of example formats when the selection is made and before committing the change.

The duplicate bugs were all about 12/24 time format change which is controlled separately from the language and formats. I will un-dupe those bugs so it can be addressed separately.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

@jibel can you add whatever concerns came during testing?
note we have a separate issue to add the 12/24 toggle

Changed in canonical-devices-system-image:
milestone: 12 → 13
assignee: Will Cooke (willcooke) → Jean-Baptiste Lallement (jibel)
milestone: 13 → none
Changed in canonical-devices-system-image:
assignee: Jean-Baptiste Lallement (jibel) → nobody
status: In Progress → Confirmed
Michael Terry (mterry)
Changed in unity8 (Ubuntu):
assignee: Michael Terry (mterry) → nobody
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.