kernel32: Allow the prefered language to be different from the prefered locale on Mac OS X by correctly setting LC_MESSAGES.

Pierre d'Herbemont pdherbemont at
Mon Dec 11 17:49:00 CST 2006

On 12 déc. 06, at 00:20, Pierre d'Herbemont wrote:

>>> +    }
>>> +    closedir(dir);
>> I think the above code to scan /usr/share/locale is unnecessary.   
>> Doesn't CFLocaleCopyAvailableLocaleIdentifiers provide the  
>> equivalent?
> You're quite right. I though setlocale didn't handle 'en' properly  
> expecting full 'en_US' or 'en_GB', I can't understand why now.  
> Probably didn't have enough sleep last night.

I do remember now :) setlocale don't handle properly two letters  
language code like 'es' it expect a full locale name like 'es_ES' .  
And using the CFLocale API to obtain the full local from 'es' does  
not seem possible.

And even with CFLocaleCopyAvailableLocaleIdentifiers() the returned  
array will contain 'es' among 'es_ES' and 'en_GB' so, when  
intersecting with the preferred languages [1] threw  
CFBundleCopyLocalizationsForPreferences() 'es' will be returned.  
setlocale(LC_MESSAGES, NULL) will return "C", and thus fallback the  
standard english language (LC_CTYPE is not set on Mac OS X), whereas  
setlocale should have returned es.

The fix for this is to provide to setlocale a full locale name like  
'es_ES', that's why I did it that way.

Do you see any better way to do this rather than probably filling a  
bug report to Apple?

[1] #defaults read -g AppleLanguages
	( es, fr, en, de, ja, it, nl, sv, nb, da, fi, pt, "zh-Hans", "zh- 
Hant", ko)


PS: I'll resend the patch with your fixes.

More information about the wine-devel mailing list