本地化 xib 文件困难
我已经本地化了两组 xib,并将它们放入我的项目导航器中,如下图所示:
我的Localized.strings 文件工作正常,但 xib 文件有时选择不正确。当我将设备语言设置为法语时,我看到英语 xib 视图。当我将设备语言设置为英语时,我看到法语 xib 视图。
我从项目中删除了 xib 文件,仅删除了引用,然后将它们拖回项目中的相同位置,如图所示。目前,无论我将设备设置为哪种语言,我都只能看到英文版本。
有人可以看出我做错了什么吗?
(我已阅读建议,像这个,关于不使用单独的我可能会在某个时候切换到该框架,但现在,我只想了解我的设置出了什么问题。)
更新
这是 en.lproj 文件夹的文件组织。 fr.lproj 文件夹的设置方式相同。它们位于名为 Resources 的文件夹内。
更新 - 最终结果
我尝试了 xib 文件的本地化设置右侧的面板。
当我选择两种或多种语言进行本地化时,终于注意到了这些披露按钮。单击公开按钮会显示每种语言的 xib 文件。然后我重新进行了外语 xib 的本地化。 (我可能可以从现有的 xib 中复制并粘贴。)
因此文件现在的组织方式如下:
I have localized two sets of xibs and put them in my project navigator as shown in the picture below:
My Localized.strings files are working fine, but the xib files are sometimes selected incorrectly. When I set the device language to French, I see the English xib view. When I set the device language to English, I see the French xib view.
I removed the xib files from the project, deleting the references only, and then dragged them back into project in the same places, as the picture shows. Right at the moment, I'm only seeing the English version, regardless of which language I have the device set to.
Is there something anyone can see that I'm doing wrong?
(I have read advice, like this one, on not using separate frames for each language. I may switch to that at some point, but right now, I just want to understand what is wrong with my set up.)
Update
Here is the file organization for the en.lproj folder. The fr.lproj folder is set up the same way. These are inside a folder called Resources.
Update - Final Result
I experimented with the localization settings for my xib files in the panel at the right.
and finally noticed those disclosure buttons when I had two or more languages selected for localization. Clicking on the disclosure button revealed a xib file for each language. I then had redo the localization for the foreign language xib. (I probably could have copied and pasted from the existing xibs.)
So the files are now organized like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
项目导航器显示 en.proj 和 fr.proj,但这些文件是否真的本地化在文件系统上的文件夹中?在 XCode 4.2 中,本地化文件将在括号中的文件名后面显示本地化信息。我在你的例子中没有看到这一点。这是我的本地化资源的样子。
要本地化 XIB,您需要将它们放入文件系统上具有适当名称的文件夹中。从文件检查器中执行此操作最简单。
不知道这是否有帮助?
The project navigator shows the en.proj and fr.proj, but are the files really localized in folders on the file system? In XCode 4.2 the localized files will show there localization after the file name in parentheses. I do not see that in your example. Here is what my localized resources look like.
To make the XIB localized you need to put them into folders on the file system with the appropriate names. It is easiest to do this from the file inspector.
Don't know if this helps?