I wan't to customize the font of my strings for exemple I have 2 languages:
"Hello how are you $name ?"
"Bonjour comment vas tu $prenom ?"
Here for exemple I wan't to make :
- "Hello" and "Bonjour" in bold;
- "how" and "comment" in a custom font;
- "are you" and "vas tu" in red;
- and have a parameter to get name.
It is possible to do it in swift? I have created one of the file:
I tried to put HTML entities:
How I call it:
let gotham = [ NSAttributedStringKey.font: UIFont(name: "gotham-book", size: 18.0)! ]
let gothamBold = [ NSAttributedStringKey.font: UIFont(name: "gotham-bold", size: 18.0)! ]
let gothamOrange = [NSAttributedStringKey.foregroundColor: UIColor.orange, NSAttributedStringKey.font: UIFont(name: "gotham-book", size: 18.0)!]
let accueilTopTextL1 = NSMutableAttributedString(string: NSLocalizedString("accueilTopTextL1", comment: ""), attributes: gotham)
let accueilTopTextL2 = NSMutableAttributedString(string: NSLocalizedString("accueilTopTextL2", comment: ""), attributes: gothamBold)
let accueilTopTextL3 = NSMutableAttributedString(string: NSLocalizedString("accueilTopTextL3", comment: ""), attributes: gotham)