How to provide easy multilanguage text in iphone app? - iphone

I have some short text that I want to ship in the currently active language. What's the most easy way to do it? Example: I have the text "the cat", but when someone from spain uses the app, he/she wants to read "el gato". Is there a standard way to do it easily with UIKit? They're pretty simple texts only. I can imagine some kind of property list and feeding it with a key and locale, and getting the appropriate text snippet out of there.

Check out NSLocalizedString.

Related

Best way to implement RTL in Swift?

I want to present my app in Arabic RTL language when user clicks on the Arabic in the language selector inside the app(default language is English). I have referred lot things, still I am unable to get perfect output. Anyone, please suggest me an best way to do this.

Localization issue in iphone

I need to make an application in which the user can toggle between two languages on triggering a click event on a button.
The problem here is that I have seen examples in which, if we want to load our localized nib file, then we need to change the language from the settings options and we can get the proper nib file loaded according to language selected.
I want to do this within my application, meaning I don't want to go to the settings menu and change the language and then reload the application.
I just want the above effect within my application (that is, through a button click event the app should be able to toggle between two languages).
Is it possible, and does Apple allow it?
Nobody here can tell you whether Apple will allow it, but if your app is well designed and there's a good reason for this departure from the usual way of doing things, you've probably got a good shot.
There's nothing to prevent you from loading a nib file localized for a different region. I'd probably avoid trying to use Apple's automatic mechanism, though. Just name your nib files using some pattern and load the appropriate one.
If you want your life to easy, you will take advantage of the Localization built into the operating system. Otherwise, you will have write your own methods to load localized strings or nib files.
There is no reason for Apple to reject an app that shows localized text based on an in-app setting. I work to help developers localize apps and, although I don't suggest this approach, they have done it and I've never heard of a rejection from Apple.
What you won't be able to do is use Apple's built-in tools, which rely on the system settings to determine a user's language and push the text from a Localizable.strings file. But it honestly won't take you too long to implement a similar system yourself using functions akin to gettext.
You essentially need to implement the same basic logic as any localization system:
1) Surround your in-app texts in a function that will display the proper language based on the user's chosen settings
2) Export your source texts (probably English into file
3) Translate the English strings into each language in a separate file
The function you write can follow the lines of gettext, which has examples in many programming languages. If the settings is "French" grab the equivalent string from the French file. If the setting is English, just print the English.
You won't be able to use Apple's tools, but you CAN do it on your own and Apple won't really care as far as I know. However, if you choose to localize into an Apple-supported language, follow this app localization tutorial for iOS using the standard Localizable.strings method.

How to change all the strings in an iphone application with respective selected language in settings?

I need help from you, I need to display all the text, labels , strings and what ever text is showing to user in the iphone application with respective selected language in settings of iphone.
for example user selects German or French in settings of iPhone language, then my application should provide or view the details in that language.
I need sample code for localization, Is there any simple way to follow the standard steps to translate the code to different languages in iphone sdk.
please healp me, I hope that I can get efficient solution on this from you.
Thank you,
Madan Mohan.
See here: http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/
I think the previous link gives a pretty good idea of how to do I18N on the iPhone, but if you feel you need more info, you can try this article http://blog.federicomestrone.com/2010/05/18/internationalise-your-iphone-apps-with-xcode/ which is just slightly more code-orientated.
The point though is always the same - you have to separate code from text resources and load all your text (strings) with the NSLocalizedString macro, or a variant thereof.

iphone how to localize only particular parts of app

i'm making a korean/english app, so naturally i would need both english and korean displayed on the same tableview cell at the same time. i've considered specifying an element in the plist to be a particular language... but how would i write in korean characters?
i have a dreadful feeling there will be much to custom code for this without apple's wonderful documentation. thanks for any guidance in advance.
Holy monkey. Turns out I thought it was way more difficult than it is, and I skipped even testing the most basic ways of doing it. All you have to do is basically copy and paste the foreign characters into the plist... That's it. Nothing else. Face in hand and lesson learnt.

How to handle localization of controller names?

I run a site where it is important to have good and simple URLs that need to be localized.
Example for the english version:
example.com/car/?type=fiat
Example for the Swedish version:
example.se/bil/?typ=fiat (bil is car in swedish)
And ofcourse I would like to handle all of these URLs from the same codebase. What is the best way to handle this?
Should I set up several controllers (CarController, BilController) or is there a "cleaner" way to handle localized controller names?
BR
Niklas
Don't do that. Ever.
Microsoft, a really big, powerful and resourceful company tried that with Excel. In English versions of Excel, you use IF() in formulas. In the German version, it's WENN(). In French, it's QUAND(), I think. In Japan, it's probably ば(). Now imagine someone from Japan sends me an Excel sheet ... There are two options:
"I'm sorry, I can't open this file"
Translate all names on the fly
Doing #2 seems simple enough ... until you run into a word which uses the same letters but has a different meaning in two languages. Example "see". Means "look" in English and "lake" in German. Since you don't know all the languages in the world, you have no chance to figure out which collisions you will have before it is too late.
Also, how do you know which name to use? From the language in the browser? Or do you hate your international customers who occasionally use the Swedish main site? How do you handle Asian languages? Will the URL be server/%E6%AC%80%E6/?%AD%81%E6%AB=fiat?
Don't. Do. That. Ever.
What about rewriting the URL depending on the domain? This way, the Zend framework will get only the English names, while the URL can use localized names.