Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
259 views
in Technique[技术] by (71.8m points)

ios - I added a localization in xcode, removed it and now my storyboard is gone

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:

    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.

  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: Two base localizations, what does that mean?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...