swift - iWatch 中的 NSLocalizedString

标签 swift xcode8 watchos-2

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

最佳答案

我解决了问题:

选择 localized.string 文件,然后在文件检查器>目标成员资格中勾选“监视扩展”。

关于swift - iWatch 中的 NSLocalizedString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42240111/

相关文章:

swift - AppleWatch 语音转文本功能不起作用

Swift:内存压力事件 2 vm 0

xcode - 视频播放结束后如何返回到 tvOS 中的 Main.storyboard?

ios - Xcode 8 中奇怪的终端消息

ios - Xcode 具有冲突的配置设置

ios - 在同一个项目中使用 Alamofire 和 AlamofireImage

ios - 如何在 Swift 4 中向 UIView 添加 subview ?

ios - 使 CMTime 具有很小的值

ios - 如何在 UInt8 数组中存储负数

parse-platform - 如何在 watchOS 2 应用程序 Xcode 7 beta 5 中使用 Parse