Kaydet (Commit) 07b35e16 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Use the AppleLanguages preference instead of AppleLocale on OS X and iOS

AppleLocale is for things like date formats, it seems, while the first
entry in AppleLanguages contains the user's preferred UI language. I
think that is closer to what we want here.

Note that in AppleLanguages, the country (where present) is separated
from the language with a hyphen, while in AppleLocale an underscore is
used.

Change-Id: I6d8a728d53ca6b46e8fcf0e333a6d0aa34abff1d
üst 3184f539
......@@ -48,7 +48,7 @@ namespace
*/
CFStringRef getProcessLocale()
{
CFPropertyListRef pref = CFPreferencesCopyAppValue(CFSTR("AppleLocale"), kCFPreferencesCurrentApplication);
CFPropertyListRef pref = CFPreferencesCopyAppValue(CFSTR("AppleLanguages"), kCFPreferencesCurrentApplication);
CFPropertyListGuard proplGuard(pref);
if (pref == NULL) // return fallback value 'en_US'
......@@ -72,7 +72,7 @@ int macosx_getLocale(char *locale, sal_uInt32 bufferLen)
// split the string into substrings; the first two (if there are two) substrings
// are language and country
CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(NULL, sref, CFSTR("_"));
CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(NULL, sref, CFSTR("-"));
CFArrayGuard arrGuard(subs);
CFStringRef lang = (CFStringRef)CFArrayGetValueAtIndex(subs, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment