Re: Wishing: NSLocalizedStringArray
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.