I build a project using XCode 4 and I was running on the simulator since now. I had noticed that the strings in System type "Edit" and "Save" buttons where in english, but everything in my simulator was set to french. I suspected a bug like the one I had in XCode 3.
But now I'm running on my pure french configured iPhone, and those buttons are still in english, and are not localised as in other apps I can use.
I noticed that in my info.plist, the "Localization native development region" was set to "en" by default. I've changed this to "Fr" or "France" in the drop down menu, but that does not chage anything.
How may I correct this to make those buttons show a localized title ?
I had basically the same question, but Black Frog's answer didn't really help me. I did some research and this is what I found out:
The localization is primarily based on the bundle. With info.plist you can add localizations that aren't in the bundle, but you can't remove localizations that are present in the bundle.
The preferred way to add a French localization in Xcode 4 is to do the following:
Open project in Xcode >= 4.0.2
Click on project file
Select item under Project title on the right
Check Localizations table.
Select the localization you want to duplicate (English)
Click + and select the language you want you're app to use (French)
If you don't wan't to support English there are two additional steps:
Select the localization you want to remove (English)
Click - and delete the files
Special thanks to Nekto who helped me figure this out.
You have to create localized version of your nib files. Or you can set the text of each button/label to a localized string in view load.
Related
I want to localize my app, and I add French and Spanish to the target properties other than English
But, those languages are not showing inside the file inspector to select. Only 'English' and Something called 'Base'.
Any Help?
If you go to the "Info" pane of your project, you'll see a panel that shows your Deployment Target, Configurations and also the current localizations that you support (including a checkmark for "Use Base Internationalization"). Base Internationalization, b.t.w., allows you to have a single storyboard file that has different string files populating the string fields in the storyboard. It works for iOS 6 and newer.
When you start, it might look like this:
Here I've added Hindi as a language possibility:
And when you're done, you have the checkbox to choose from:
You need to add in your Info Project the localizations (I can't add image sorry).
And next you need to create a new file in your project named "Localizable.strings" and Localize this file in your identity menu.
++
Just click on your project in "Info" panel , where you can see "Localizations" and add the languages you want.
My app is currently localized for English and Japanese, with seperate storyboards for each. I want to switch to base localization so that I only have to maintain a single storyboard. I've checked the "Use Base Internationalization" box in the project's info tab and chosen the English iPhone and iPad storyboards for the base.
I assume I should delete the Japanese iPhone and iPad storyboards I had previously used, but I don't see an option to delete them when right-clicking on their files in the file inspector. Should I delete these old storyboards, and, if so, how?
** Edit **
Changing the 'Main Interface' shown in the screenshot doesn't allow me to delete the Japanese storyboard. It's hard to tell which storyboard to select in the dropdown because its width is more narrow than the storyboard names, but that's a separate issue.
This tutorial drives you through the process step-by-step. This is how it worked for me:
Remove all localizations and leave only the base.
Ensure that the localized files were moved from the project directory (in Finder)
Add the localizations one-by-one
The localized strings are extracted from the storyboard only when the localization is created. The Tutorial above provides a script that can help you keeping the localized files up to date if the storyboard is changed.
In your case, you will have to merge the existing translations into the new files but I suppose it is not a huge deal compared to the gain with using a single file.
For reference, the process is described in this official tutorial too: http://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html
After cleaning and reloading, I was able to remove the Japanese storyboards by clicking on the - in the project settings:
I want to localize my iOS project in xcode4. In xcode4 this seems to be very simple. In the utility sidebar there is a localization panel where I can add languages.
Adding a language I get following structure:
I want to localize a button. So I open MainWindow.xib (German) and just edit the title of the button. But when I run my project on both device or simulator I always get the english version even if it is set to German.
Where is the problem? Any ideas?
Delete the app from the device or simulator. If you've launched it before you've added the localization there is still a MainWindow.xib in the root file structure of the project.
If you deploy from Xcode files are only added, never removed.
So you have three files now.
MainWindow.xib
de.lproj/MainWindow.xib
en.lproj/MainWindow.xib
And as long there is a file in the root folder iOS doesn't look into the language specific folders.
Go into settings on the iPhone or Simulator and change the International from English to German, then restart the app.
From what I can read I'm not the only having this problem; except this is just happening in my Settings.bundle in my app it's all fine…
My app is localized in English (primary) and French.
My Root.strings file isn't getting called in at all, for English and French. If I put my iPhone in French the Settings bundle will be defaulted to the title declared in my Root.plist. Now in whatever language my iPhone's set to (English or French), let's say I add a group entitled "hello" and set the corresponding string to "world" I'll just get "hello" as my "localized" string…
Thanks
I've been struggling with the same problem. Using version 5.0 of the iOS simulator and Xcode 4.2, the localizations don't appear to take effect when the Root.strings file is changed.
My setup has a Settings.bundle which contains a Root.plist and a directory for each language supported containing a Root.strings file:
Settings.bundle:
Root.plist
en.lproj:
Root.strings
fr.lproj:
Root.strings
This is pretty much the standard setup which Apple documentation suggests.
When simulator is using the english localization, I change the matching Root.strings file and recompile, the changes don't appear to take effect. But if I uninstall the app, clean the project, and then re-run, the localization takes effect. It seems like an Xcode or iOS Simulator bug.
My solution: uninstall the app from the simulator, then run it again from Xcode to see the changes.
I wonder if anyone has encountered the same problem and how they solve it.
I want to localize Default.png so I do the following steps which from what I understand should be the correct way (please correct me if I'm wrong).
Select Default.png in xcode
Command-I to Get Info
Click on Make File Localizable
Go back to General Tab (why Apple, why?)
Click on Add Localization
Enter es for Spanish according to this:
In finder I replace the Default.png in the es.lproj folder
I have tried in both the simulator and on an iPhone with changing the language between English and Spanish, but I only get the original file. Other localizations like app name and strings works just fine, but not this one...
I'm on xcode 3.2.3
Thanks
I'd thought I'd add the answer for localizing Launch.xib.
Create InfoPlist.strings file. (File,New,Resource,Strings)
Localize it and select your languages
For e.g. the Spanish version, add your launch screen key and name for the Spanish version of your Launch screen
"UILaunchStoryboardName" = "Launch_es";
Copy your existing Launch.xib to Launch_es.xib, and change the text and/or images to the Spanish translations or Spanish-named images.
I got this solution from Developers Forum (credit to Sascha Paulus, thanks Sascha!).
I had a similar problem in another project with localization, but the solution worked for both issues.
Here we go:
Delete App from Simulator (just to be sure)
Delete all versions of the localized Default.png (in XCode & on Disc)
Select Build > Clean All Targets
If not done yet, make the Localizion Directories (e.g. es.lproj, de.lproj)
Copy the localized Default.png in the appropriate Localizion Directory
Go To XCode > Right Mouse Click on Resources > Add > Existing File ...
Select the localized Default.png in the Localizion Directory
Don't forget to mark "Copy items into destination group's folder...." > Add
Repeat it with every localized Default.png
I think the trick is to delete the file you have a problem with, clean all and then add it again. If you don't have any localization there is no need to create a specific folder.
Give it a try, worked for me.
I have had the same problem. I have solved it with this:
In the Simulator, menu "simulator iOs", option "restart content and settings".
In Xcode, menu "Build", option "Clean All Targets"
And when I have selected the button "Build and run" it has worked.
Just to add that on a latest 4.3.3 every attempt to remove and re-add the files, and the clean all, nothing worked, but what solved everything was the remove-app-from-device-and-simulator and reinstall. Now every image and xib are translated correctly.