为什么我的XIB文件没有本地化(iPhone)? [英] Why does my XIB file not localize (iPhone)?
问题描述
情况: 我正在启动XCode,为iPhone(查看应用程序)创建一个新项目,并将XIB文件加载到IB中.我操纵视图(添加带有字符串"hello"的标签),保存,构建,运行应用程序,一切都很好. 现在,我正在本地化XIB.我的工作:右键单击xib文件,添加所需的语言,然后,我的XCode中有两个XIB文件.看起来绝对完美,就像我的iPhone编程书(大书呆子牧场")中所显示的一样. 我确实将两个XIB中的标签都更改为另一个字符串,让我们说早上好!".
Situation: I am starting XCode, creating a new project for the iPhone (view application) and loading the XIB file into the IB. I manipulate the view (adding a label with the string "hello"), save, build, run the application, everything is fine. Now i am localizing the XIB. What i do: right-click on the xib-file, adding the desired language and after that, i have two XIB files in my XCode. Looks absolut perfect, just as it is shown in my iPhone Programming book ("the big nerd ranch"). I do change the label in both XIBs to another string, lets say "good morning!".
问题: 现在,我清理并重建该应用程序-但它始终显示旧的XIB文件,并始终显示字符串"hello".即使当我将iPhone上的设置更改为其他语言时,我也始终获得显示的"hello"字符串.但是带有"hello"的XIB在我的xcode中不存在!
Problem: Now i clean and rebuild the application - but it allways shows the old XIB-file, allways the string "hello". Even when i change the settings on the iphone to other languages, i allways get the "hello" string shown. But the XIB with "hello" does not exist in my xcode anywhere!
对我有什么提示吗?这让我发疯了-我只希望我错过了一件简单的事情.
Any hints for me? It makes me go crazy - and i just hope that i am missing a simple thing.
我正在使用XCode 3.2.3和SDK 4.0
I am using XCode 3.2.3 and SDK 4.0
非常感谢!
推荐答案
需要遵循一些步骤,包括:
There are a a few steps to follow, including:
- ibtool --generate-strings-file Example.strings zh.lpoj/Example.xib
- genstrings -o en.lproj * .m
- 翻译资源文件
- ibtool --strings-file fr.lproj/Example.strings en.lproj/Example.xib –写 fr.lproj/Example.xib
- 将翻译后的资源文件拖到项目中(在正确的位置).
- ibtool --generate-strings-file Example.strings en.lpoj/Example.xib
- genstrings -o en.lproj *.m
- translating the resource file
- ibtool --strings-file fr.lproj/Example.strings en.lproj/Example.xib –write fr.lproj/Example.xib
- dragging the translated resource file to the project (in the exact right place).
请查看此 iPhone本地化教程全部步骤+屏幕截图.
Have a look at this iPhone localization tutorial for the full steps + screenshots.
这篇关于为什么我的XIB文件没有本地化(iPhone)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!