I have a problem with the localization of my app. I want to have french and english (default).
The localization seems to work with the Storyboard as text from there is translated to french (on simulator & iPhone in french). But the strings from Localizable.strings are not translated.
I checked the name of the file and it is correct "Localizable.strings". I validated the content of the files with "plutil -lint " and it was OK.
Checking the target->build phases->copy bundle resources: the Localizable.strings is there.
In the code I am using:
NSLocalizedString("KEY", comment: "")
Checking the NSLocale of the simulator, it seems as the preferred language is french, so I do not understand why it is not working.
Any idea?
Thanks,
Henry
You might be missing some settings in your scheme.
This tutorial on YouTube really helped me localize my last app. It's under 8 minutes. Hope it helps.
I fixed my issue. There was a mistake in my Localizable.strings. I had the following for one line:
"..."; = "...";
It would be good if there was a tool to validate this.
Thanks for the effort,
Bye
I faced same issue, but I found a mistake in Localizable.strings as user3900157.
I missed semicolon at the end. After added semicolon to all sentences, it worked.
Hope to help you.
I have got same issue in Xcode 12.5
My Issues: I worked with English and Arabic text. English text was working fine but not able to extract Arabic Text. Have tried all solutions.
My Solution 1:
Actually I had copied and pasted Arabic text from Google which caused issue in Xcode(Xcode was not able to read those texts.)
So I copied Arabic texts first in Notes App and then copied to Xcode.
My Solution 2:
I have tracked this issue after 4-5 afters.
I checked the texts which are working fine in Arabic and checked the last line from where texts are not working. So i found that Arabic text was pasted improperly. So I cut that text and copied to Notes App and copied from Notes App and pasted back to code.
And Boom It worked.
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.
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)
I've seen other threads about the simulator, but I'm experiencing a 90% break which is nothing short of miraculous.
Our app is localized in 5 languages. All of them work perfectly, except Danish.
Only certain words are translated, even though all of them use the shortcut "NSLocalizedString". Also, the BarButtonSystemItem "Back" and "Cancel" both work.
The symptoms are exactly the same in the simulator, device, iOS 7 & 8. I've also tried both "Danish" (da) and "Danish (Denmark)" (da-DK) in different combinations.
Is anybody else experiencing weird localization issues like this?
I knew it would be a stupid bug, but this one takes the prize.
In the danish Localizable.strings file, an EMPTY ROW had a SPACE CHARACTER in it.
I'm not kidding.
This made the app find all the translations up to the space character, then nothing after it... OMG what a stupid parsing error bug from Apple.
File a bug anyone? facepalm
Hi i dont seem to have a problem with doing localization it has worked fine in other apps, however this app is doing something quite funky.
It localizes fine to french , or other languages, but not the base language english in that regard the label is left empy any ideas why that could be the case?
Solved my own problem..lol
I had go to the main project window click on the minus sign remove english localization and then click + and add english , as it had not localized the storyboard for English, this i could see by how it had localized 2 files where the other languages had localized 3.
I have a problem with my Xcode, For example i'm gonna to NSLog #"سلام"; when i did writing it'll show NSLog #"مالس";. They are reveresed. I'm asking this for both Arabic and Persian!
tnx!
Actually its problem with Editor so change the Editor as in my case I opened file in TextEdit and wrote Arabic and Persian which worked correctly for me.