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!
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".
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)
There's an Xcode 6.3.2 GM seed available in the developer portal downloads section. It fixed the problem for our project.
Is fixed in today release of Xcode Version 6.3.2
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.
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)
Related
I can see that this is a recurring problem with all sorts of Xcode versions. I'm using the latest non-beta build (9.2 9C40b).
I have already localized in Spanish. Doing that involved successful exports and imports of xliff files, with same Xcode. So what changed?
I am now trying to localize to another language. This is a showstopper. Any hints? I have looked through all the posts about previous versions crashing, and have not found anything that works.
(And before you mention it, I am done and over with genstrings. If it exists anymore.)
I've discovered that large .xliff files (more than about 6,500 lines or 1,200 <trans-unit> elements) cause Xcode 10.1 to crash consistently near the end of an import operation.
The work-around is to manually split the .xliff file into two distinct .xliff files, each containing a subset of the <file> elements in the original file. You can then import the two resulting .xliff files into Xcode separately without crashing.
Do not translate "bundle name"
I wanted to translate to Greek Language and every time I was importing xliff files, Xcode was crashing.
I realized that the problem was, that I was also translating "bundle name".
If you did the same mistake, open xliff file, find:
<trans-unit id="CFBundleName">
<source>NameOfYourApp</source>
and delete the line
<target>...</target>
After that everything worked perfect for me!
Here's a workaround. Select your project icon in the Project Navigator. Select Info at top (as opposed to Build Settings). Under Localizations, click the + button and add your new language.
Xcode will create the new .strings files and fill them up with pre-existing translations. (If there are any.) Strangely, for me, some of the new .strings files were filled in with English, some with Spanish.
In any case, you have the new .strings files and can manually paste in the translations for the new language. If your app doesn't have too much user-facing text, this isn't onerous.
But really, with this problem going back to Xcode 4 (!) one would think it would be fixed by now.
it's a late answer I know, and I'm using Xcode Version 10.1 (10B61) already.
In my scenario, I added Chinese Hong Kong (zh-HK) language under Project > Info > Localization and exported successfully then sent to the agency for translations. After few days they sent to me Chinese translated text within. At that point, everything seems correct for me by eye. But I've tried 10 times to import file and it crashes 10 times without exception! Which makes me sick. I use to checked to see the difference between 2 document via Apple's File Merge App. I understand that agency geniuses added few missing <\target> tags. Hmmm, that means while exporting Xcode didn't add for some translations <\target> tag. Interesting...
I removed those unnecessarily translated tags and checked everything was equal in 2 documents except translations of the words to the Chinese language.
Tried to import again. Then BOOM! It works like a charm! I was surprised by this. It's so weird that Xcode never shows me a descriptive message about my mistake. Probably, It's just a parse error for Xcode.
Whatever, I hope this will work for someone else.
Best.
The code above has correct syntax highlighting in Xcode 7. It is mix of Obj-C + Swift:
I've updated project to support Xcode 8 and only few things was changed:
In Build Settings Swift 2.3 support
And have fixed few errors related to implicitly unwrapped properties in UIKit
After all the project is compiled fine for Xcode 8.
But Obj-C code integrated in Swift doesn't have any syntax highlighting and vice versa:
And there is << error type >> problem with autocomplete:
Derived data deleting doesn't help, Xcode restart either :) CocoaPods version 0.38.2, iOS 7
This answer helped me https://forums.developer.apple.com/thread/46223 with one of my projects:
I got help from an apple engineer at WWDC on this issue and resolved
it. The problem stemmed from cocoapods... Apparently cocoapods was
copying .h files into the build directory and SourceKit was getting
confused. I'm not entirely sure why the .h files were being copied -
they aren't needed there. So the fix was to add a post-build script
in your build phases section that removes the headers after a build.
It would look something like this:
function removeHeaders() {
find $BUILD_ROOT/Debug-iphonesimulator/ -name '*.h' -exec rm -f {} \;
}
removeHeaders
Fixed. Problem was related to the presence of target in project which is not compiled. So if you have targets e.g. A, B, C and C is not compiled this cause problems with syntax highlighting.
I have found that when syntax highlighting falls over, switching tabs in Xcode fixes the issue ¯_(ツ)_/¯ sometimes I find I need to switch to at least 4 different tabs before it comes on again.
Otherwise a quit and reopen
It happened also to me with Xcode 8 GM but also lots of time when I used Xcode 7: sometimes the auto-complete feature and the syntax highlighting die without notice.
The only solution that it works for me is restart Xcode but a few times I needed to complete reboot my Mac; I still don't know exactly what causes this annoying problem.
Setting Use Legacy Swift Language Version to YES in the Build Settings helped me to solve similar issue
Commenting and then uncommenting the affected lines worked for me.
In my case:
In Finder I navigated to user->Library->Developer->Xcode->DerivedData. Close your Xcode Project then Clear DerivedData. It's work for me.
Happy Coding...:)
For me, code completion/highlighting not working due to the missing file in the Compile Sources under Build Phases. I added that file and it works.
Hope this helps anyone.
As others have stated above - if I create a new tab ..or 4 then close the tab that usually does it. Sometimes commenting out a line then immediately uncommenting does the trick as well. I got tired of using several keys to accompolish this and made a simple AppleScript to do it for me.
Create a Automator 'service' and add this script to it. In System Preferences under Keyboard -> Shortcuts -> Services find your new service and assign it to an empty function key (I used F1) and now you have a 1 key fix!
on run {input, parameters}
tell application "Xcode"
activate
tell application "System Events" to keystroke "t" using command down
delay (0.5)
tell application "System Events" to keystroke "w" using command down
delay (0.5)
tell application "System Events" to keystroke "/" using command down
delay (0.5)
tell application "System Events" to keystroke "/" using command down
delay (0.5)
end tell
return input
end run
In an iOS project, I've updated this morning my pods to add a new one. The Parse iOS SDK also got updated in the process, and it seems like it broke my app's localization.
Now, when I try to call NSLocalizedString(#"A_LOCALIZED_STRING", nil), I always get #"A_LOCALIZED_STRING" in return.
Even if I use the longer version of NSLocalizedString with a specific bundle (here, [NSBundle mainBundle]), I get the same results.
I've noticed that the only string that gets localized properly is the string #"OK", which precisely is the only string specified in Parse SDK's Localizable.strings file.
My interpretation is that this pod's Localizable.strings is somewhat overriding my own. Is that even possible? How to workaround this?
Thanks!
(I must also add that localization in my project used to work flawlessly until now, so it's not a first-time configuration problem.)
I think they just realeased a fix (1.8.0.1).
You'll have to :
Update your pods : pod update
Clean your project in Xcode : Cmd + K
Clean your project folder : Cmd + Shift + K
Remove the app from the device / simulators
Run your project
Yes, thank's Parse, we're really glad to loose half a day to solve the problem your made appear just by localizing one of the most useless word to localize, "OK".
Absolut mental bug, banged my head against a wall for two days.
Also don't forget to clean (shift + cmd + k) your project and do a fresh install of your app after updating parse.
For starters, I'm completely new to coding. I'm trying to learn Swift through youtube tutorials but when they tell me to build i always get Build Failed, because Line 14: EntityRef: expecting ';'
I've tried this in fresh Xcode projects that are still unscathed, yet i always get this error and its holding me back quite a lot. When i click 'LaunchScreen.xib' i get the same error.
Thanks in advance for any help that may solve my problem.
P.S this is the newest Xcode 6 beta.
All you have to do is rename your project without "!,#£$%^&*" or something like that
What fixed it for me was removing the "&" character from the Organization Name.
Select the Project in the Project Navigator
On the right hand side pane (the File Inspector), under Project Document remove any special characters from the Organization Name.
I guess the character was not escaped right in the Launch Screen template.
In the case of me, an invalid character was included in a value of text in the label tag in the "LaunchScreen.xib" file.
Probably the user name that started xcode
Delete the "LaunchScreen.xib" from your project and you are good to go.
After cleaning everything in Xcode to Submit my app to iTunes Connect, I've reached an error that I cannot find an answer for.
The full error is:
Unable to Parse application Info.plist for validation. Please make
sure your Info.plist contains no embeddedcontrol characters, is del
formed, and is encoded in a UTF-8 compatible encoding.
Im creating the project with UNITY 3D, and everything works okay on my iPod and iPhone, but after I build it to archive and submit either from Organizer or Application Loader I get this error.
Can someone please Help??
I had this error, and it turned out to be an inadvertent space in one of the fields. But the key to resolving these errors is to view the info.plist file in a text editor. By careful examination, you are likely to be able to find the non-conforming character/field.
It's probably a BOM character or something else you can't see.
Try converting the document to UTF-8 without BOM
Also, make sure your line endings are all \n (LF) and not \r\n (CRLF). That should fix it.
I'm not sure what text-editors you have, but you can do this with TextWrangler which is Free.
Another possibility is that you have some other special character (like an & or < or >) that it doesn't like, but I'd suspect this isn't the case.
Try opening your Info.plist in a plain text editor and look for characters that may be out of place. If you have other similar apps, you can compare both plain text .plist files which may lead you to the problem.
Oddly enough, I had a project which exhibited this very error and in my case, swapping "Icon Files (iOS 5)" for the predecessor "Icon Files" made the difference. Remember that the older Icon Files requires the icons to be of the standard naming conventions: Icon.png, Icon#2x.png, Icon-72.png, Icon-72#2x.png, etc.
I can't explain why this change produces the different results which leaves me to believe its a bug in Apple app validation.