Reputation: 15
I'm trying to programmatically localize my project, since base internationalization isn't automatically picking up my menu items on my storyboard. I'd like to localize the strings in an array. The specific problem I'm having is this code:
- (void)viewDidLoad
{
_menuItems = @[@"title",
@"item1",
@"item2",
@"item3",
@"item4",
];
}
I've tried declaring
[NSString stringWithFormat:NSLocalizedString(@"title")];
for each one, but that does't compile so I'm sure that's not right. I'd be grateful for anyone's help to point me in the right direction.
Upvotes: 0
Views: 490
Reputation: 1724
- (void)viewDidLoad {
_menuItems = @[ NSLocalizedString(@"title1", @"the title"),
NSLocalizedString(@"item1", @"the first item"),
NSLocalizedString(@"item2", @"the second item"),
NSLocalizedString(@"item3", @"the third item"),
NSLocalizedString(@"item4", @"the fourth item")
];
}
Upvotes: 2