NSLocalizedString只检索键,而不是Localizable.strings(IOS)中的值 [英] NSLocalizedString only retrieves the key, not the value in Localizable.strings (IOS)
问题描述
我创建了一个名为Localizable.strings的字符串文件,并添加了两种语言,如下所示:
I've made a strings file named "Localizable.strings" and added two languages to it, like so:
"CONNECTIONERROR" = "Check that you have a working internet connection.";
"CONNECTIONERRORTITLE" = "Network error";
我还将文件转换为Unicode UTF-8
但是,当我创建一个UIAlertView是这样的:
I have also converted the files to Unicode UTF-8 However, when I create a UIAlertView like this:
UIAlertView *myAlert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"CONNECTIONERRORITLE",nil)
message:NSLocalizedString(@"CONNECTIONERROR",nil)
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
警报视图仅显示关键文本,而不显示值。例如,如果我将UITextviews文本设置为NSLocalizedString(@CONNECTIONERROR,nil),则它可以工作,但警报视图仅显示密钥。任何人都知道什么是错的?
the alert view only shows the key text, not the value. It works if I, for example, set a UITextviews text to NSLocalizedString(@"CONNECTIONERROR",nil), but the alert view only displays the key. Anyone know what's wrong?
推荐答案
在实际设备上测试应用程序它是否有效
Tested the app on an actual device and it worked
这篇关于NSLocalizedString只检索键,而不是Localizable.strings(IOS)中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!