• 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: Wishing: NSLocalizedStringArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wishing: NSLocalizedStringArray


  • Subject: Re: Wishing: NSLocalizedStringArray
  • From: mmalcolm crawford <email@hidden>
  • Date: Sat, 21 Feb 2004 19:29:55 -0800

On Feb 21, 2004, at 6:50 PM, Jerry Krinock wrote:

It would save me a lot of typing if we had a method like this, which I just
dreamed up:
NSLocalizedStringArray
Returns a localized version of an array of strings.
NSArray *NSLocalizedStringArray(NSString *key, NSString *comment)
Did I miss this one somewhere?

No.
Your suggestion seems, though, somewhat opaque, and error-prone?

It's not clear how the array would be specified in the .strings file? Moreover, what happens if the strings files get out of sync? And further, in your application after you've retrieved the array:

NSArray *locArray = NSLocalizedStringArray(key, comment);

you still have to use

NSLog(@"%@", [locArray objectAtIndex:n]); // displays suitable message
// also add comment to specify n....

instead of:

NSLog(@"%@", NSLocalizedString(@"Suitable Message", @"Comment that will be put into the .strings file by the genstrings command");


So (the absurd comment notwithstanding) you've written [locArray objectAtIndex:n] instead of NSLocalizedString(@"Suitable Message", @"Comment"), saving a few characters at the expense of significant reduction in clarity, robustness, and maintainability. Given that Xcode will auto-complete NSLocalizedString fairly rapidly, this seems like a poor trade-off.

mmalc
_______________________________________________
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: Wishing: NSLocalizedStringArray
      • From: mmalcolm crawford <email@hidden>
References: 
 >Wishing: NSLocalizedStringArray (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Wishing: NSLocalizedStringArray
  • Next by Date: Re: Wishing: NSLocalizedStringArray
  • Previous by thread: Wishing: NSLocalizedStringArray
  • Next by thread: Re: Wishing: NSLocalizedStringArray
  • Index(es):
    • Date
    • Thread