xcode Default.png 的本地化不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3421868/
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
Localization of Default.png is not working
提问by Structurer
I wonder if anyone has encountered the same problem and how they solve it.
我想知道是否有人遇到过同样的问题以及他们是如何解决的。
I want to localize Default.png so I do the following steps which from what I understand should be the correct way (please correct me if I'm wrong).
我想本地化 Default.png 所以我执行以下步骤,据我所知应该是正确的方法(如果我错了,请纠正我)。
- Select Default.png in xcode
- Command-I to Get Info
- Click on Make File Localizable
- Go back to General Tab (why Apple, why?)
- Click on Add Localization
- Enter es for Spanish according to this:
- In finder I replace the Default.png in the es.lproj folder
- 在 xcode 中选择 Default.png
- 命令-I 获取信息
- 单击使文件可本地化
- 返回常规选项卡(为什么是 Apple,为什么?)
- 点击添加本地化
- 根据此输入西班牙语的 es :
- 在 finder 中,我替换了 es.lproj 文件夹中的 Default.png
I have tried in both the simulator and on an iPhone with changing the language between English and Spanish, but I only get the original file. Other localizations like app name and strings works just fine, but not this one...
我已经尝试在模拟器和 iPhone 上更改英语和西班牙语之间的语言,但我只得到原始文件。其他本地化(如应用程序名称和字符串)工作正常,但不是这个......
I'm on xcode 3.2.3
我在 xcode 3.2.3
Thanks
谢谢
回答by Structurer
I got this solution from Developers Forum (credit to Sascha Paulus, thanks Sascha!).
我从开发者论坛得到了这个解决方案(感谢 Sascha Paulus,感谢 Sascha!)。
I had a similar problem in another project with localization, but the solution worked for both issues.
我在另一个本地化项目中遇到了类似的问题,但该解决方案对这两个问题都有效。
Here we go:
开始了:
Delete App from Simulator (just to be sure)
Delete all versions of the localized Default.png (in XCode & on Disc)
Select Build > Clean All Targets
If not done yet, make the Localizion Directories (e.g. es.lproj, de.lproj)
Copy the localized Default.png in the appropriate Localizion Directory
- Go To XCode > Right Mouse Click on Resources > Add > Existing File ...
- Select the localized Default.png in the Localizion Directory
- Don't forget to mark "Copy items into destination group's folder...." > Add
- Repeat it with every localized Default.png
从模拟器中删除应用程序(只是为了确定)
删除所有版本的本地化 Default.png(在 XCode 和光盘上)
选择构建 > 清理所有目标
如果尚未完成,请制作本地化目录(例如 es.lproj、de.lproj)
将本地化的 Default.png 复制到适当的本地化目录中
- 转到 XCode > 鼠标右键单击资源 > 添加 > 现有文件...
- 在本地化目录中选择本地化的 Default.png
- 不要忘记标记“将项目复制到目标组的文件夹....”> 添加
- 对每个本地化的 Default.png 重复它
I think the trick is to delete the file you have a problem with, clean all and then add it again. If you don't have any localization there is no need to create a specific folder.
我认为诀窍是删除有问题的文件,清理所有文件,然后再次添加。如果您没有任何本地化,则无需创建特定文件夹。
Give it a try, worked for me.
试一试,对我有用。
回答by Matt H
I'd thought I'd add the answer for localizing Launch.xib.
我以为我会添加本地化 Launch.xib 的答案。
- Create
InfoPlist.strings
file. (File,New,Resource,Strings) - Localize it and select your languages
For e.g. the Spanish version, add your launch screen key and name for the Spanish version of your Launch screen
"UILaunchStoryboardName" = "Launch_es";
Copy your existing Launch.xib to Launch_es.xib, and change the text and/or images to the Spanish translations or Spanish-named images.
- 创建
InfoPlist.strings
文件。(文件、新建、资源、字符串) - 本地化并选择您的语言
对于例如西班牙语版本,添加您的启动屏幕键和启动屏幕西班牙语版本的名称
"UILaunchStoryboardName" = "Launch_es";
将您现有的 Launch.xib 复制到 Launch_es.xib,并将文本和/或图像更改为西班牙语翻译或以西班牙语命名的图像。
回答by intropedro
I have had the same problem. I have solved it with this:
我曾经也有过一样的问题。我已经解决了这个问题:
- In the Simulator, menu "simulator iOs", option "restart content and settings".
- In Xcode, menu "Build", option "Clean All Targets"
- 在模拟器中,菜单“模拟器 iOs”,选项“重启内容和设置”。
- 在 Xcode 中,菜单“Build”,选项“Clean All Targets”
And when I have selected the button "Build and run" it has worked.
当我选择“构建并运行”按钮时,它就起作用了。
回答by Bruno D. Rodrigues
Just to add that on a latest 4.3.3 every attempt to remove and re-add the files, and the clean all, nothing worked, but what solved everything was the remove-app-from-device-and-simulator and reinstall. Now every image and xib are translated correctly.
只是为了在最新的 4.3.3 上添加,每次尝试删除和重新添加文件,并清除所有内容,没有任何效果,但解决所有问题的是从设备和模拟器中删除应用程序并重新安装。现在每个图像和 xib 都被正确翻译。