[libgweather] Add fallback in case _NL_MEASUREMENT_MEASUREMENT is not available



commit 1105cf3c5021f129fbfa090cb843fbd3e70c54f5
Author: Javier Jardón <jjardon gnome org>
Date:   Thu Sep 26 16:12:01 2013 +0100

    Add fallback in case _NL_MEASUREMENT_MEASUREMENT is not available

 libgweather/weather.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/libgweather/weather.c b/libgweather/weather.c
index b847e3a..4140f1c 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -701,6 +701,15 @@ gweather_info_get_conditions (GWeatherInfo *info)
 static gboolean
 is_locale_metric (void)
 {
+    /* Translate to the default units to use for presenting
+     * lengths to the user. Translate to default:inch if you
+     * want inches, otherwise translate to default:mm.
+     * Do *not* translate it to "predefinito:mm", if it
+     * it isn't default:mm or default:inch it will not work
+     */
+    gchar *e = _("default:mm");
+
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     const char *fmt;
     fmt = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
 
@@ -708,6 +717,14 @@ is_locale_metric (void)
        return FALSE;
     else
        return TRUE;
+#endif
+
+    if (strcmp (e, "default:inch")==0)
+        return FALSE;
+    else if (strcmp (e, "default:mm"))
+        g_warning ("Whoever translated default:mm did so wrongly.\n");
+
+    return TRUE;
 }
 
 static GWeatherTemperatureUnit


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]