[libgweather/issue-8: 3/3] Use the appropriate Unicode for temperature units




commit 6ce71e7079faaca4a59dfabe72248b62fd6a0f4e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Oct 24 18:49:25 2021 +0100

    Use the appropriate Unicode for temperature units
    
    The U+2103 DEGREE CELSIUS and U+2109 DEGREE FAHRENHEIT code points are
    compatibility characters, and there's no guarantee that they will
    actually exist.
    
    The preferred way to present degrees Celsius and Fahrenheit is to use
    U+00B0 and the letter C and F, respectively.
    
    Fixes: #8

 libgweather/gweather-weather.c | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 1d635eb4..21dd2997 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -880,34 +880,46 @@ temperature_string (gfloat temp_f, GWeatherTemperatureUnit to_unit, gboolean wan
     switch (to_unit) {
         case GWEATHER_TEMP_UNIT_FAHRENHEIT:
             if (!want_round) {
-                /* TRANSLATOR: This is the temperature in degrees Fahrenheit (U+2109 DEGREE FAHRENHEIT)
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
-                return g_strdup_printf (_ ("%.1f\u00A0\u2109"), temp_f);
+                /* TRANSLATOR: This is the temperature in degrees Fahrenheit
+                 * with a non-break space (U+00A0) between the digits and the
+                 * degrees sign (U+00B0), followed by the letter F
+                 */
+                return g_strdup_printf (_ ("%.1f\u00A0\u00B0F"), temp_f);
             } else {
-                /* TRANSLATOR: This is the temperature in degrees Fahrenheit (U+2109 DEGREE FAHRENHEIT)i
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
-                return g_strdup_printf (_ ("%d\u00A0\u2109"), (int) floor (temp_f + 0.5));
+                /* TRANSLATOR: This is the temperature in degrees Fahrenheit
+                 * with a non-break space (U+00A0) between the digits and the
+                 * degrees sign (U+00B0), followed by the letter F
+                 */
+                return g_strdup_printf (_ ("%d\u00A0\u00B0F"), (int) floor (temp_f + 0.5));
             }
             break;
         case GWEATHER_TEMP_UNIT_CENTIGRADE:
             if (!want_round) {
-                /* TRANSLATOR: This is the temperature in degrees Celsius (U+2103 DEGREE CELSIUS)
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
-                return g_strdup_printf (_ ("%.1f\u00A0\u2103"), TEMP_F_TO_C (temp_f));
+                /* TRANSLATOR: This is the temperature in degrees Celsius
+                 * with a non-break space (U+00A0) between the digits and
+                 * the degrees sign (U+00B0), followed by the letter C
+                 */
+                return g_strdup_printf (_ ("%.1f\u00A0\u00B0C"), TEMP_F_TO_C (temp_f));
             } else {
-                /* TRANSLATOR: This is the temperature in degrees Celsius (U+2103 DEGREE CELSIUS)
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
-                return g_strdup_printf (_ ("%d\u00A0\u2103"), (int) floor (TEMP_F_TO_C (temp_f) + 0.5));
+                /* TRANSLATOR: This is the temperature in degrees Celsius
+                 * with a non-break space (U+00A0) between the digits and
+                 * the degrees sign (U+00B0), followed by the letter C
+                 */
+                return g_strdup_printf (_ ("%d\u00A0\u00B0C"), (int) floor (TEMP_F_TO_C (temp_f) + 0.5));
             }
             break;
         case GWEATHER_TEMP_UNIT_KELVIN:
             if (!want_round) {
                 /* TRANSLATOR: This is the temperature in kelvin (U+212A KELVIN SIGN)
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
+                 * with a non-break space (U+00A0) between the digits and the degrees
+                 * sign
+                 */
                 return g_strdup_printf (_ ("%.1f\u00A0\u212A"), TEMP_F_TO_K (temp_f));
             } else {
                 /* TRANSLATOR: This is the temperature in kelvin (U+212A KELVIN SIGN)
-            * with a non-break space (U+00A0) between the digits and the degrees sign */
+                 * with a non-break space (U+00A0) between the digits and the degrees
+                 * sign
+                 */
                 return g_strdup_printf (_ ("%d\u00A0\u212A"), (int) floor (TEMP_F_TO_K (temp_f)));
             }
             break;


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