Re: International strings
Re: International strings
- Subject: Re: International strings
- From: "David P. Henderson" <email@hidden>
- Date: Fri, 3 Aug 2001 15:47:05 -0400
On Friday, August 3, 2001, at 01:20 , Andreas Monitzer wrote:
>
On Friday, August 3, 2001, at 06:55 , Christian Mike wrote:
>
>
> I see that I can create files like myStrings.string and place them in
>
> the
>
> <language>.lprog folder and then look them up using some flavor of
>
> NSBundle
>
> localizedStringForKey:value:table:.
>
>
It's easier to put them into a file called "Localizable.strings" and
>
use the following:
>
>
#define loc(x) [[NSBundle bundleForClass:[self class]]
>
localizedStringForKey:x value:nil table:nil]
>
>
now you can use something like loc(@"Cancel") to get the right string
>
back.
>
Or you could just use the NSLocalizedString* macros which are already
defined. The simplest is NSLocalizedString(key, comment), you pass a key
and a comment describing the purpose of the key to help those localizing
your application or other bundle. Once, you have decided on a method for
providing localizing, using the pre-defined macros or rolling your own,
and localized your bundle strings; then, you can use the command line
utility genstrings to auto-generate your *.strings files. Type
'genstrings' at the shell prompt for usage and options.
>
> Now I see that in the default InfoPlist.strings file, there are nice
>
> symbolic names for the keys, but I can't find where those nice names
>
> get
>
> defined. How can I set up symbolic names like that so that I don't
>
> have to
>
> use long key names?
>
>
You don't have to define them. Just use the same in your source and
>
Localizable.strings.
>
The keys in the InfoPlist.strings file replace values an application's
or bundle's Info.plist see the Release Notes on Info Property Lists for
info on the keys and their usage. You can access the Info.plist settings
for your application under the 'Application Settings' tab of the
'Target' tab in Project Builder.
If you do use symbolic keys instead of fully qualified strings, be sure
to use a localizing marco which provides a comment for each key which
will make the work of your localizers easier.
Dave
--
Chaos Assembly Werks
"The proper office of a friend is to side with you when you are in the
wrong. Nearly anybody will side with you when you are in the right."
- Mark Twain