Reputation: 1211
Going through number of examples regarding to NSLocalizedString, what I found was we need to pre-define all the string in Localized.string file for what-ever language you want to localize. But, is it possible to localize dynamic string. My idea was, I am displaying few text in UILabel that i get after web request. It means the string is now dynamic in nature.
Upvotes: 0
Views: 637
Reputation: 3018
Declare in Localizable.strings
"SAMPLE_LOCALIZE_STRING" = "This is sample dynamic localize string for %@.";
Use it like this
NSString *dynamicStr = @"Test";
label.Text = [NSString stringWithFormat:NSLocalizedString(@"SAMPLE_LOCALIZE_STRING", nil), dynamicStr];
Upvotes: 2
Reputation: 1542
[NSString stringWithFormat:NSLocalizedString(@"Table View Cell Row %d", @""), indexpath.row];
Upvotes: 1
Reputation: 15115
I have handled this situation as follows,
Include language in the request. For ex: http://yourIp/language/notesandcondition
The webservice should be designed to handle for different languages.
Upvotes: 1
Reputation: 1120
If those strings are fixed ones (I mean a limited number of options) then pre-store them in the localized string file.
If not, I would suggest to add a parameter to your request that would indicate the language and then the server would return string in that language.
Upvotes: 1