Reputation: 27191
I want to implement localization in Xcode 6 and seems everything works good.
After I pressed localize button in storyboard Xcode has crated two different files for each languages I use.
This is localization file:
/* Class = "IBUIButton"; normalTitle = "More\nApps"; ObjectID = "F2X-dg-Vvg"; */
"F2X-dg-Vvg.normalTitle" = "More\nApps";
/* Class = "IBUIButton"; normalTitle = "Parents"; ObjectID = "kwk-af-Aei"; */
"kwk-af-Aei.normalTitle" = "Parents";
/* Class = "IBUIButton"; normalTitle = "Unlock all puzzles"; ObjectID = "tFb-hm-HC6"; */
"tFb-hm-HC6.normalTitle" = "Unlock all";
My question is how I can use this code below to get localized string:
NSString *str = NSLocalizedString(@"kwk-af-Aei", nil);
Right now it return kwk-af-Aei string but I expect to get Parents.
Does it mean that I should duplicate localized strings for storyboard and for write my code? I mean use different files?
Upvotes: 0
Views: 286
Reputation: 2459
NSLocalizedString
is for the file Localizable.strings
. You need to use NSLocalizedStringFromTable
with a specific table like this.
// Main.strings is localized table for Main.storyboard.
NSString *str = NSLocalizedStringFromTable(@"SEt-7V-WkD.text", @"Main", @"");
Upvotes: 0