Error while "Export For Localization.." Xcode 6.3
Asked Answered
A

6

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!

Accursed answered 13/4, 2015 at 17:31 Comment(3)
Looks like this is an issue with Xcode 6.3. People are discussing it on the apple dev forums but it doesn't look like there is a solution yet.Dm
Could you please post a link to the discussion @Dm ?Accursed
I found it myself :D devforums.apple.com/message/1124153#1124153Accursed
H
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".

Hardandfast answered 14/4, 2015 at 8:58 Comment(11)
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?Pertussis
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.Pertussis
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?Clammy
@Pertussis where fyi: option - shift - ] on mac. Thanks for this solution!Clammy
This solution is not ideal, since after export and import back localisations - escape sign is gone!Clammy
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.Gromme
@Gromme I also filed a radar and was told it was a dup. Quinn says it's fixed in an "upcoming version" of Xcode. We've gone back to Xcode 6.2 until we see that version.Pertussis
@Clammy you can find any character, such as "right single quotation mark", on the Character Viewer (System Preferences -> Keyboard -> Show Keyboard & Character Viewers)Pertussis
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.Phospholipide
Xcode 6.3.2 gm released May 8 fixes this problem for me.Pertussis
Beware of this escape symbol! check my answer here: https://mcmap.net/q/660689/-xcode-6-3-2-or-6-4beta-localization-failed-to-read-a-strings-fileClammy
C
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)

Clammy answered 22/4, 2015 at 9:13 Comment(2)
Another solution is to go back to Xcode 6.2 and wait for the fixed version of Xcode.Pertussis
every version of Xcode has a lot of bugs, you get to choose which ones bother you leastPertussis
P
2

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

Pimpernel answered 13/5, 2015 at 16:57 Comment(0)
J
2

Is fixed in today release of Xcode Version 6.3.2

Jaunitajaunt answered 20/5, 2015 at 7:43 Comment(0)
P
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.

Paleface answered 9/6, 2015 at 23:0 Comment(0)
R
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)

Relevance answered 15/5, 2015 at 11:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.