[gnome-maps/wip/mlundblad/transit-service-discovery: 10/13] utils: Add function to get current language
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-service-discovery: 10/13] utils: Add function to get current language
- Date: Sat, 31 Aug 2019 10:55:56 +0000 (UTC)
commit f0684614fbdd0831782b3e689177c06692b96ccb
Author: Marcus Lundblad <ml update uu se>
Date: Sat Aug 31 12:52:43 2019 +0200
utils: Add function to get current language
Get current first-choice language, as ISO 639-2 code.
src/utils.js | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/src/utils.js b/src/utils.js
index 2407e3c..f781e07 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -213,6 +213,15 @@ function getMeasurementSystem() {
return measurementSystem;
}
+/**
+ * Get the higest priority bare lange currently in use.
+ */
+function getLanguage() {
+ let locale = GLib.get_language_names()[0];
+ // the last item returned is the "bare" language
+ return GLib.get_locale_variants(locale).slice(-1)[0];
+}
+
function getAccuracyDescription(accuracy) {
switch(accuracy) {
case Geocode.LOCATION_ACCURACY_UNKNOWN:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]