我在 xcode 中添加了一个本地化,删除了它,现在我的故事板不见了
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15706851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I added a localization in xcode, removed it and now my storyboard is gone
提问by Andreas
So I wanted to try localizing my app. I had one single Storyboard.storyboard in my project folder.
所以我想尝试本地化我的应用程序。我的项目文件夹中有一个 Storyboard.storyboard。
- I checked the "use base internationalization" checkbox and then xcode did something with my files.
- I proceeded to add a second Localization
- Xcode told me it couldn't create some .plist since it already existed.
- 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:
Base internationalization, a feature introduced in Xcode 4.5, relieves localizers (that is, translators) of the need to modify storyboards and nib files for each language an app supports. Instead, an app has just one set of storyboards or nib files that is localized to the default language; these storyboards and nibs are called the base internationalization. When you add a localization to an app, Xcode generates a strings file for all the text that each storyboard or nib file displays or includes as an accessibility label or hint. Xcode gives the file the name of the storyboard and the extension strings. So if you have a storyboard named MyStoryboard.storyboard, the generated strings file is named MyStoryboard.strings.
- I removed my newly created localization (english) because this was not what I expected
- Now all of the storyboards are gone, even though I only deleted one localization
- 我选中了“使用基础国际化”复选框,然后 xcode 对我的文件做了一些处理。
- 我继续添加第二个本地化
- Xcode 告诉我它无法创建一些 .plist,因为它已经存在。
- 我最终得到了两个故事板(“基本”和“英语”组合在一起),这很奇怪,因为文档清楚地说明我只需要处理一组故事板(使用基本国际化时)而其他语言将是字符串文件:
基本国际化是 Xcode 4.5 中引入的一项功能,它使本地化人员(即翻译人员)无需为应用程序支持的每种语言修改故事板和 nib 文件。相反,应用程序只有一组本地化为默认语言的故事板或 nib 文件;这些故事板和笔尖被称为基础国际化。当您向应用程序添加本地化时,Xcode 会为每个故事板或 nib 文件显示或包含的所有文本生成一个字符串文件,作为可访问性标签或提示。Xcode 为文件提供了故事板的名称和扩展字符串。因此,如果您有一个名为 MyStoryboard.storyboard 的故事板,则生成的字符串文件将命名为 MyStoryboard.strings。
- 我删除了我新创建的本地化(英文),因为这不是我所期望的
- 现在所有的故事板都不见了,即使我只删除了一个本地化
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 pagebut 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
我现在在我的垃圾箱里有两个故事板(一个“storyboard.storyboard”和一个命名故事板一些数字.storyboard),但我不知道1)我应该使用哪个,2)它应该在某种子文件夹,因为我检查了“基本国际化”选项?.plist 呢?我阅读了此页面上的内容,但它在告诉我单击的位置方面做得比告诉我不同文件的用途要好,所以我不知道如何正确反转
Update:
更新:
Now it looks like this when I restart xcode:
现在当我重新启动 xcode 时它看起来像这样:
I have no clue where to go from here...
我不知道从这里去哪里......
回答by Chris Loonam
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)
对于垃圾箱中的故事板,我会尝试打开它们,看看哪个是正确的。对于使用 .strings 文件而不必本地化整个故事板,当使用基本国际化时,您有一个选择。您可以通过更改本地化下的选项来更改它(当您打开故事板时,这是在左窗格下)
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.
将选项从界面生成器更改为可本地化的字符串,并且您不必使用故事板。区别在于界面构建器之一,您必须像编辑任何其他故事板一样编辑所有标签和任何想要本地化的内容,这可能很乏味。字符串文件通过基本上为您提供整个故事板中的任何文本的列表,并让您通过翻译文本来更改他们所说的内容,而不必编辑整个故事板文件,从而使事情变得简单。