NSLocalizedString 问题
我有:
-(IBAction)about {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"About", @"Title of AlertView")
message:@"App name \n© My name \n2010"
delegate:self
cancelButtonTitle:NSLocalizedString(@"Back", @"Cancel Button Title")
otherButtonTitles:nil];
[alert show];
[alert release];
}
在 Localized.strings 中:
/* Title of AlertView */
"About" = "Über";
/* Cancel Button Title */
"Back" = "Zurück";
我的问题:当语言是德语时,它是德语,但是当我将语言更改为英语时,警报视图仍然是德语
有什么问题吗?
I've got:
-(IBAction)about {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"About", @"Title of AlertView")
message:@"App name \n© My name \n2010"
delegate:self
cancelButtonTitle:NSLocalizedString(@"Back", @"Cancel Button Title")
otherButtonTitles:nil];
[alert show];
[alert release];
}
And in the Localizable.strings :
/* Title of AlertView */
"About" = "Über";
/* Cancel Button Title */
"Back" = "Zurück";
My problem: When the language is german it's german but when I change the language to english the alert view is still german
What's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你使用 xCode 4 你将会面临这样的问题。尝试后续步骤:
If you use xCode 4 you will face with such problem. Try next steps:
使 Localized.strings 文件可本地化(单击它,按 cmd+i 并按“使文件可本地化”按钮)并向其添加德语和英语本地化。然后将德语本地化写入该文件的德语版本,并保留英语版本,如下所示:
Make the Localizable.strings file localizable (click on it, press cmd+i and push the "Make file localizable" button) and add German and English localizations to it. Then write the German localization to the German version of the file and leave the English version like this: