[英]Swift 3 (Xcode 8 beta 6) localizedStringWithFormat
是否有更好的方法来获取本地化格式并使用Xcode 8 Swift 3替换字符串? 我是否需要使用NSString,并在NSString和String之间来回转换?
let localizedDue = NSString.localizedStringWithFormat(NSLocalizedString("Due: %@", comment: "due date label with date") as NSString, formattedDate) as String
我可能会遗漏一些东西,但在Swift 3中, String
有一个类型方法localizedStringWithFormat
,你可以写这样的东西:
let localizedDue = String.localizedStringWithFormat(NSLocalizedString("Due: %@", comment: "due date label with date"), formattedDate)
如果这不是您所寻求的,请更新您的帖子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.