Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the format of InfoPlist.strings?



Le mercredi 24 juillet 2002, ` 10:22 PM, Douglas Davidson a icrit :


On Wednesday, July 24, 2002, at 01:01 PM, email@hidden wrote:

It's definitely not a plist format.

CFBundleName = "something";

is not a usual NSDictionary entry.

How can we get the string associated to the key CFBundleName without having to rewrite a complete parser?

It uses the strings-file format, which is a stripped-down version of the old plist format. Fortunately, the XML plist parser will also recognize strings-file format and the old plist format, so you don't need to do anything special. Conversely, .strings files such as InfoPlist.strings can use the XML plist format, although the strings-file format is usually more convenient.

Even more conveniently, you don't have to read InfoPlist.strings at all, because CFBundle and/or NSBundle will do it for you. If you're using CFBundle, the recommended approach is to use CFBundleGetValueForInfoDictionaryKey(). This will get a localized value from InfoPlist.strings, if there is one, or a non-localized value if not. If for some reason you must distinguish between localized and non-localized values, you can use CFBundleGetInfoDictionary() and CFBundleGetLocalInfoDictionary(). The corresponding NSBundle methods are objectForInfoDictionaryKey:, infoDictionary, and localizedInfoDictionary.

I would bet $.02 that localizedInfoDictionary and objectForInfoDictionaryKey are only available in 10.2.

So it means that a Dictionary key in the old plist format can be outside a "" block? That was that which was confusing me.

Thanks for the info. Using the NSBundle method on the .strings file is working fine.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: What's the format of InfoPlist.strings? (From: Douglas Davidson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.