MFMessageComposeViewController 中的界面语言
我正在尝试使用 MFMessageComposeViewController 从我的 iPhone 发送短信。它显示了一个带有填充字段的模式对话框。一切正常,但我想用俄语显示对话。 我想用俄语查看所有值(例如“新消息”、“发送”等)。
我检查了默认语言:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Current language: %@", currentLanguage);
它返回,该语言是 ru-RU。
如何为此对话框设置语言?
I'm trying to send sms from my iphone using MFMessageComposeViewController. It shows a modal dialog with filled fields. everything work, but I want to show dialog in Russian Language.
I want to see all values (such as "New message", "send", etc) in Russian.
I'v checked default language:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Current language: %@", currentLanguage);
And it returns, that language is ru-RU.
How can I set a lang for this dialog?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将您的应用程序本地化为俄语,以便它显示您要求的本地化控件。
您需要做的就是将 ru.lproj 文件夹添加到您的项目中(如果您的应用程序需要,您可以在此处包含 Localized.strings 文件),让 Xcode 知道您正在积极支持该语言。
对于添加为 language-code.lproj 的每种语言,如果在设备上设置为本地语言,则每个本机控件(MFMessageComposeViewController、MFMailComposeViewController)都应考虑使用该语言。
You need to localize your app for Russian in order for it to show the localized controls you ask for.
All you should need to do is add a ru.lproj folder to your project (you could include here a Localizable.strings file if needed by your app) to let know Xcode that you are actively supporting that language.
For every language you add as language-code.lproj, every native control (MFMessageComposeViewController, MFMailComposeViewController) should consider using that language if set as local on the device.