diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-10-24 18:49:25 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2021-10-24 18:02:40 +0000 |
commit | 6ce71e7079faaca4a59dfabe72248b62fd6a0f4e (patch) | |
tree | c318273fa43f85e7c87bf998c2edcefdb743fd40 | |
parent | b6a66101a74cb63343943f07b9ce5cd35275d110 (diff) | |
download | libgweather-6ce71e7079faaca4a59dfabe72248b62fd6a0f4e.tar.gz |
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
-rw-r--r-- | libgweather/gweather-weather.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c index 1d635eb..21dd299 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; |