GNOME Bugzilla – Bug 684976
Having default language list based on location
Last modified: 2021-06-09 16:12:06 UTC
Rather than based on popularity across the world. We'd fall back to that list of popular languages if location services weren't available.
Now that geoclue works well, we can use it to implement this feature. The data for which languages are used in which country can be taken from CLDR. In case you are unfamiliar with CLDR, here it is: http://cldr.unicode.org/index/downloads specifically http://www.unicode.org/Public/cldr/25/json.zip Inside this zip file you have many useful json files, for this feature you'll need /supplemental/territoryInfo.json - it includes a list of languages spoken in each country, including percentage of speakers and "official language" status so you can also sort by popularity in the region the user is at. I'm willing to try and implement this, but I don't know how complicated this will be - I never wrote anything that parses JSON in C, and I never worked with geoclue.
(In reply to comment #1) > Now that geoclue works well, we can use it to implement this feature. > > The data for which languages are used in which country can be taken from CLDR. > > In case you are unfamiliar with CLDR, here it is: > http://cldr.unicode.org/index/downloads > > specifically http://www.unicode.org/Public/cldr/25/json.zip > > Inside this zip file you have many useful json files, for this feature you'll > need /supplemental/territoryInfo.json - it includes a list of languages spoken > in each country, including percentage of speakers and "official language" > status so you can also sort by popularity in the region the user is at. Cool. Thanks for all the needed details for implementation. > I'm willing to try and implement this, but I don't know how complicated this > will be - I never wrote anything that parses JSON in C, and I never worked with > geoclue. neither of those are complicated. json-glib is pretty easy to use and you can find examples in geocode-glib and geoclue. About geoclue, its a dbus service with a rather simple API: http://www.freedesktop.org/software/geoclue/docs/ . You'll want to generate C wrappers to make it even simpler. Check the demo where-am-i (part of geoclue) and/or 'Date&Time' panel code in gnome-settings-deamon.
Implementation question before I even begin: How do we get the data? Do we download this zip on runtime and extract the JSON? do we bundle it in the control-center tarballs? Do we expect distributions to install it separately?
More questions: Is geoclue fast enough in most cases to return a result in less than 2 seconds? Should I display a spinner if finding the location takes more than 2 seconds? Does geoclue (and geocode-glib) check the network status prior to trying to get a location? I'd want to degrade to the hardcoded default language list as quickly as possible if a location cannot be obtained. Should the geoclue and geocode-glib dependencies be optional or mandatory? (I'd prefer mandatory, for obvious reasons) Should there be some sort of indication in the UI that the list is based on the user's current location?
(In reply to comment #4) > More questions: > > Is geoclue fast enough in most cases to return a result in less than 2 seconds? Even if it is, you really shouldn't rely on that. > Should I display a spinner if finding the location takes more than 2 seconds? You probably should display it anyway. > Does geoclue (and geocode-glib) check the network status prior to trying to get > a location? Yes (only geoclue), through glib's network monitor > I'd want to degrade to the hardcoded default language list as > quickly as possible if a location cannot be obtained. Sure, you can have a timeout but typically you'd get a location (geoip or wifi) within a few seconds. > Should the geoclue and geocode-glib dependencies be optional or mandatory? (I'd > prefer mandatory, for obvious reasons) gnome-control-center isn't expected to be used outside GNOME and gnome-settings-daemon already have hard dep on both so just add a hard dep I'd say. > Should there be some sort of indication in the UI that the list is based on the > user's current location? That would be a question for designers but I think it might be a good idea (though its not mandatory).
I actually think we want this information based on Location in gnome-initial-setup. It doesn't make as much as after the fact like here.
I think it should be the same in both.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new bug report at https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/ Thank you for your understanding and your help.