[Linux] Implement platform_get_locale_measurement_format and platform_get_locale_temperature_format

This commit is contained in:
Kevin 2015-11-20 17:29:36 +01:00
parent d43bc73e76
commit 3ece04dc8d
1 changed files with 10 additions and 30 deletions

View File

@ -739,44 +739,24 @@ uint8 platform_get_locale_currency(){
} }
uint8 platform_get_locale_measurement_format(){ uint8 platform_get_locale_measurement_format(){
/* //FIXME: LC_MEASUREMENT is GNU specific.
UINT measurement_system; const char *langstring = setlocale(LC_MEASUREMENT, "");
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IMEASURE | LOCALE_RETURN_NUMBER, //using https://en.wikipedia.org/wiki/Metrication#Chronology_and_status_of_conversion_by_country as reference
(LPSTR)&measurement_system, if(!fnmatch("*_US*", langstring, 0) || !fnmatch("*_MM*", langstring, 0) || !fnmatch("*_LR*", langstring, 0)){
sizeof(measurement_system)) == 0){
return MEASUREMENT_FORMAT_IMPERIAL; return MEASUREMENT_FORMAT_IMPERIAL;
} }
switch (measurement_system){
case 0:
return MEASUREMENT_FORMAT_METRIC;
case 1:
default:
return MEASUREMENT_FORMAT_IMPERIAL;
}*/
STUB();
return MEASUREMENT_FORMAT_METRIC; return MEASUREMENT_FORMAT_METRIC;
} }
uint8 platform_get_locale_temperature_format(){ uint8 platform_get_locale_temperature_format(){
/* const char *langstring = setlocale(LC_MEASUREMENT, "");
// There does not seem to be a function to obtain this, just check the countries
UINT country; if(!fnmatch("*_US*", langstring, 0) || !fnmatch("*_BS*", langstring, 0) || !fnmatch("*_BZ*", langstring, 0) || !fnmatch("*_PW*", langstring, 0)){
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_IMEASURE | LOCALE_RETURN_NUMBER,
(LPSTR)&country,
sizeof(country)) == 0){
return TEMPERATURE_FORMAT_C;
}
switch (country){
case CTRY_UNITED_STATES:
case CTRY_BELIZE:
return TEMPERATURE_FORMAT_F; return TEMPERATURE_FORMAT_F;
default:
return TEMPERATURE_FORMAT_C;
} }
*/
STUB();
return TEMPERATURE_FORMAT_C; return TEMPERATURE_FORMAT_C;
} }