21

I want to add some new languages to my projects but after clicking Editor -> Export For Localization -> Save, I get the following error:

Localization failed reading "/var/folders/rs/_qctp1n15gl81l8s0rm7njnh0000gn/T/Xcode3SourceStringsAdaptor-2E68CCA9-A2EA-4EE4-8ED1-A9250721AFC1/Localizable.strings"

Please address the issue at file location 990

I have tried it in different projects, some working well some have this error. All projects have the same languages and are already localized I just have to add some other languages.

I have no idea what's the reason or how I can solve this problem.

I am grateful for any response!

Nico Nimz
  • 268
  • 2
  • 15

6 Answers6

15

The issue seems to be in Xcode 6.3, that the XLIFF parser suddenly chokes on unescaped quotes ('). A solution seems to be to escape (with a backslash) all instances of quotes in your source code, e.g replace @"Foobar's" with @"Foobar\'s".

progrmr
  • 75,956
  • 16
  • 112
  • 147
hakanw
  • 284
  • 3
  • 8
  • This worked for fixing strings that are in Objective-C but it doesn't help when the string is in a .storyboard. Is there a workaround for storyboards? – progrmr Apr 20 '15 at 17:06
  • 5
    I found a better workaround. I replaced the ' (apostrophe) characters with ’ (left single quote) characters in both storyboards and .m files. That solved the problem for me. – progrmr Apr 20 '15 at 18:21
  • 1
    Thanks a lot, I suffered enough with this bug :@@@ – Perjan Duro Apr 21 '15 at 13:04
  • Awesome! How did you detect, which character is cause error? for example: "Please address the issue at file location 990" - what 990 means? character #990 in file? – skywinder Apr 22 '15 at 07:42
  • 1
    @progrmr where `’` fyi: `option - shift - ]` on mac. Thanks for this solution! – skywinder Apr 22 '15 at 09:03
  • 3
    This solution is not ideal, since after export and import back localisations - escape sign is gone! – skywinder Apr 22 '15 at 09:08
  • 4
    None of the workarounds seem adequate. My objective-C code does NOT contain any apostrophes. But one of the translations in a Localizable.strings file contains an apostrophe. That alone causes Xcode to fail in the same manner. I was tempted to start replacing apostrophes by single quotes in my English code, but to do that in translated files would be a major problem. I have filed a radar with Apple. – rene Apr 22 '15 at 13:53
  • @rene I also filed a radar and was told it was a dup. [Quinn](https://devforums.apple.com/message/1127998#1127998) says it's fixed in an "upcoming version" of Xcode. We've gone back to [Xcode 6.2](https://developer.apple.com/downloads/index.action?name=6.2) until we see that version. – progrmr Apr 22 '15 at 14:42
  • @skywinder you can find any character, such as "right single quotation mark", on the Character Viewer (System Preferences -> Keyboard -> Show Keyboard & Character Viewers) – progrmr Apr 22 '15 at 14:51
  • 1
    I have the same problem here. Funny thing is, I don't have any (') in my codes. Probably have to wait for the updates from Xcode team. – leonard May 03 '15 at 20:39
  • 1
    [Xcode 6.3.2 gm](https://developer.apple.com/xcode/downloads/) released May 8 fixes this problem for me. – progrmr May 09 '15 at 15:57
  • **Beware** of this escape symbol! check my answer here: http://stackoverflow.com/a/32584732/1698467 – skywinder Sep 15 '15 at 11:23
3

Accepted answer has an issue: after exporting and import back localisations - escape sign is gone!

As @progrmr mention in comments - there is better workaround to replace ' with left single quote sign! (option - shift - ] on OS X)

skywinder
  • 21,291
  • 15
  • 93
  • 123
  • Another solution is to go back to [Xcode 6.2](https://developer.apple.com/downloads/index.action?name=Xcode#) and wait for the fixed version of Xcode. – progrmr Apr 22 '15 at 14:44
  • 2
    every version of Xcode has a lot of bugs, you get to choose which ones bother you least – progrmr Apr 22 '15 at 14:55
2

There's an Xcode 6.3.2 GM seed available in the developer portal downloads section. It fixed the problem for our project.

John Clayton
  • 1,081
  • 1
  • 9
  • 21
2

Is fixed in today release of Xcode Version 6.3.2

kraag22
  • 3,340
  • 3
  • 29
  • 37
1

Be careful with XIB/Storyboard files that are localized but don't have any UI element to localize.

Those files happen to generate empty .strings files. Those empty .strings files cause the parser to throw an error, like the following: Failed to read strings file, underlying error: The data couldn't be read because it isn't in the correct format.

Removing the localization for those files worked for me.

Pablo
  • 11
  • 1
0

In my case, I play the problem with these steps:

In xcode 6.3: 1. Do a regex search for \@\".\'.\" in the whole project. 2. I found no localized string have ', but quite a lot of sting in FMDB source code has SQL comment with '...

So, I Download the xcode 6.2 again, install it and "Export for Localization..." comes back!(spent me half and hour)

BillChan
  • 85
  • 1
  • 3