开发者

How to add localized .strings files back to Xcode?

开发者 https://www.devze.com 2023-04-08 11:39 出处:网络
I have a .strings file that is localized in a number of languages.I\'d like to add it to my Xcode project. How do you get Xcode to correctly reference the files? I\'ve tried

I have a .strings file that is localized in a number of languages. I'd like to add it to my Xcode project. How do you get Xcode to correctly reference the files? I've tried

  • dragging the english version of the .strings file (found in English.lproj) to Xcode and hoping it would automatically pick up the other localized versions of the file -- it doesn't.
  • dragging all 5 localized versions of the .stri开发者_C百科ngs file (found in English.lproj, es.lproj, etc.) assuming Xcode would create a single file reference with the various localized versions -- it crashes.
  • dragging each of the .lproj folders to Xcode hoping it would figure out that the file in each of the folders is all the same file, but localized -- nope
  • dragging the English version of the localized .strings file to Xcode, then add a localization that already exists -- Xcode warns that it will overwrite the file, but doesn't give the option to use the existing file.

UPDATE: Submitted a bug report to Apple: #10181468.


The simplest way as of Xcode 4.6 is to drag localization file (.strings file, not the folder it's located inside of) from Finder to the Xcode project tree. Be accurate and drag to the top of .strings group, not to the bottom or inside of the group as the latter makes Xcode crash.


Add the original file (only the file, not the .lproj folder) then make it localizable, add all languages you want, xcode will create .lproj folders and duplicate your original file for each language.

After you can overwrite each file duplicated by your already translated file (either the file if it have the same name or content).

Don't forget to set the format of the original file to UTF-16 when you add it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号