On Jul 23, 2010, at 10:24 AM, Matt Neuburg wrote: > On Thu, 22 Jul 2010 11:19:32 +0200, Giacomo Tufano <g...@iltofa.it> said: >> Il giorno 22/lug/2010, alle ore 11.15, cocoa learner ha scritto: >> >>> I have localized my app in English and French languages. >>> But I want to load French strings being in English language based on radio >>> button input (English and French). >>> >>> Is it possible? >>> Is there any cocoa way of doing this? >> >> I tried the same (and asked this very list some months ago) but had no luck. >> I > resorted writing some code to load the "right" localization (and not using > NSLocalizedString() and friends). But I'm still interested in knowing if a > "blessed" way to do that exists. My problem was on iPhoneOS but AFAIK there > should be no differences with OS X in localization support.
You can fairly easily obtain any particular resource or set of resources from a given localization, using -pathForResource:ofType:inDirectory:forLocalization: et al. Obtaining strings from .strings files is a matter of a few lines of code--locate the file using -pathForResource:ofType:inDirectory:forLocalization:, load it using any of the standard property-list methods (e.g. dictionaryWithContentsOfFile: or propertyListFromData:mutabilityOption:format:errorDescription:) and look up the key in the resulting dictionary (the .strings file format is a variant property list format and readable by the property list APIs). Douglas Davidson _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com