本文介绍了我在 xcode 中添加了本地化,将其删除,现在我的故事板不见了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想尝试本地化我的应用程序.我的项目文件夹中有一个 Storyboard.storyboard.

  1. 我选中了使用基本国际化"复选框,然后 xcode 对我的文件进行了处理.
  2. 我继续添加第二个本地化
  3. Xcode 告诉我它无法创建一些 .plist,因为它已经存在.
  4. 我最终得到了两个故事板(基础"和英语"组合在一起),这很奇怪,因为文档清楚地表明我只需要处理一组故事板(使用基本国际化时)并且其他语言将是字符串文件:

    基础国际化是 Xcode 4.5 中引入的一项功能,它使本地化人员(即翻译人员)无需为应用支持的每种语言修改故事板和 nib 文件.相反,一个应用程序只有一组故事板或 nib 文件,这些文件已本地化为默认语言;这些故事板和 nib 被称为基础国际化.当您将本地化添加到应用程序时,Xcode 会为每个故事板或 nib 文件显示或包含的所有文本生成一个字符串文件,作为可访问性标签或提示.Xcode 为文件提供故事板的名称和扩展字符串.因此,如果您有一个名为 MyStoryboard.storyboard 的故事板,则生成的字符串文件名为 MyStoryboard.strings.

  5. 我删除了我新创建的本地化(英语),因为这不是我所期望的
  6. 现在所有的故事板都消失了,尽管我只删除了一个本地化

我的垃圾箱里现在有两个故事板(一个是storyboard.storyboard",一个是故事板一些数字.storyboard),但我不知道 1)我应该使用哪一个,以及 2) 既然我检查了基本国际化"选项,它现在应该在某种子文件夹中吗?.plists 呢?我在 this页面,但它告诉我点击哪里比告诉我不同​​文件的目的做得更好,所以我不知道如何正确地扭转这个

更新:

现在当我重新启动 xcode 时它看起来像这样:

我不知道从这里去哪里......

解决方案

对于垃圾箱中的故事板,我会尝试将它们都打开,看看哪个是正确的.对于使用 .strings 文件而不必本地化整个情节提要,在使用基本国际化时,您可以选择.您可以通过在本地化下更改此处的选项来更改它(当您打开故事板时,它位于左窗格下方)

将选项从界面生成器更改为可本地化的字符串,您不必使用情节提要.不同之处在于界面构建器之一,您必须像编辑任何其他情节提要一样编辑所有标签和任何要本地化的内容,这可能很乏味.字符串文件通过基本上为您提供整个故事板中所有文本的列表并让您通过翻译文本来更改他们所说的内容,而不必编辑整个故事板文件,从而使操作变得容易.

So I wanted to try localizing my app. I had one single Storyboard.storyboard in my project folder.

  1. I checked the "use base internationalization" checkbox and then xcode did something with my files.
  2. I proceeded to add a second Localization
  3. Xcode told me it couldn't create some .plist since it already existed.
  4. I ended up with two storyboards ("Base" and "English" grouped together), which was very strange since the documentation clearly said I would just have to deal with one set of storyboards (when using base intertationalization) and that the other languages would be strings-files:

  5. I removed my newly created localization (english) because this was not what I expected
  6. Now all of the storyboards are gone, even though I only deleted one localization

I have two storyboards in my trash now (one "storyboard.storyboard" and one named storyboardsome numbers.storyboard), but I have no idea 1) which one I should use, and 2) is it supposed to be in some sort of subfolder now since I checked the "base internationalization" option? What about the .plists? I read up on things on this page but it did a better job on telling me where to click than telling me the purpose of the different files, so I have no idea how to reverse this properly

Update:

Now it looks like this when I restart xcode:

I have no clue where to go from here...

解决方案

For the storyboards in the trash, I would try opening them both up and seeing which is correct. And for using .strings files instead of having to localize the whole storyboard, when using base internationalization you have an option. You can change it by changing the option here under localization (this is under the left pane when you open the storyboard)

Change the option from interface builder to localizable strings, and you don't have to use the storyboard. The difference is in the interface builder one, you would have to edit all labels and anything you want to localize like you would edit any other storyboard, which can be tedious. The strings file makes it easy by basically giving you a list of whatever text you have in your whole storyboard and letting you change what they say by translating the text, instead of having to edit the whole storyboard file.

这篇关于我在 xcode 中添加了本地化,将其删除,现在我的故事板不见了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:19