• 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: Getting an NSLocalizedString for another localization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting an NSLocalizedString for another localization


  • Subject: Re: Getting an NSLocalizedString for another localization
  • From: Douglas Davidson <email@hidden>
  • Date: Tue, 4 Oct 2005 09:40:47 -0700


On Oct 4, 2005, at 2:52 AM, Damien Trog wrote:

I have an application which, amongst other things, lets the user print exams. It is localized in multiple languages. Also it is possible that the user wants an exam printed in another language than the one which is set in his internationalization settings in the preferences.

For example, the user can be using the application in Dutch, but wanting to print an exam in English, or vice versa. (The static text would be different then.)

Is it possible to use localized strings for this? I would need something like NSLocalizedString(@"Question",@"Dutch",@"");

So is it possible to specify which localization you want for a localized string?


You can do this, but you will have to do a little more work.

Get the bundle you are interested in--probably the main bundle, if it's your application we're talking about. You can call [someBundle localizations] if you need to get a list of the localizations available. For the localization of interest, call

[someBundle pathForResource:<table name> ofType:@"strings" inDirectory:nil forLocalization:localization]

to get the path to the strings file (the table name for the default table is @"Localizable"). Parse the contents of that file as a property list. The result should be a dictionary with keys that are the localized string keys and values that are the localized strings. Get the value for the key you are interested in; that's the localization for that key in the given localization.

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


  • Follow-Ups:
    • Re: Getting an NSLocalizedString for another localization
      • From: Damien Trog <email@hidden>
References: 
 >Getting an NSLocalizedString for another localization (From: Damien Trog <email@hidden>)

  • Prev by Date: Adding an image to a NIB file
  • Next by Date: Excel style spreadsheet read from xml
  • Previous by thread: Getting an NSLocalizedString for another localization
  • Next by thread: Re: Getting an NSLocalizedString for another localization
  • Index(es):
    • Date
    • Thread