Swift NSLocalizedString在iWatch中的应用
我在iWatch中将我的应用程序本地化为两种语言。除了在“复杂度”和“警报”对话框中,大多数文本都会本地化 有人能帮我吗 警报代码Swift NSLocalizedString在iWatch中的应用,swift,xcode8,watchos-2,Swift,Xcode8,Watchos 2,我在iWatch中将我的应用程序本地化为两种语言。除了在“复杂度”和“警报”对话框中,大多数文本都会本地化 有人能帮我吗 警报代码 let restartAction = WKAlertAction(title: NSLocalizedString("OK", comment: ""), style: .destructive, handler: { //some code here }) let cancelAction = WKAlertAction
let restartAction = WKAlertAction(title: NSLocalizedString("OK", comment: ""), style: .destructive, handler: {
//some code here
})
let cancelAction = WKAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: {})
presentAlert(withTitle: NSLocalizedString("Restart the page?", comment: ""), message: "", preferredStyle: .alert, actions: [restartAction, cancelAction])
我要解决这个问题:
选择localizable.string文件,并在“文件检查器”>“目标成员资格”中对Watch Extension打上复选标记。您尝试了什么?您看过哪些apple本地化文档?我使用此函数进行本地化:NSLocalizedString(“页面”,注释:”)您是否将文本添加到您的
可本地化.strings
文件中?是的,我添加了。我在WKInterfaceButton和Alert中使用了相同的文本,在WKInterfaceButton中使用了本地化,但在Alert中没有。