Xcode 找不到本地化的 info.plist
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18052468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode cannot locate localized info.plist
提问by ohho
After adding a few Localizations:
添加一些本地化后:
and localized the (AppName)-info.plist
file:
并本地化(AppName)-info.plist
文件:
and checked Bundle Resources (also tried to remove Go-info.plist from the Copy Resources Bundle
list:
并检查了捆绑资源(还尝试从Copy Resources Bundle
列表中删除 Go-info.plist :
and the file property:
和文件属性:
Xcode (4.6.3) give an error:
Xcode (4.6.3) 报错:
error: could not read data from '.../Go/Go/Go-Info.plist': The file “Go-Info.plist” couldn't be opened because there is no such file.
错误:无法从“.../Go/Go/Go-Info.plist”读取数据:无法打开文件“Go-Info.plist”,因为没有这样的文件。
It looks like Xcode ignores the localization folder in the path. It tried to find the info.plist as:
看起来 Xcode 忽略了路径中的本地化文件夹。它试图找到 info.plist 为:
.../Go/Go/Go-Info.plist
instead of:
代替:
.../Go/Go/(Localization)/Go-Info.plist
How can I fix it?
我该如何解决?
回答by Toploulou
I think Info.plistcan not be localized. If you want to localize your application Name, you should localize the InfoPlist.stringsfile and use those keys :
我认为Info.plist不能本地化。如果您想本地化您的应用程序名称,您应该本地化InfoPlist.strings文件并使用这些键:
"CFBundleDisplayName" = "AppName";
"CFBundleName" = "AppName";
回答by Costas Bakoulias
Step by step localized Info.plist:
逐步本地化的 Info.plist:
- Find in the x-code the folder Resources (is placed in root)
- Select the folder Resources
- Then press the main menu File->New->File...
- Select in section "Resource" Strings File and press Next
- Then in Save As field write InfoPlist ONLY ("I" capital and "P" capital)
- Then press Create
- Then select the file InfoPlist.strings that created in Resources folder and press in the right menu the button "Localize"
- Then you Select the Project from the Project Navigator and select the The project from project list
- In the info tab at the bottom you can as many as language you want (There is in section Localizations)
- The language you can see in Resources Folder
- To localize the values ("key") from info.plist file you can open with a text editor and get all the keys you want to localize
- You write any key as the example in any InfoPlist.strings like the above example
- 在 x-code 中找到文件夹 Resources(放在 root 中)
- 选择文件夹资源
- 然后按主菜单 File->New->File...
- 在“资源”字符串文件部分中选择,然后按下一步
- 然后在“另存为”字段中仅写入 InfoPlist(“I”大写和“P”大写)
- 然后按创建
- 然后选择在 Resources 文件夹中创建的文件 InfoPlist.strings 并在右侧菜单中按“Localize”按钮
- 然后从项目导航器中选择项目并从项目列表中选择项目
- 在底部的信息选项卡中,您可以使用任意数量的语言(在本地化部分中有)
- 您可以在资源文件夹中看到的语言
- 要本地化 info.plist 文件中的值(“键”),您可以使用文本编辑器打开并获取要本地化的所有键
- 您可以在任何 InfoPlist.strings 中编写任何键作为示例,如上例
"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";
"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";
"NSLocationAlwaysUsageDescription"="blabla2";
"NSLocationAlwaysUsageDescription"="blabla2";
That's all work and you have localize your info.plist file!
这就是全部工作,您已经本地化了 info.plist 文件!