From 5d03fc3fb6c14dfcc042e7e1f58e7be962d293ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Mon, 14 Dec 2015 22:01:02 +0100 Subject: [PATCH] osx: fix locale issues --- src/platform/posix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/posix.c b/src/platform/posix.c index e276911307..18eeef0851 100644 --- a/src/platform/posix.c +++ b/src/platform/posix.c @@ -700,8 +700,12 @@ uint8 platform_get_locale_currency(){ } uint8 platform_get_locale_measurement_format(){ - //FIXME: LC_MEASUREMENT is GNU specific. + // LC_MEASUREMENT is GNU specific. + #ifdef LC_MEASUREMENT const char *langstring = setlocale(LC_MEASUREMENT, ""); + #else + const char *langstring = setlocale(LC_ALL, ""); + #endif if(langstring != NULL){ //using https://en.wikipedia.org/wiki/Metrication#Chronology_and_status_of_conversion_by_country as reference @@ -713,7 +717,12 @@ uint8 platform_get_locale_measurement_format(){ } uint8 platform_get_locale_temperature_format(){ + // LC_MEASUREMENT is GNU specific. + #ifdef LC_MEASUREMENT const char *langstring = setlocale(LC_MEASUREMENT, ""); + #else + const char *langstring = setlocale(LC_ALL, ""); + #endif if(langstring != NULL){ if(!fnmatch("*_US*", langstring, 0) || !fnmatch("*_BS*", langstring, 0) || !fnmatch("*_BZ*", langstring, 0) || !fnmatch("*_PW*", langstring, 0)){