Re: Determining preferred localizations
Re: Determining preferred localizations
- Subject: Re: Determining preferred localizations
- From: Gregory Weston <email@hidden>
- Date: Thu, 22 Apr 2010 20:28:01 -0400
On Apr 22, 2010, at 12:45 PM, Stephane Madrau wrote:
> Le 22 avr. 2010 à 18:19, email@hidden a écrit :
>
>> Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code:
>>
>> io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber);
>> CFDictionaryRef theInfo = (CFDictionaryRef)IODisplayCreateInfoDictionary(thePort, 0);
>> CFDictionaryRef theNames = CFDictionaryGetValue(theInfo, CFSTR(kDisplayProductName));
>>
>> theNames will look something like this:
>>
>> "en_US" -> "Color LCD"
>> "en_GB" -> "Colour LCD"
>> "fr_FR" -> "LCD couleur"
>> ....
>
>
> Did you check what Apple themselves do within IODisplayLib.c (IOKitUser / graphics.subproj) ?
> http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.8.1/graphics.subproj/IODisplayLib.c
> Check the function named "GenerateProductName"...
>
> Of course, it's all plain CoreFoundation, but for me it works
> (or I didn't see the problem you are seeing and I missed your point)
Ding!
(Newer members to the list, please take note that this is why sometimes the first answer to your question is "What are you *really* trying to do?")
Passing the constant kIODisplayOnlyPreferredName as the second argument to IODisplayCreateInfoDictionary() obviated my problem of determining the correct localization to use by only actually giving me one (and a good one) back.
Thanks very much, Stephane.
Greg_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden