本地化 xib 文件困难

发布于 2024-12-25 15:36:21 字数 981 浏览 1 评论 0原文

我已经本地化了两组 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:

enter image description here

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.
enter image description here

Update - Final Result

I experimented with the localization settings for my xib files in the panel at the right.

enter image description here

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:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

如何视而不见 2025-01-01 15:36:22

项目导航器显示 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.

enter image description here

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.

enter image description here

Don't know if this helps?

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