NSLocalizedString with variables Swift

后端 未结 5 1450
北海茫月
北海茫月 2020-12-30 00:17

I\'m trying to figure out how to use NSLocalizedString with variables.

For example, if I want to output \"by Peter and Larry\", in my Localizable.strings

5条回答
  •  有刺的猬
    2020-12-30 00:47

    yes, you should have "account.by_user" = "by %@ and %@"; and take this:

    let localizedString = NSLocalizedString("account.by_user", comment: "any comment")
    let wantedString = String(format: localizedString, "Peter","Larry")
    

提交回复
热议问题