English localized files doesn't load - iphone

Localizable.strings for english language didn't load. It previously worked but not only I can see are the keys of the strings. On the other hand Czech strings are loaded fine. I am also aware there at least two threads about this topic, however, they didn't help me.
Summary:
I have two localized strings in cs.lproj and en.proj directories
Only Czech one is loaded.
The English one was previously loaded too but now only I can see are just keys.
I have tried to clean my project.
I have tried to uninstall an app from device.
I have tried to save Localized.strings as UTF-8 as well as UTF-16 as recommended.
I have tried points 4-6 at once.

The solution: My project contained another Localizable.strings file for english language. It was inside ShareKit library. I didn't know it as I took this project over previous programmer. So I removed the file, now it works fine. Sorry for bothering you. May it can help someone other - simply search your project for Localizable.strings duplicates.

You should look inside the app package to see if your Localizable.strings file is included. To do this, right click on YourApp.app -> Show Package Contents. Look for the en.lproj folder and see if the Localizable.strings file is there. If it is, then check that its content is correct.
Otherwise, there might either be an error in the english translation file, or XCode is acting up (I had this problem a few times - doing a clean build, restarting XCode and them a new build seemed to fix it).

Related

Xcode Localization is driving me nuts! Not loading Storyboard

It's been 2 days this issue is driving me nuts.
I'm trying to localize my iOS app but for the life of me I can't get it to work. It works easy enough when I try on a blank project but not on my current project.
I've added the languages in the Localizations using "+", I've localized the storyboard but when I check on simulator or device I still see the english version. And in fact it's not even the English one because if I change the Maintsoryboard (english) I don't see the changes in the device ... I still see the initial texts.
I've tried reseting the simulator, deleted the app, etc. No luck.
I've reverted to a backup tried adding everything again. No luck.
Can someone please help? I know it's not much to go on, but I don't know what to explain to help you help me. So please let me know if I'm missing some info.
FYI, when I look into the app's folder in Developer, I initially don't have a en.lproj when it seems I should have one by default?
It looks like you already figured this out, but I think what probably happened is that originally you had "MainStoryboard.storyboard" as an unlocalized resource. This means that when you build your app, you get a "MainStoryboard.storyboardc" as an unlocalized resource. When you change your storyboard to be localized, you get a "Base.lproj/MainStoryboard.storyboardc" in your bundle resources.
There are several copies of your app when you're building in Xcode. There's the copy on your device or in the simulator, and there's also a copy in your derived data folder in Xcode. When you do an incremental build of your application, the copy in the derived data folder in Xcode is a merge of your new content and your old content. So, when you modify a resource in Xcode, and rebuild, you get the newest resource. However when you rename or delete resources, the old copy is still left in the build directory until you perform a clean operation.
This means that your build product probably had both "MainStoryboard.storyboardc" and "Base.lproj/MainStoryboard.storyboardc". When NSBundle loads resources, it prefers unlocalized content, and would load the old "MainStoryboard.storyboardc".
Be absolutely sure you don't have typos in Main.strings file, e.g. double quotes and semicolons. If you have any typos, device simply ignores localized strings and applies base internationalization.
Blind shot: check that the strings file is UTF-16 (little endian if I remember correctly) and it doesn't have syntax errors (missing ; or quote). Also run a project clean before building after changes in strings files.
Try selecting all of the various .strings, .xib, and .storyboard files that are being localized.
In the File Inspector, make sure that all of the needed localizations are checked for each file.
After adding localization, English was unchecked on several files. Some views were thus localizing into unintended languages. Checking English fixed the problem.
What I faced is only typo error like
"zu0-GQ-ymP.text" = "Meeting End Time;
just make sure and check each strings in Main.strings must be like below
"zu0-GQ-ymP.text" = "Meeting End Time";
Hint : if it is typo error it will not work in particular localization.
this is true - AyAz, thanks! It should be noted, XCode will not always fail to compile if some issues in the strings file (esp for localized Storyboard). you can quickly check the syntax-coloring on the file in xcode or run a strings linter on the strings files to ensure no typos -- in my case it was failing due to a double-quote symbol, which is used in the target localized language as part of their normal alphabet. XCode continued on without warnings/errors, but the screen kept showing English...

When I change Localizable.strings (en) another Localizable.strings (ru) changes too

I was trying to add multi languages (en, ru) support to my iOS project. I used tutorials for this issue:
http://www.ibabbleon.com/iphone_app_localization.html
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
So I have to files localizable.strings in different folders.
But when I change Localizable.strings (en.lproj) in project, Localizable.strings (ru.lproj) changes too. So they are the same. I can't understand WHY???
The locations and full paths which are displayed in xcode are correct. It seems that changes the same file. Because when I save Localizable.strings in xcode, in finder I see that one file is changed.
What's the problem??? What do I wrong??? Could you help me?
P.S. Even I rename files to different names, problem the same.
P.P.S. As an example I used project "ILikeIt". And even I open this project and look at Localizable.strings (in this project) I see Localizable.strings from my project. It seems very weird.
Thanks in advance.
Maybe you got confused with the file name. It is Localizable.strings
not Localization.strings.
Or perhaps you created aliases instead of copies when you first duplicated the original Localizable.strings file?

Localizing iphone app html files and strange xcode 4.2 warnings

I've got an App that I am trying to localize for several languages. I'm doing most of the localization through .strings files, but for the larger help files, I need localized versions of html files.
I've read Apple's documentation as well as doing many searches on Google, and I think I am doing things correctly.
In my xcode project directory, I have an "en.lproj" and a "ja.lproj" (Japanese). I put versions of my HTML help file in each directory, and I import these into my Resources group in xcode. After doing so, the files seem to show up correctly. I see a "help.html" file under Resources, and it is a "group" and if I look inside it I see:
help.html (english)
help.html (japanese)
When I build my App, my App seems to correctly contain the two versions of the files under their appropriate .lproj directories, and everything is working correctly when I run the App (I see English documentation when settings are English, and Japanese when settings are Japanese).
However, when I build my project, I get annoying warnings from xcode 4.2:
Warning: Multiple build commands for output file .../ja.lproj/StartQuizController.html
Warning: Multiple build commands for output file .../en.lproj/StartQuizController.html
From what I understand, these "multiple build command" messages occur when there are conflicting filenames that are being added to your App. However, since these files are localized and exist in their own subdirectories, there is no real conflict.
Am I doing something wrong, or are the warnings a bug in xcode 4.2?
Thanks,
Ron
I think you can prevent these warnings if you do it the Xcode way.
Xcode uses only one copy command to copy the localized files, you have probably two separate commands.
You could try to delete the files form the "copy bundle resources" build phase first.
Delete the copy command for the localized files and add a new one. If Xcode treats your localized files right it should show a single file instead of a file for each localization in the "Choose items to add"-Picker.
If that doesn't work just remove them completely and add the physical files again.
Backup all your html files. Then delete them from the project (both logical and physical).
Add the English version of the file to Xcode, let Xcode copy it to your directory.
Select file in left sidebar
Open first tab of the right sidebar
add localizations by using the + button in the localization section
either replace the content of the file trough Xcode or use Finder to replace the localized versions.
I´m trying to localize my project as well. I always add a in-App user´s manual in a html file wich gets loaded on a UIWebView.
I haven´t done it yet, but what I´m going to do is to create different files for each language, say for example:
info_en.html // for english
info_es.html // for spanish
info_ca.html // for catalan
then when the webView gets loaded, instead of loading the #"info_en.html" file, I will load the NSLocalizedString(#"info", nil); Then, in each localized string file, the name for the html file will match the language.
I believe this should help but, again, I haven´t tried myself yet.

Creating Localization Files for iOS

I would like to localize one of my apps. But I just CANNOT seem to figure it out. I have tried to read apple's docs, and I have looked at a bunch of tutorials that I found by searching. I understand how to change all my strings to NSLocalizedStrings, and how to edit those localized files one there created, but my problem is I can't figure out how to create those directories in the first place.
How do you make those folders en.lproj and a spanish one. Also, how do you make the two string files that go inside them.
Step by step help would be greatly appreciated, or a link to a detailed tutorial on this part.
Thanks in advance.
Note: I've made countless attempts and an simply stuck.
you are nearly done with doing NSLocalizedStrings. You open up terminal.app and change the dir to your project by changing dir. Type in cd and drop in your project folder. Then tipe in: genstrings ./Classes/*.mthis will create a file with all strings you entered. Look in your project folder for Localizable.strings and drag it into Xcode project. Uncheck the box that says "copy into destination group..." and change the text encoding to UTF-16! Then open the info window for that file and check "Make file localizable", switch to general tab and enter for ex: fr for the new localization and click add. Now you can change the localization to french, where it says fr (or whatever you have)
When selecting a file, in the Utility sidebar you will see the localization panel.
There you can add languages.
Note that in Xcode 4.4 and up you have to go to the Project Info and add all the languages there, you can't add languages from any file info

NSLocalizedString always fall back to english

I have a project with english and french translation. Everything used to work perfectly fine.
Now for some reason the language always fallback to english.
I tried to delete the English.lproj and French.lproj folders, regenerate them with genstrings : still same issue
I also tried to delete the app from the device, clean the target and deploy again, no results.
The language of the device didn't change since it has always been set to french.
P.S: My problem is very similar to this one, except that my project used to work fine :
iPhone: NSLocalizedString reading from English .strings file even when another lang is set
Does anybody have any idea of what i could do ?
Thanks for your help,
Vincent
There are several details that you need to follow, including where in the project you drag the localized files.
Have a look at this tutorial for a step-by-step explanation:
http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/