in iphone sdk 3.0 they have given option of international keyboards.user can choose the keyboard that he want. but how can we localize our application. for e.g if user have chosen a French language keyboard we should interact with him in french. like alerts and other things should get display in french language.
how can we do this programatically?Is their any option by which we can convert string from english to user's chosen language?
kindly help me
In iOS 4.2 and later, you can use the UITextInputMode
class to determine the primary language currently being used for text input.
[UITextInputMode currentInputMode].primaryLanguage
will give you an NSString
representing the BCP 47 language code such as “es”, “en-US”, or “fr-CA”.
You can register for the UITextInputCurrentInputModeDidChangeNotification
to be alerted when the current input mode changes.
As Thomas Müller said, Internationalization Programming Topics is a good place to start.
You might also be interested in the "Getting Your Apps Ready for China and other Hot New Markets" WWDC session.
Have a look at the Internationalization Programming Topics on the iPhone Dev Center.
There is no documented way to know when keyboard changes, nor a documented way to get the current keyboard mode.
With undocumented APIs, you can listen to the UIKeyboardCurrentInputModeDidChangeNotification
local notification.
The current input mode can be found from the com.apple.Preferences
preferences, using
return CFPreferencesCopyAppValue(CFSTR("KeyboardLastUsed"),
CFSTR("/var/mobile/Library/Preferences/com.apple.Preferences"));
(Note: to test on simulator you need to replace /var/mobile/
by /Users/<user-name>/Library/Application Support/iPhone Simulator/<sdk-version>/
.)
来源:https://stackoverflow.com/questions/2995717/international-keyboard-customized