我必须打印一个本地化的字符串,并传递一个参数。
我用:
NSString *myMsg = [[NSString alloc]
stringByAppendingFormat:NSLocalizedString(@"MyKey", @""), aString];
[MyViewController updateMyMessage:myMsg];
[myMsg release];
在 Localizable.strings 中,我使用:"MyKey" = "My message says: %@";
编辑:
它可以工作,使用以下代码:
NSString *myMsg = [NSString stringWithFormat:NSLocalizedString(@"MyKey", @""), aString];
[MyViewController updateMyMessage:myMsg];
但是,我想知道以前的代码有什么问题。