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: How to make localizedStringForKey: work in a Foundation Tool?




On Aug 11, 2005, at 12:55 AM, Uli Zappe wrote:

In other words, [bundle localizedStringForKey:<string>] first and foremost does *not* consider the languages available in bundle, but rather those of its own process. God knows if this is a bug or a feature. :-/


This is a feature. You are using the default localization mechanism, which is intended to give good default behavior. This particular behavior is intended to prevent applications from presenting a mixture of different localizations from different bundles. To turn this off, add the key CFBundleAllowMixedLocalizations to your Info.plist, with the value "YES".


To add an Info.plist to an unbundled Mach-o executable such as a Foundation-level tool, place the Info.plist contents in an __info_plist section in the __TEXT segment. The linker options to do this would look something like "-sectcreate __TEXT __info_plist Info.plist".

Alternatively, it is also possible to use NSBundle methods to load resources in an arbitrary localization, and there is a mechanism (preferredLocalizationsFromArray:forPreferences:) to allow you to select the user's most preferred localization for any given bundle, without considering the localizations available in the main bundle. Strings files can be parsed using standard plist methods.

Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >How to make localizedStringForKey: work in a Foundation Tool? (From: Uli Zappe <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.