I am working on localizing my app and adding NSLocalizedString()
all over my code where the string will be shown on the screen. The question is i have a UIPickerview
that shows 12 items and i would like to localize it and not add different language strings in core data.
This is what i have now that returns the titles. How can i localize it?
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [self.items objectAtIndex:row];
}
Is this going to work?
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
NSString *localizedTitle = [NSString stringWithFormat:NSLocalizedString(@"%@", @"Item Name"),[self.items objectAtIndex:row]];
return localizedTitle;
}
I should just have a list of all the items in the Localizable.strings file?
Thanks in advance!