Skip navigation.
 
mlInternationalization: How to bring the locale in line with the language?
FROM : Uli Zappe
DATE : Wed Nov 03 10:44:28 2004

Hi,

I'm encountering what I think must be a very common problem with 
internationalization, but I can't find anything about it in the 
archives.

In 
http://developer.apple.com/documentation/CoreFoundation/Conceptual/
CFLocales/Articles/CFLocaleConcepts.html, it says:

"In Mac OS X the locale preference need not be the same as the language 
preference—they are set independently. Users choose their locale in 
System Preferences > International, using the Region pop-up menu in the 
Formats pane."

At first, this seems to make sense and provide greater freedom for 
users.

However, it has one serious drawback. For instance, being a German, I 
have set both my language and my locale preferences to German. This 
works fine if the app I use is indeed localized in German.

But if it is not, the GUI will most certainly be in English (which is 
my second language preference). However, the *locale* is still German. 
This means that e.g. localized decimal numbers are still displayed as 
1.000,00 (= one thousand) and not 1,000.00. But of course, if the 
surrounding text is in English, I will interpret the numbers in English 
fashion, too - i.e. I will think that 1.000 is precisely *one*, and not 
*one thousand*. This can be a serious problem.


Since I write an app that displays a lot of numbers I wanted to get rid 
of that problem by bringing the locale in line with the language used. 
However, I can't find a way to do that.

I tried [userDefaults setObject:@"en" forKey:@"AppleLocale"] in the 
+initialize class method of my app delegate which as far as I know is 
about the earliest moment you can do something when your app is 
launching, but apart from the ugly side-effect of having this value 
written to the preferences plist file, even at this time it's obviously 
too late: all the formatter objects in IB still use the German locale. 
Only after a restart of the app (which now reads the respective entry 
in the preferences plist) the setting takes effect.

So is there no way to bring the locale in line with the language in 
time?

I'm really baffled cause I think that this is such an obvious problem 
for internationalization, but I can't find anything about it.

Any ideas?

Thanks in advance for your replies!


           Bye
                   Uli
________________________________________________________

  Uli Zappe, Solmsstraße 5, D-65189 Wiesbaden, Germany
  http://www.ritual.org
  Fon: +49-700-ULIZAPPE
  Fax: +49-700-ZAPPEFAX
________________________________________________________