国际键盘定制?
在iphone sdk 3.0中,他们提供了国际键盘的选项。用户可以选择他想要的键盘。但我们如何本地化我们的应用程序。 例如,如果用户选择了法语键盘,我们应该用法语与他交互。像警报和其他东西应该以法语显示。
我们如何以编程方式做到这一点?他们有任何选项可以让我们将字符串从英语转换为用户选择的语言吗?
请帮助我
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看国际化编程主题在 iPhone 开发中心。
Have a look at the Internationalization Programming Topics on the iPhone Dev Center.
在 iOS 4.2 及更高版本中,您可以使用
UITextInputMode
类来确定当前用于文本输入的主要语言。[UITextInputMode currentInputMode].primaryLanguage
将为您提供一个表示 BCP 47 语言代码的NSString
,例如“es”、“en-US”或“fr-CA”。您可以注册
UITextInputCurrentInputModeDidChangeNotification
,以便在当前输入模式更改时收到警报。正如 Thomas Müller 所说,国际化编程主题是一个好的起点。
您可能还对“让您的应用程序为中国和其他热门新产品做好准备”感兴趣市场” WWDC 会议。
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 anNSString
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.
没有记录的方法可以知道键盘何时更改,也没有记录的方法来获取当前的键盘模式。
通过未记录 API,您可以监听
UIKeyboardCurrentInputModeDidChangeNotification
本地通知。当前的输入模式可以从
com.apple.Preferences
首选项中找到,使用(注意:要在模拟器上测试,您需要将
/var/mobile/
替换为/Users/<用户名>/Library/Application Support/iPhone Simulator//
。)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(Note: to test on simulator you need to replace
/var/mobile/
by/Users/<user-name>/Library/Application Support/iPhone Simulator/<sdk-version>/
.)