How to remove localization from file

2020-03-01 03:32发布

问题:

I'm trying to unlocalize xib and storyboard files, and keep all strings in Localizable.strings. How do I do this in XCode?

I've tried to uncheck all languages in the File Inspector, but if I remove the last language the whole file disappears.

A file that is not localized looks like this:

Unlocalized files wont appear when you add a new language or when you export localizations with xliff.

回答1:

This is a pretty stupid way, but the only one I found out working if you want to restore the default:

  1. Move the xib or Storyboard files from the Base.lprojfolder to your main project folder back (within the Finder).
  2. Delete the reference of the XIB/Storyboard files (in XCode)
  3. Reimport all of them back to your XCode project and you are done


回答2:

In Xcode create a Localizable.strings file, check the languages you want for it, then copy/pasta the files/strings, then remove the languages for the xib/storyboard.