Translate (change) strings in Objective-C (specifically languages) - iphone

I have this game, that contains a lot of text as speech. I would like to give the users the option of changing the language of the game to their preferred tongue.. Can anyone point me to a resource or give me a starting point to achieve this? String look-up table perhaps?
Thanks,
Jack

See Localizing String Resources in Internationalization Programming Topics. iOS has a built-in system for this using NSLocalizedString() and related functions.
See also String Resources in the Resource Programming Guide.

NSLocalizedString is of use here. Here is a simple tutorial on localization.

Related

How to add an unsupported interface language to my iPhone app?

I have an iPhone app with interface languages in Toki Pona and Dothraki, which do not have ISO 639-3 codes. According to the ISO 639-3 standard, you can use the range qaa-qtz to represent languages for local use, which I have done (Toki Pona = qtp, Dothraki = qdt), but still get the warning from XCode "Unrecognized Locale".
It seems like I might be able to extend the main bundle class, but looking over the documentation, nothing seems to relate to adding non-ISO languages. I'm also aware of the text "If necessary, you can use a language or locale code that is not known to the NSBundle class or Core Foundation bundle functions. For example, you could create your own language designators for a language that is not yet listed in the ISO conventions or available as a language in Xcode." at the end of https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html
In any case, I mostly want to get rid of this warning. Any help would be greatly appreciated!
https://forums.swift.org/t/proposal-ns-locale-identifiers-etc-should-have-custom-types/9367/8
have a look at the above link.
Check if the languages are added as Localizations
I believe I have a solution however slightly complicated one. You would need to create a setting option within the app to use those made up languages and to load them manually from a file when a user sets them. For example, let's say your app consists of one label and the user sets the option to the made-up language you would call a method to set the language and the text on that label would update accordingly. I don't know whether this makes sense to you?? Basically, if the user uses the made-up languages that would override any system localization they have. It is doable it would just take time to implement it.

adding languages for localization to iPhone - is that possible?

Compared to Android iPhone does not support many languages, even though the MAC seems to do so ( simply because I learned that the possibility of adding these languages in xCode is for MAC Apps and not for iOS).
Now I added the Localizable.strings file for languages that are not available in the language list of the iPhone settings for languages.
Is there a way using the standard approach like:
[onOffSC setTitle:NSLocalizedString(#"On","Off") forSegmentAtIndex:0];
if I just put a selection menu in my app ?
Otherwise I would have to add a special logic - lets say MYNSLocalizedString, checking first if the user wants to select a non supported language, getting this some other way (probably putting these translations into a NSDictionary) and otherwise calling the standard NSLocalizedString.
I guess I would have to put a language selection menu in the app anyways - but can the calls to NSLocalizedString be used or do I have to add a meta-method MYNSLocalizedString like mentioned?
Or is there any other good solution for this ?
Many thanks!
I think better would be to use the language which is set in Settings, instead of user selecting from menu. Refer to this tutorial might help you understand How Localization is done.
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial
For localization of your iPhone app:
Use the approach described here...
http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial

App Localization in iOS4

I recall hearing that with the introduction of iOS 4.0, you no longer need to use the NSLocalizedString macro in order to localize strings within an application into different languages. However, I have been unable to find any information or documentation about the new method that can be used for localization. Am I dreaming, or have I missed something obvious? If there is a new method for localization, I would much appreciate it if someone could point me in the direction of some resources on the topic. Thanks in advance!
Looking through the documentation, I can't find any mention of a new method of localization.

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.

How can I retrieve random words from the iPhone's dictionary?

Is there a way to retrieve words randomly from the built in Dictionary through the SDK?
I can provide my own list of words but using the built in Dictionary allows for easy localization.
Unfortunately this is one of the areas of the iPhone that applications have no access to.
However there are a number of free dictionaries available that you could use as an alternative. It's easy enough to convert a text-based file into ansqlite database which then makes it super easy to pick words at random.
And yes, as you point out localization is a problem with this :(
No access is provided to the Spell Checker.
The iPhone checks for spelling in UITextField objects.
Create a UITextField as a user input area.
Declare your interface to conform to the protocol.
Add any other delegates and then utilize UITextChecker
It has stuff like availableLanguages, hasLearnedWord, learnWord, unlearnWord
It also has guessesForWordRange:inString:language that returns a list of words that are possible valid replacements for a misspelled word.
For more information check out the iPhone OS Reference Library on UITextChecker
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITextChecker_Class/Reference/Reference.html
DougPan
Lexicontext (my library) provides such functionality for English words, although not from the built-in dictionary, but from a WordNet instance that is built into it.