Skip to content

Localization

Marian Arlt edited this page Nov 1, 2018 · 6 revisions

The never ending story

Time and Date

This is probably one of those things people hate most in any Linux distribution and maybe even in other operating systems. For it is something so dead simple yet its implementation is confusing, inconsistent and just plain bad in a lot of cases.

Sugar will take the locales of your system to generate its language and time formats by default. Please refer to the Arch wiki if you want to know more about system locales, what they are and how to generate or change them.
In most cases this should work as expected but in some other cases you might experience inconsistencies. Sugar makes it possible to hard set the locale for its clock to make you worry less about your system although it is recommended to get your system locales right before relying on this feature.

Locale= accepts a string containing a common combination of a lowercase standardized language code joined with a low line to an uppercase standardized country code. For Mexico–for example–this would be "es_MX", or "de_AT" for Austria. This will influence the formatting of the clock. Numbers are written different in Mexico and in Spain ("es_ES"). Apparently this will also change the language of the clock to the set locale.

Formats

HourFormat= changes how the current time is printed out to the screen. This is not trivial and will result in your clock not displaying at all if you pass an invalid string. You can refer to the Qt documentation for details on valid and invalid characters. By default Sugar prints a compact format which is known as Locale.ShortFormat. You can set this to "long" which translates internally to Locale.LongFormat or construct a custom string referring to the mentioned documentation. As an example I personally use a system with the locale set to "en_US" everywhere, showing everything in English language and formatting. I'm not native English speaker though and I don't like the American style of formatting the clock. So I set the hour format to a simple "hh:mm" to override the locale standards. Sweet as sweet can be!

DateFormat= is exactly the same as HourFormat just for the date. The exception is that the date defaults to Locale.LongFormat and accepts "short" instead. Of course you can construct a custom string here as well. My favorite is "dddd, MMMM d". To spare you on the docs: Fixed strings are possible with single quotes like so: "'Today is:' dddd, MMMM d'.'" where whitespace is respected anywhere.

Clone this wiki locally