为什么我的 XIB 文件无法本地化 (iPhone)?
情况: 我正在启动 XCode,为 iPhone 创建一个新项目(查看应用程序)并将 XIB 文件加载到 IB 中。我操作视图(添加带有字符串“hello”的标签),保存,构建,运行应用程序,一切都很好。 现在我正在本地化 XIB。我所做的:右键单击 xib 文件,添加所需的语言,之后,我的 XCode 中有两个 XIB 文件。看起来绝对完美,就像我的 iPhone 编程书(“大书呆子牧场”)中所展示的那样。 我确实将两个 XIB 中的标签更改为另一个字符串,让我们说“早上好!”。
问题: 现在我清理并重建应用程序 - 但它总是显示旧的 XIB 文件,总是字符串“hello”。即使当我将 iPhone 上的设置更改为其他语言时,我总是会显示“hello”字符串。但是带有“hello”的 XIB 在我的 xcode 中不存在!
有什么提示给我吗?这让我发疯——我只是希望我错过了一件简单的事情。
我正在使用 XCode 3.2.3 和 SDK 4.0
非常感谢!
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!".
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.
I am using XCode 3.2.3 and SDK 4.0
Thanks a lot in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
有几个步骤需要遵循,包括:
fr.lproj/Example.xib
请参阅此 iPhone 本地化教程,了解完整步骤+ 屏幕截图。
There are a a few steps to follow, including:
fr.lproj/Example.xib
Have a look at this iPhone localization tutorial for the full steps + screenshots.
iPhone 模拟器和设备保存 NIB 的缓存。它很容易在模拟器上清除,因为它可以被删除,但我试图弄清楚如何清除设备上的缓存而不必删除应用程序。
iPhone simulator and the device hold a cache of the NIB's. it is easy to clear on the simulator since it can be deleted, but I am trying to figure out how to clear that cache on the device without having to delete the app.
试试这个:
Try this:
就我而言,除了删除模拟器上的应用程序之外,我还必须重新启动 xcode 才能使其正常工作。
In my case, I had to restart xcode in addition to deleting the app on the simulator to get it to work.
当涉及到 xib 文件中的本地化字符串时,Xcode 存在一个错误。 Xcode 不会将本地化字符串替换为实际的 xib 字符串,而是保留原始 xib 字符串。您所要做的就是将可本地化字符串文件转换为 Interface Builder 文件。您可以在界面生成器的文件属性的“本地化”部分下执行此操作。
希望这有帮助!
Xcode has a bug when it comes to localized strings in a xib file. Instead of replacing the localized strings with the actual xib's strings, Xcode keeps the original xib's strings. All you have to do is to convert the Localizable Strings file to an Interface Builder file. You can do that under the Localization section in the interface builder's file properties.
Hope this helps!