• 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: localized strings from another bundle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: localized strings from another bundle?


  • Subject: Re: localized strings from another bundle?
  • From: Vince DeMarco <email@hidden>
  • Date: Wed, 22 Jan 2003 22:51:39 -0800

Use the macros

NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment)

so do this

NSLocalizedStringFromTableInBundle(@"My Key",@"Foo",bundle,"Some comment here")

if bundle == [NSBundle mainBundle]
then use

NSLocalizedStringFromTable(@"My Key",@"Foo","Some comment here")

in the above it will look for the file Foo.strings in the bundle that gets passed in or the main bundle

if you want to look in a file called Localizable.strings then use this macro

NSLocalizedString(@"My Key","Some comment here")

the .strings file should look like this

"My Key" = "Somethiing to display to the user";

and the file should be in utf16 encoding

vince



On Wednesday, January 22, 2003, at 09:46 PM, Alex Rice wrote:

I have a Foundation tool that's running from My.app/Contents/Resources. In the tool I am trying

// in .../My.app/Contents/Resources
NSString *path = [[[[NSBundle mainBundle] bundlePath]
stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
// now path = .../My.app
NSBundle *bundle = [NSBundle bundleWithPath: path];
NSLog([bundle localizedStringForKey: @"verify localized strings" value: nil table: nil]);

I was expecting this code to deal with Localizable.strings correctly, but it does not. The localization is setup correctly because My.app is OK with
NSLocalizedString(@"verify localized strings", nil);

Any ideas? Thanks,

Alex Rice <email@hidden> | Mindlube Software | http://mindlube.com

what a waste of thumbs that are opposable
to make machines that are disposable -Ani DiFranco
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: localized strings from another bundle?
      • From: Bill Cheeseman <email@hidden>
    • Re: localized strings from another bundle?
      • From: Alex Rice <email@hidden>
References: 
 >localized strings from another bundle? (From: Alex Rice <email@hidden>)

  • Prev by Date: Re: Cocoa Code Repository
  • Next by Date: Re: Thread Safety and Cocoa
  • Previous by thread: localized strings from another bundle?
  • Next by thread: Re: localized strings from another bundle?
  • Index(es):
    • Date
    • Thread