8

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 .strings 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.

0

2 Answers 2

14

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Wow, that worked and is very simple, but I don't understand why. I had only two files in that group, so it was a very small drop change. Thanks!
+1 for this. Using this to workaround Xcode crashes when adding files to my project, Thanks!
Just want to add to this as well, that Xcode was still crashing if the .strings group did not have another object in the same group below it. My workaround was to add a temporary Group below the .strings group.
7

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.

2 Comments

This is what I ended up doing. I can't imagine this is the way localized files are supposed to get back into Xcode. File a Radar with Apple.
This does not work when the localized files are under version control. XCode tries to add them again and fails :-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.