Within my iPhone application, I'd开发者_StackOverflow like to change the language of the displayed UIKeyboard. How can I do this?
From the iPhone Application Programming Guide:
Depending on the needs of your program and the user’s preferred language, the system might display one of several different keyboards. Although your application cannot control the user’s preferred language (and thus the keyboard’s input method), it can control attributes of the keyboard that indicate its intended use, such as the configuration of any special keys and its behaviors.
[...]
To facilitate the language preferences of different users, iPhone OS also supports different input methods and keyboard layouts for different languages, some of which are shown in Figure 5-4. The input method and layout for the keyboard is determined by the user’s language preferences.
So it appears there's no way to bring up a keyboard of a different language than the user's preference.
really cant do it programatically, the user must have that keyboard enabled and then they can get to it, you can maybe tell the user they require a non english keyboard in an alert view or something like that.
NSString *iso631Code = @"zh";
[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:iso631Code] forKey:@"AppleLanguages"];
gives me a Chinese (pinyin) keyboard (you can even dynamically switch between say @"zh", @"fr", @"en" without having to restart).
see also How to force NSLocalizedString to use a specific language
精彩评论