Steps for internationalisation in Xcode - iphone

I've been trying to add a Portuguese translation to my app. At the moment it's all in English. (well, it started that way).
I'm using a Storyboard for the main part of the UI. There are also a couple of additional xib files for reusable UI in table etc...
Anyway, I set out on the path of trying to internationalise the app and managed to convert the Storyboard to Portuguese.
I then tried to set up some strings (just a couple to begin with) to make translations of those also.
I've now got an storyboard that's only in Portuguese (I lost the English version) and none of the strings are being translated properly anyway.
I've set all the string back to just use #"blah" now (I'd put NSLocalizedString in a couple of places).
So I should be back to square one (once I fix the storyboard).
Anyway, is there a list of steps somewhere of how to go about making an app localised?
Any help appreciated.

There are couple of tutorials available - this is one of the good ones: http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
This will definitely help you to get started real quick!
However, if you are on iOS6 xCode 4.5 you should also check the new features regarding localization. Apple now has also gon the route to have just one XIB (not like before multiple XIBs, one per language - which was impossible to maintain)
Probably the most important point is to always use NSLocalizedString, so there is no need for multiple XIBs. And then it's real easy to just add a new strings file for each language.
All you have to do then is in the Project Editor select your project -> select the Info tab on the right -> scroll all the way down -> there you find the localizations, press the little + on the buttom to add a new language. That's it.

Related

Xcode 4.2 is missing a .xib file?

So I'm pretty new to programming, so I downloaded Xcode 4.2 and got to work. I watched many online tutorials and the main problem I was having was that all the tutorials were for Xcode 4 and not 4.2, meaning when you chose empty application setting, it was missing the .xib file. So I found a tutorial on how to create a .xib file. I got through it all except for one step, and that was to drag the from the window outlet of the xAppdelegate to the window. I've tried this over and over, but it doesn't work.
Here is the tutorial if anyone needs to see it http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
Please someone help me!
You need to hold Ctrl while dragging, else it will not work.
Guide.
As you Control-drag from an object to your source code, Interface Builder indicates where a new binding is valid. After you’ve made the connection, Xcode displays a dialog you use to configure the binding. You can use the dialog to configure all aspects of the binding.
Interface Builder uses the Xcode index to determine which key paths are valid, and can also discover what controller it should connect through—you can therefore connect from a user interface element such as a table column to a property in a model class header.
Check out the video here.
You should choose a SingleViewBased Application instead of Empty Application then study all files that how they connect with each other. You can choose Master Application also. They will help you.
see this Hello world Tutorial click me.
And Youtube is the best way to learning for beginners. Search tutorial video because action teach more than the text.

Cannot find window-based application on XCode

I am using XCode 4.2 and for some reason I cannot find the template for window-based application. Is there an extra step that I need to take here?
There is no longer a Window-based Application template starting from Xcode 4.2.
You have two other choices of "bare-bones" templates:
View-based Application template, which gives you a view on a storyboard to start with. It is similar to the one found in previous versions, except the view now resides on a storyboard which Xcode 4.2 makes use of.
Empty Application template, but you'll have to manually create and wire up a window nib file if you want to design your application in Interface Builder. It's nothing more than a trivial extra step, though.
If you can't make use of storyboards (e.g. to deploy to iOS 4 and earlier), you most likely need to go with the empty template. For the main window, just make a new Interface Builder file and assign it as your project target's Main Window.
Here are two very useful links:
The first one is a discussion on the Big Nerd Ranch forum where they discuss this issue - that the XCode 4.2 has done away with the Windows-template. They have a Template that you can use to add the "Windows-template" to your XCode installation. I have NOT tried this approach but you can try.
http://forums.bignerdranch.com/viewtopic.php?f=73&t=3336
As you dig through this thread - you will come on another site. This a blog post by Jeroen Trappers - on how to "manually" add the missing elements to an "Empty-application" template to make it "Window-template". I have followed these steps and they worked very well for me. In the process of going through these steps it does help you understand what is going on behind the scenes.Here is the URL to the post:
http://www.trappers.tk/site/2011/06/16/mainwindow-xib/
Window-based Application is now Empty Application. Just gives you an app delegate and a window. You build the rest.

iphone: How do I make my app support two or more languages?

I have my app with english version. I want it to run with french text also.
What steps I need to perform? or what API or extra code I will need?
Any examples or tutorial will help me more.
You need to add localizable strings for all the languages. And also you need to add the .lproj along with the localized file for each language you want to provide the support for.
Hope this helps you.
EDIT:
I have some of these links useful for you.
http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/
http://adeem.me/blog/2009/05/09/tutorial-iphone-localization-in-xib-nib-files/
How simplify iPhone localization?
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
I feel the last one which is from http://www.raywenderlich.com is the best one I would recommend.
Hope this helps you.
Thanks
The tutorials are good for starters but you should consider following points before you start:
"normal" localization where you localize XIB files is not really recommendable when the XIB might change, since you have to maintain multiple XIB files (for each language there will be a standalone XIB) Honestly this becomes a pain after a while
Therefore I suggest (even though it is more work at the beginning) to set the labels and button titles programmatically:
mylabel.text = NSLocalizedString(#"text:", #"text:");
[mybtn setTitle: NSLocalizedString(#"textbtn", #"textbtn") forState:UIControlStateNormal];
Then use: genstrings -o en.lproj *.m to create the strings file which will look for all those NSLocalizedString and create a file Localizable.strings in the folder en.lproj
If you follow this advice it will make live easier for you in the future - though it's not really 100% comfortable yet. If you need to add a new NSLocalizedString (eg because you have a new label) you need to create a completely new file Localizable.strings. Make sure you have a backup copy of this file where you have the translation, otherwise it gets overwritten and lost. I haven't yet come accross a good solution how to build up the strings to be translated...
ps there is no need to add localized XIB files anymore.. otherwise you end up having multiple XIB files which one wants to avoid in the first place...

Localized XIB not showing all IBActions, outlet & images

i m getting a problem with my localized xib.
I have created english version xib first, then made them localized, & added other localization.
it works fine in app also.
But when i open other language xib with IB, i m unable to get all outlets & IBActions.
It seems like it is taking only those one that were present when i created the localized file, & not showing newly added one.
Does file not getting updated?
Note : My other team member done the same thing & they don't have problem.
i also tried to removed & created all new localized file then also no change.
I m unable to identify the problem, i m stuck on this problem & cannot proceed with further development.
Please help .. :(
If you have Xibs in different languages, they don't get updated automatically when you change the English one.
Instead, you should either merge the new changes using ibtool (type man ibtool in Terminal to learn its options), or use a dedicated application like iLocalize.
In general, it can be quite an issue to update all the localizations all the time and sometimes large changes can't be merged well automatically. You need to be careful about that.

In-app settings controlled by plist?

Is there a library or good tutorial which covers creating in-app settings, like this:
http://img.skitch.com/20090625-s8bf6ahybwe3cesd1id38h3nt.jpg
What I would like is if it:
doesn't use the built-in Settings app, and does not replicate it's settings in the Settings app
is controlled by a plist file with various Dictionaries and Arrays
creates a nice looking table view
allows edit-in-place text fields as well as switches and sliders and ticks etc
doesn't have any of the annoying problems I've come across when trying to build my own version (not scrolling to show the textfield, cells disappearing)
JUST TO EMPHASIZE: I DO NOT WANT THE SETTINGS TO APPEAR IN THE SETTINGS APP.
It would appear that the iphone dev world is crying out for such a thing.
THANK YOU!
InAppSettingsKit
I've used the open source project InAppSettings, and it works well.