为什么我的 XIB 文件无法本地化 (iPhone)?

发布于 2024-09-27 01:10:36 字数 475 浏览 2 评论 0原文

情况: 我正在启动 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

农村范ル 2024-10-04 01:10:36

有几个步骤需要遵循,包括:

  • ibtool --generate-strings-file Example.strings en.lpoj/Example.xib
  • genstrings -o en.lproj *.m
  • 翻译资源文件
  • ibtool --strings-file fr.lproj /Example.strings en.lproj/Example.xib –write
    fr.lproj/Example.xib
  • 将翻译后的资源文件拖到项目中(在正确的位置)。

请参阅此 iPhone 本地化教程,了解完整步骤+ 屏幕截图。

There are a a few steps to follow, including:

  • 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).

Have a look at this iPhone localization tutorial for the full steps + screenshots.

楠木可依 2024-10-04 01:10:36

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.

一梦等七年七年为一梦 2024-10-04 01:10:36

试试这个:

  1. 检查您是否已将 Localitations 参数添加到项目文件的“信息”选项卡中
  2. 窗口 - 管理器 - 选择您的项目 - 删除派生数据
  3. 项目清理
  4. 从设备中删除应用程序
  5. 再次运行。

Try this:

  1. Check if you have added Localitations parameter to "Info" tab of your project file
  2. Window - Organizer - Chose your project - Delete derived data
  3. Project Clean
  4. Delete application from your device
  5. Run again.
凡尘雨 2024-10-04 01:10:36

就我而言,除了删除模拟器上的应用程序之外,我还必须重新启动 xcode 才能使其正常工作。

In my case, I had to restart xcode in addition to deleting the app on the simulator to get it to work.

隱形的亼 2024-10-04 01:10:36

当涉及到 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文