iWatch 中的 NSLocalizedString

NSLocalizedString in iWatch

我将我的应用程序本地化为 iWatch 中的两种语言。除了“复杂功能”和“警报”对话框外,大部分文本都已本地化。

谁能帮帮我?

警报代码

    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])

我解决的问题:

select localizable.string 文件并在文件检查器>Target Membership 中勾选 Watch Extension。