views:

152

answers:

2

Hi,

My question is related to the following question, and can be said almost same.

http://stackoverflow.com/questions/330542/setting-the-iphone-keyboard-language

But here are my requirement. I am writing dictionary app for IPhone, which support multiple languages. So my requirement is to display the English keyboard when user has selected English language and show Dutch keyboard when user has selected Dutch and so on.

So i was wondering if this is possible?

I have a hunch that if i "internationalize" the nib, it will display the respective keyboard but not sure.

Thanks.

A: 

This article explains what developers need to do in order to create an internationalized app using localized strings http://www.iphonesdkarticles.com/2008/11/localizing-iphone-apps.html

Basically you create the localized strings for the languages you want to support:

//Localizable.String file for the English version.
"WelcomeKey" = "Welcome!!!";
//Localizable.strings file for the Italian version.
"WelcomeKey" = "Benvenuto!!!";

Then use them in the app:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];

NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Current language: %@", currentLanguage);
NSLog(@"Welcome Text: %@", NSLocalizedString(@"WelcomeKey", @""));

// Override point for customization after application launch
[window makeKeyAndVisible];
}

Users can change the language for the keyboard in the settings on the iphone Settings->General->International

ghostsource
It doesn't solve the problem. First, it is not thing that user can switch easily like for dictionary. Secondly, it doesn't change your keyboard
vodkhang
Well the problem is about keyboard, not localization.
itsaboutcode
+1  A: 

Unfortunately, you cannot control the language of the keyboard. The user chooses which keyboards they would like available via the settings application and can toggle between them using the globe icon on the keyboard. When the keyboard is opened it will open to the most recently used keyboard.

dgrijalva