• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: International strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: International strings


  • Subject: Re: International strings
  • From: Andreas Monitzer <email@hidden>
  • Date: Fri, 3 Aug 2001 19:20:26 +0200

On Friday, August 3, 2001, at 06:55 , Christian Mike wrote:

I sure wish that this list had a searchable archive. That way I wouldn't
have to clutter it with this noise. :-)

Anyway, in my application, I have some string in English or Spanish. I want
to be a good citizen if possible and use the internationalization facilities
that are available, but as in many things, the documentation is a little
scarce.

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.

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.

Also, from time-to-time, even though my current language is set to English,
I might want to pull one of the Spanish strings out of its file. How can I
fake the system out so that it pulls the string out of another language's
resources?

Just open SystemPreferences -> International and reorder it. The changes are instantly in effect, you only have to restart any app that should reload that information (that's why you have to log out and in again for changing the Finder's language).

andy
--
"He was addicted to life. But we cured him"


  • Follow-Ups:
    • Re: International strings
      • From: "David P. Henderson" <email@hidden>
    • Re: International strings
      • From: email@hidden
    • Re: International strings
      • From: Finlay Dobbie <email@hidden>
  • Prev by Date: Re: Need Help with Help
  • Next by Date: Re: [HELP] beginCriticalAlertSheet NSSelector implementation in Cocoa (Java/ObjC)?
  • Previous by thread: International strings
  • Next by thread: Re: International strings
  • Index(es):
    • Date
    • Thread