GNOME Bugzilla – Bug 695873
Get the default temperature unit from the locale
Last modified: 2013-09-22 10:20:39 UTC
LC_ALL=en_GB.UTF-8 gnome-weather shows the temperatures in centigrade LC_ALL=en_US.UTF-8 gnome-weather shows the temperature in Fahrenheit If the locale is unknown, centigrade is the new default.
Created attachment 238919 [details] [review] Get the default temperature unit from the locale Instead of defaulting to Fahrenheit which is barely used across the world (Americans and old Brits, really...).
Review of attachment 238919 [details] [review]: No. The default should be handled by GSettings already.
The problem is that if the locale isn't translated, they'll end up with fahrenheit, which is completely useless as it's only used in a few places (from http://en.wikipedia.org/wiki/Fahrenheit#Usage): "Fahrenheit is used in the United States, Belize, Palau and the United States territories of Puerto Rico, Guam and the U.S. Virgin Islands[6] for everyday applications." Changing the default to automatically use the locale data (while keeping it translatable) means that we can override the locale's preferred unit (metric system but fahrenheit used, we can support that!), and we still fall back on the locale data, and if the locale doesn't include that data, fall back on celsius which is the most likely to be right.
There is one problem with this patch: it creates an inconsistency wrt LC_MESSAGES vs LC_TIME/NUMERIC/FORMAT, as GSettings uses messages, but nl_langinfo uses the right locale category. Now, ideally we would tell GSettings to do the right thing, but that's not possible with the current gettext infrastructure: autopoint and intltoolize are hardwired to generate LC_MESSAGES po files. Alternatively, we can remove the GSettings translation and use nl_langinfo consistently. The downside is that for example for wind speed and pressure it is not a metric vs imperial dichotomy. In either case, this needs to be applied consistently to all units: temperature, speed, distance and pressure.
Created attachment 239874 [details] [review] GWeatherInfo: don't use LC_MESSAGES for default measure units GSettings translation uses gettext, which uses LC_MESSAGES, instead of the appropriate LC_MEASUREMENT category. To get that, we need to use nl_langinfo. The downside is that it only offers metric or imperial, rather than having more finegrained defaults for different countries. The choices implemented are Farenheit / miles / knots / inchHg for imperial, and Celsius / meters / km/h / mmHg for metric. For the sake of discussion, this is how it would look like to use nl_langinfo exclusively.
Review of attachment 239874 [details] [review]: Yep, that's much better than what we had before in my opinion.
Attachment 239874 [details] pushed as c9383cd - GWeatherInfo: don't use LC_MESSAGES for default measure units
*** Bug 696957 has been marked as a duplicate of this bug. ***