iOS Settings.bundle localization difficulties - iphone

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.

Related

iOS universal app localization xcode 4. bug?

well, i've just faced with localization problem on my projet and decided to make an experiment to reveal the problem:
experiment:
create universal iOS application;
change the text on main windows from "My Universal iPhone (iPad) App" to "Hello" both for MainWindow_iPhone.xib and MainWindow_iPad.xib files;
build and run app in iPhone and iPad simulators - both displaying "Hello" message - everything is fine;
add spanish localization for MainWindow_iPhone.xib and for MainWindow_iPad.xib (english localization was already there)
change the text on main windows from "Hello" to "Hola" both for spanish version of MainWindow_iPhone.xib and MainWindow_iPad.xib files;
change language in simulator to spanish;
build and run app in iPhone and iPad simulators - both still displaying "Hello" message - what?!?!?!
fix:
open project properties and go to "build phases" tab;
in "copy bundle resources" add xib files: locate MainWindow_iPhone.xib and MainWindow_iPad.xib files in es.lproj directory of project and add them
build and run app in iPhone and iPad simulators - both displaying "Hola" message - OK
well, what conclusion can i make? when adding new localization to xib file, xcode is forgetting to add this file to copy bundle resources target. so after running app on different localization (spanish in example) iOS can't find spanish localization (of course, Xcode forgot to copy it!!!) and load english version of xib.
manual adding localized versions of files makes mess in the project tree - added files will be displayed in project hierarchy, but they are already displayed when we expand xib file with localizations. (in example we will have MainWindow_iPhone.xib and MainWindow_iPad.xib in project structure tree, but at the same time they are available in iPhone and iPad file groups after expanding localized MainWindow_iPhone.xib or MainWindow_iPad.xib files)
or am i missing something cruicial?
If you manually add resources to Xcode, you'll often need to (K)lean your project to rebuild the links. Command-K should do the trick.
I can't remember having to do this in Xcode 3 and it may already be fixed in later version of Xcode 4.

iPhone - System strings not localized on device

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.

How to localize view in xcode4?

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.

Resource problem - Localization and iPhone/iPad XIBs all broken

I had a localized universal application. I copied a bunch of resources (XIB) files from an old project into the appropriate locations (English.lprog) directories for both iPhone (Filename~iPhone.xib) and iPad (Filename~iPad.xib). I added them to the project, and they all appear correctly in Xcode, as localizations, etc. I can open the localized files for each device in XCode/IB, and everything appears correct.
Now, when I run the project - everything is completely haywire. In short, when I run in English on the iPad simulator, I get the Chinese version of the iPhone XIBs!!!
I can't figure out what the problem is - any idea how to dig deeper?!
Few things fixed this:
Total clean build of project
Erase old application from device and/or simulator before reinstall.
Just because the icon in XCode looks like an IB icon, and double-clicking opens in IB, it still MUST have an ".xib" extension visible on the file.
Simulator is NOT case sensitive, but iPhone IS. This includes differences like MyClass~iphone.xib (works) vs. MyClass~iPhone.xib (doesn't work).
These steps have worked for me: In Xcode,
Check the location of folders for every language
Build > Clean all targets
Build > Compile
alt-R

How do I get Xcode to treat an Info.plist as an iPhone/iPad Info.plist?

I have two cocoa-touch apps in one Xcode project. Xcode gives me iPhone/iPad related options for keys in the first's Info.plist, such as "Launch Image (iPad)". But, Xcode gives me Mac OS X options for keys for the second, such as "Java classpaths" and "Quick Look preview height."
Here's how the project was built:
I created the new project as a Universal Window-based Application using Xcode, which came with a default Info.plist that translates raw plist keys like UIPrerenderedIcon to more human readable values like "Icon already includes gloss effects." All good.
In the same Xcode Project, I added a second target, also a Cocoa-Touch application, and built it from scratch, including the Info.plist file.
I've opened up the "Active Target" project settings for both apps and have exactly one "Setting Defined at This Level": Product Name. At the higher "Project Settings" level, no Product Name is defined and the Info.plist File is defined as ${EXECUTABLE_NAME}/${EXECUTABLE_NAME}-Info.plist. (Other settings, like Prefix Header, are similarly defined with variable substitution.)
Both apps build, run and use their respective Info.plist files appropriately, but Xcode still tries to give me Mac OS X Info.plist values when editing the second app's Info.plist.
How can I tell Xcode that the plist should be an iPad/iPhone Info.plist, not a Mac OS X Info.plist?
Try this: select/open the Info.plist in question, and then from the menu, do
View > Property List Type > iPhone Info.plist
for Xcode 5 there's no View -> Property List Type so the solution is to open the file, right click anywhere in it and right under Show Raw Keys/Values you'll find the Property List Type menu.
Happy coding,
Z.
I'm also curious about this. I ran into the same thing while upgrading an iPhone project for iPad, and after days of trying to figure it out, I just made a new project and reimported the custom classes. I upgraded the target and this time the keys were still for iOS.
My best guess is this is an XCode bug.