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 free.fr
Mon Dec 11 17:20:03 CST 2006
On 11 déc. 06, at 22:42, Ken Thomases wrote:
> On Dec 11, 2006, at 1:46 PM, Pierre d'Herbemont wrote:
>> + /* This filters the 'right' locales (xx_xx.UTF-8) */
>> + if (strstr(file->d_name, ".UTF-8"))
>> + CFArrayAppendValue(available_locales, (void*)
>> CFStringCreateWithCString(kCFAllocatorDefault,
>> + file-
>> >d_name, kCFStringEncodingUTF8));
>
> The above should use CFStringCreateWithFileSystemRepresentation
> instead of CFStringCreateWithCString. Also, you need to CFRelease
> the created string after adding it to the array. (The array
> manages its references, but that doesn't relieve you of the
> responsibility to manage your own.)
My bad.
>> + }
>> + 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.
>> + prefered_languages = CFPreferencesCopyValue( CFSTR
>> ("AppleLanguages"), kCFPreferencesAnyApplication,
>> +
>> kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
>> + if(prefered_languages)
>> + {
>> + CFArrayRef intersected_locales =
>> CFBundleCopyLocalizationsForPreferences(available_locales,
>> prefered_languages);
>
> Do you need prefered_languages? The docs say that if you pass NULL
> for the second parameter of
> CFBundleCopyLocalizationsForPreferences, it uses the user's
> preferences. That would avoid you having to look them up, above.
My bad.
> Also, "preferred" is spelled with three R's.
My bad too.
A lot of mistakes here... Thanks for pointing them so fast,
Pierre.
More information about the wine-devel
mailing list