如何在xcode4中本地化Settings.bundle? [英] How to localize Settings.bundle in xcode4?

查看:95
本文介绍了如何在xcode4中本地化Settings.bundle?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xcode4,并为我的项目创建了Settings.bundle.我可以在xcode4中编辑Root.plist文件,但是无法编辑Root.strings文件.它甚至没有显示在编辑器中.

如图所示,我无法展开en.lproj文件夹.

但是当我点击右键单击时,在外部编辑器中打开,它会给我:

Root.strings上的

双击给我:

我尝试了几次,创建了一个新的基于窗口的应用程序项目,并创建了一个新的Settings.bundle.我总是无法本地化它.有什么想法吗?

解决方案

Apple再次修复了错误的错误.他们的更改使我的解决方法无济于事.只是它不再起作用了,您无法将文件添加到Settings.bundle中.

请参阅 Javi 的答案,以获取可行的方法.


我希望您喜欢丑陋的解决方法.

  1. 右键单击侧栏中的设置包.
  2. 选择New File
  3. 选择资源/字符串文件
  4. 将其命名为Root.strings,确保将其放置在settings.bundle中
  5. 在侧栏中,文件将显示两次.在根"部分和Settings.bundle中.但是两者都指向相同的文件.
  6. 在根部分中选择Root.strings文件. (必须将其转换为UTF16)
  7. 添加本地化,​​xcode会询问您是否要替换文件.是的,您想要这个.
  8. 根据需要添加尽可能多的本地化.您应该能够在侧栏的根部分中编辑文件.

我希望这对您有用,对我而言也是如此.

如果尚未完成,请在 bugreport.apple.com 上报告错误. >


我现在将安装新版本,让我们看看它是否已解决.不固定.


我不知道我是否正确理解了您的第二个问题.但是,当您将本地化添加到捆绑包外部显示的文件时,它会将本地化文件夹添加到settings.bundle

Root.strings中添加西班牙文本地化之后:

实际文件位于foo.lproj文件夹中,只是没有在xcode侧栏中显示它们.如果检查文件系统中的位置,您会看到它们位于设置捆绑包内.

昨天我检查了英文和德文文件,它在模拟器中可以正常工作.我想这只是错误的侧边栏布局.文件的基本位置和处理似乎正确.

I am working on xcode4 and created a Settings.bundle for my project. I can edit the Root.plist file in xcode4 but it is not possible to edit the Root.strings file. It isn't even displayed in the editor.

I can not expand the en.lproj folder as you see in the picture.

But when I do right-click, open in external editor it gives me:

Double click on Root.strings gives me:

I tried it several times, creating a new window-based application project and creating a new Settings.bundle. I always can not localize it. Any ideas?

解决方案

EDIT: Apple fixed, once again, the wrong bug. Their change rendered my workaround useless. It just doesn't work anymore, you can't add files to the Settings.bundle.

Please refer to the answer of Javi for a method that seems to work.


I hope you like ugly workarounds.

  1. Right click on the settings bundle in the side bar.
  2. Select New File
  3. Pick Resource / Strings file
  4. Name it Root.strings, make sure it is placed inside settings.bundle
  5. In the side bar the file will be visible twice. In the "root" section, and in the Settings.bundle. But both point to the same files.
  6. Select the Root.strings file in the root section. (AFAIR you have to convert it to UTF16)
  7. Add localization, xcode will ask you if you want to replace the file. Yes, you want this.
  8. Add as much localizations as you want. You should be able to edit the file in the root section of the sidebar.

I hope this works for you, for me it does.

And if you haven't done it please report the bug at bugreport.apple.com


I'll install the new release now, let's see if this is fixed. Edit: Not fixed.


EDIT: I don't know If I understood your second question correctly. But when you add a localization to the file that appears outside of the bundle it adds a localization folder to the settings.bundle

After adding spanish localization to Root.strings:

The actual file is in the foo.lproj folder, it just doesn't show them in the xcode sidebar. If you check the location in the file system you'll see they are inside the settings bundle.

Yesterday I checked with a english and german file and it worked correctly in the simulator. I guess it's just a wrong sidebar layout. The underlying locations and the handling of the files seems correct.

这篇关于如何在xcode4中本地化Settings.bundle?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆