6

I am trying to decide if the users Region/Locale settings validates the use of Metric values (in this case if kg or lb should be appended).

I am running 3.2 on my iPad and on the simulator(Xcode 3.2.4). I have tried out a few different Region settings but I simply can not make it return NO for NSLocaleUsesMetricSystem

NSLocale *locale = [NSLocale systemLocale]; 
BOOL usesMetric = [[locale objectForKey:NSLocaleUsesMetricSystem] boolValue];

NSLog(@"The system is Metric: %@\n", (usesMetric ? @"YES" : @"NO"));

This even happens for language set to English and region set to United States on both the simulator and on the actual device.

I also tried NSLocaleMeasurementSystem and it too always returns "Metric", never "U.S.".

How will I go about deciding if I should use Metric or not?

Thanks for any help given:)

...could I be so lucky that the whole world changed to metric while I was sleeping:)

Ruben Marin
  • 1,639
  • 14
  • 24
RickiG
  • 11,380
  • 13
  • 81
  • 120

2 Answers2

12

Try currentLocale instead of systemLocale

Stefan
  • 1,496
  • 1
  • 13
  • 26
  • Thanks Stefan. Because the question is almost a year old I found a workaround a long time ago, but never a cause. Can anyone confirm this is correct so I can accept the answer:) – RickiG Jul 19 '11 at 17:43
  • systemLocale contains the default values in the absence of another value, i.e. the values in currentLocale. currentLocale is what you want to use. – ljkyser Aug 04 '11 at 21:37
2

Had the same problem, until I realized, that UK officially uses metric system. I have always thought that they still use imperial, so I tested with UK.

As soon as I started to test US locale, NSLocaleUsesMetricSystem started to return "NO" as expected.

Hope this helps.

Vilém Kurz
  • 3,401
  • 2
  • 34
  • 43