xcode 本地化 Info.plist 后构建错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30978237/
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
Build error after I localized Info.plist
提问by Cherif
I localized Info.plist :
我本地化 Info.plist :
And I got this build error :
我得到了这个构建错误:
error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist':
The file “Info.plist” couldn't be opened because there is no such file.
Actually there are now two Info.plist files :
实际上现在有两个 Info.plist 文件:
fr.lproj/Info.plist
Base.lproj/Info.plist
How to localize the Info.plist path ?
如何本地化 Info.plist 路径?
回答by ncerezo
Roll back those changes, add a InfoPlist.strings file to your project, localize it and then add the needed keys to it. For example:
回滚这些更改,将 InfoPlist.strings 文件添加到您的项目,对其进行本地化,然后向其中添加所需的键。例如:
"CFBundleDisplayName" = "App display name";
"CFBundleName" = "App bundle name";
回答by Costas Bakoulias
To 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 文件!