If what you want is to return the localized version of “This is an Apple/Orange/whatever”, you’d want:
NSString *localizedVersion = NSLocalizedString(([NSString stringWithFormat:@"This is an %@", @"Apple"]), nil);
(I.e., the nesting of NSLocalizedString()
and [NSString stringWithFormat:]
are reversed.)
If what you want is the format to be localized, but not the substituted-in value, do this:
NSString *finalString = [NSString stringWithFormat:NSLocalizedString(@"SomeFormat", nil), @"Apple"];
And in your Localizable.strings
:
SomeFormat = "This is an %@";