Localize-Swift icon indicating copy to clipboard operation
Localize-Swift copied to clipboard

String with variable

Open Jkurbs opened this issue 9 years ago • 3 comments

Hi Roy :)

How can I localized this?

let name = NSUserDefaults.standardUserDefaults().valueForKey("name") as! String searchBar.placeholder = "Hey, \(name) how can we help you?"

the name change depend on which user is currently logged in. Btw thank you very much!

Jkurbs avatar Jun 25 '16 22:06 Jkurbs

You could do something like this

"nsls_string".localizedFormat(name)

And in localizable.strings: "nsls_string"="Hey, %@ how can we help you?";

piv199 avatar Jun 28 '16 18:06 piv199

plz add to Readme

amitpdev avatar Jun 20 '17 14:06 amitpdev

I just ran into this problem! Thanks @piv199 that worked!

RamblinWreck77 avatar Jan 21 '18 21:01 RamblinWreck77