我在常量类中有这个静态让:

struct Constants {
   struct AlertsIdentifiers {
     static let SERVER_RESTART_MESSAGE = """
     The camera will restart now.
     Please reconnect after two minutes.
    """
   }
  }

我开始本地化该应用程序。
我如何本地化这种字符串?

在我的localize.string文件中使用以下代码:
"The camera will restart now.Please reconnect after two minutes." = "The camera will restart now.Please reconnect after two minutes.";

最佳答案

你可以试试

static let SERVER_RESTART_MESSAGE =  NSLocalizedString("camReConnect", comment: "")
"camReConnect" = "The camera will restart now. \n Please reconnect after two minutes.";

最好在缩短密钥长度的同时使其可读

关于ios - iOS-本地化静态常量,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53914943/

10-12 00:29