Re: How to make localizedStringForKey: work in a Foundation Tool?
Re: How to make localizedStringForKey: work in a Foundation Tool?
- Subject: Re: How to make localizedStringForKey: work in a Foundation Tool?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 15 Aug 2005 14:04:21 -0700
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:
This email sent to email@hidden