xcode/iphone 中的字符串和语言
您好,我的字符串有问题,我已经检查了这个链接< /a> 并执行了那里告诉的操作,但它不起作用
所以对于 xib 文件,我为每种语言都有不同的版本并且它可以工作。但我还有一个名为 Localization.strings 的文件,该文件目前只包含一个字符串:
“password”=“passwords are not the same”;
然后在我的代码中,我尝试访问本地化字符串:
NSString *tp=[[NSString alloc] initWithString:NSLocalizedString(@"password", nil)];
因此 tp 应该具有字符串“密码不相同”,但它不会返回“密码”。我一直想知道这是否是编写字符串的正确方法,也许您必须将值本身写在左侧???无论如何,我有两个版本的西班牙语和英语,并且在这两个版本中都发生了同样的事情。我已经从 iPhone 上删除了应用程序,清理干净,更改语言并重新安装,但没有任何效果。
谢谢
Hi I have a problem with my strings and I have already checked this link and did what was told there but it doesn't work
So for the xib files I have a diferent version for each language and it works. but I have also a file named Localization.strings which for now only contains one string:
"password" = "passwords are not the same";
Then in my code I try to access the localized string:
NSString *tp=[[NSString alloc] initWithString:NSLocalizedString(@"password", nil)];
so tp is supposed to have the string "passwords are not the same" but no it returns "password". I have been wondering if it is the right way to write strings maybe you have to write the value itself on the left side??? Anyway I have two versions spanish and english and in both the same thing happens. I have deleted app from the iphone cleaned, changed language and reinstalled and nothing works.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是您的字符串文件的命名。
NSLocalizedString()
进行查找的默认文件是Localized.strings
。因此,将
Localization.strings
重命名为Localizes.string
。如果您愿意,也可以使用特定文件进行查找(例如,如果您将本地化字符串拆分为多个字符串文件)。使用:You problem is the naming of your strings-file. The default file that
NSLocalizedString()
do it's lookup in isLocalizable.strings
.So rename
Localization.strings
toLocalizable.string
. You could also use a specific file for your lookup if you want too (if you for example split your localized strings into several strings-files). Using: