使用 xcode 4.0.2 本地化资源

发布于 2024-11-04 20:58:55 字数 453 浏览 0 评论 0原文

我在尝试使用 xcode 4.0.2 本地化应用程序时遇到多个问题。 这个应用程序最初是用以前的版本编码的,但自从我安装了 4.0.2 以来,除了本地化之外,一切(或多或少)都正常工作。我有大约 10 个 png,它们使用 Interface Builder 通过 UIImageView 加载到 10 个不同的 xib 中。这些 png 已“正确”本地化,在 es.lproj 文件夹中是西班牙语的,在 en.lproj 文件夹中是英语的。 奇怪的是,即使在 xcode 中,当我打开 xib 文件时,它有时会显示英语版本,有时会显示西班牙语版本。 ?? xib 没有本地化,因为那里没有什么可以本地化的,只有带有 png 的 UIImageView 。

难道不能只本地化 png 的吗?

有谁知道这个问题是否响应已知的错误?

这个png的名称为text1.png、text2.png、text3.png ...这可能与序列化命名有关吗?

I am having multiple issues trying to localize an app with xcode 4.0.2.
This app was coded initially with previous version, but since I installed the 4.0.2 everything (more or less) has worked, except localization. I have about 10 png's that load in 10 different xibs via UIImageView using Interface Builder. These png's are "correctly" localized, inside the es.lproj folder the spanish ones and in the en.lproj folder the english ones.
The weird thing is that even inside xcode, when I open the xib file, it sometimes shows the english version and sometimes the spanish. ¿?
The xibs are not localized, because there is nothing more to localize in there, just that UIImageView with the png's.

Is it not possible to localize just the png's?

Does anyone know if this issues respond to known bugs?

This png's are named text1.png, text2.png, text3.png ... Could it be something related to the serialized naming?

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

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

发布评论

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

评论(2

笑忘罢 2024-11-11 20:58:55

没有本地化时默认的 xib 是英语。当它加载时,它会拉入英语资源。因此,除了图像之外,您还需要创建本地化的 xib。或者,对于您的情况,我建议您在 viewDidLoad 中加载并设置正确的图像,因为它只有 10 张图像。维护起来会更容易,因为您不必为所做的每项更改都更新 xib 的每个本地化版本。当您在其中包含更多本地化项目时,就不用再烦恼了。 :)

The default xib when there's no localization is english. When it load it pulls in the english resources. So you need to create the localized xibs in addition to the images. Or, what I'd recommend in your case since it's just 10 images, is to load and set the correct image in viewDidLoad. It'll be easier to maintain since you won't have to update every localized version of the xib for every change you make. Save that headache for when you have more items in one that are localized. :)

儭儭莪哋寶赑 2024-11-11 20:58:55

好吧,我想我明白了...

  • 我已将名称更改为 png 的。而不是text1.png ->文本一.png、文本二.png ...
    (不过,名称应该不是问题)
  • 更改名称时,某些 png 变成了红色。即使它们仍然位于正确的 lang.lproj(例如 en.lproj)文件夹中。
  • 我创建了另一个目录来备份文件并剪切粘贴所有“红色文件”。
  • 然后我从 xcode 中删除了(引用和文件)这些文件。
  • 使用 finder,我已将这些 png 中的每一个粘贴到我的主语言文件中。只是将其再次从那里移动到 xcode 资源。
  • 再次将其放入 xcode 后,我使用“本地化+”检查器对其进行了本地化。
  • 然后,再次使用 finder,我将 lang.lproj(例如 es.lproj)中的新“本地化”png 替换为备份文件夹中的旧语言 png。
  • 最后,我删除了模拟器中的应用程序,清理并再次运行。

我对 xib 文件执行了相同的过程。现在一切正常了。我还没有找到任何方法来修复显然没问题的文件的依赖关系或路径,但本地化没有按预期到达它们。但我明白这不应该是这样。

Well, I think that I get it...

  • I have changed the name to the png's. Instead of text1.png -> textone.png, texttwo.png ...
    (The name should not be a problem, though)
  • When changing the names, some of the png's has become red. Even though they were still in the right lang.lproj (ex. en.lproj) folder.
  • I have created another directory to back-up the files and cut-paste all the "red ones".
  • Then I have deleted (references and file) these files from xcode.
  • Using finder, I have pasted each one of these png's inside my main language file. Just to move it again to the xcode resources from there.
  • After having it in xcode again, I have localized it using the "Localization +" Inspector.
  • Then, using finder again, I have replaced new "localized" png inside lang.lproj (ex. es.lproj) with the old language png in the back-up folder.
  • Finally, I have deleted the app in the simulator, cleaned, and Run again.

I did the same process with xib files. And everything works now. I haven't found any way to fix dependencies or paths to files that aparently are ok, but the localization doesn't reach them as expected. I understand that this should not be the way, though.

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