From c24218f4f705329d1f30c5bad8bb80ed592fd5a9 Mon Sep 17 00:00:00 2001 From: Philippe Troin Date: Fri, 24 May 2019 15:15:51 -0700 Subject: [PATCH] Handle C locale. Fixes: JS ERROR: RangeError: invalid language tag: C formatTemperature@/home/phil/.local/share/gnome-shell/extensions/openweather-extension@jenslody.de/extension.js:1343:16 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 parseWeatherCurrent@/home/phil/.local/share/gnome-shell/extensions/openweather-extension@jenslody.de/openweathermap_org.js:319:23 _asyncReadyCallback@/home/phil/.local/share/gnome-shell/extensions/openweather-extension@jenslody.de/extension.js:553:13 wrapper@resource:///org/gnome/gjs/modules/_legacy.js:82:22 --- src/extension.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index 14c83eb..e43e006 100644 --- a/src/extension.js +++ b/src/extension.js @@ -155,7 +155,9 @@ const OpenweatherMenuButton = new Lang.Class({ // Get locale, needed for toLocaleString, workaround for gnome-shell 3.24 this.locale = GLib.get_language_names()[0]; - if (this.locale.indexOf('_') != -1) + if (this.locale == 'C') + this.locale = 'en'; + else if (this.locale.indexOf('_') != -1) this.locale = this.locale.split("_")[0]; // Create user-agent string from uuid and (if present) the version