不管我尝试什么,CFBundleDisplayName的本地化都行不通 [英] Localization of CFBundleDisplayName doesn't work whatever I try

查看:100
本文介绍了不管我尝试什么,CFBundleDisplayName的本地化都行不通的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我一个解决问题的想法. 我有一个名为"MyApp"的应用程序.我想将应用程序名称本地化为德语.我在主项目目录中有一个目录de.lproj.它包含一个文件Localizable.strings,并且工作正常. 我添加了一个InfoPlist.strings文件,并在其中放置了

could someone give me an idea how to find the problem. I have an app named "MyApp". I would like to localize the app name to German. I have a directory de.lproj in the main project directory. It contains a file Localizable.strings and that works fine. I added a InfoPlist.strings file and in there I put:

CFBundleDisplayName ="Applikationsname";

CFBundleDisplayName = "Applikationsname";

但是它不会显示翻译后的名称,而是保留在"MyApp"上.这是我到目前为止尝试过的:

But it wouldn't show the translated name, it stays on "MyApp". Here is what I tried so far:

  • 三重拼写和大写字母
  • 清理所有
  • 从设备和设备中删除应用 模拟器
  • 在模拟器中删除用户目录
  • 更改了MyApp-Info.plist中的英文应用名称-可以.
  • 重读我能找到的任何东西 苹果的文档和大量的谷歌搜索,证实了这一点 应该可以.
  • Triple checked spelling and capitalization
  • clean all
  • delete app from device and in simulator
  • delete user dir in simulator
  • changed the english app name in MyApp-Info.plist - that works.
  • reread whatever I could find in Apples documentation and lots of googling, confirming that it should work.

无论尝试什么,应用程序名称都是MyApp-Info.plist中的名称. 我也将其记录在应用程序委托中:

Whatever I tried, the app name is the one from MyApp-Info.plist. I also log this in the app delegate:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];
NSString *prodName = [info objectForKey:@"CFBundleDisplayName"];
NSLog(@"Product Name:%@",prodName);
NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Current language: %@", currentLanguage);

输出为:

2010-12-08 12:51:00.886 MyApp[25148:207] Product Name:MyApp
2010-12-08 12:51:00.946 MyApp[25148:207] Current Locale: de_DE
2010-12-08 12:51:00.946 MyApp[25148:207] Current language: de

因此语言设置正确,但是应用程序无法读取InfoPlist.strings文件吗? 有什么想法可以从这里继续吗?

So the language setting is correct, but the app won't read the InfoPlist.strings file? Any ideas how to continue from here?

在此先感谢您的答复.

推荐答案

好的,看来终于可以了.我想我以错误的方式创建了InfoPlist.strings: 从资源"选项卡中选择字符串文件,然后将de.lproj指定为目标文件夹.

Ok, it seems to work finally. I guess I created the InfoPlist.strings the wrong way: Choosing strings file from the Resources tab and specifying de.lproj as destination folder.

删除文件并在项目根目录中创建一个新文件后,然后创建可本地化的版本就可以了. 如果有人偶然发现此问题,请注意,您还必须在en.lproj中编辑相应的文件.

After deleting the file and creating a new one in the project root directory, then creating localizable versions did the trick. If anyone stumbles upon this, note that you have to edit the corresponding file in en.lproj as well.

这篇关于不管我尝试什么,CFBundleDisplayName的本地化都行不通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆