HTML-сущности в строковых файлах - PullRequest
0 голосов
/ 26 апреля 2018

Я не хочу настраивать шрифт моих строк для примера. У меня есть 2 языка:

«Привет, как ты, $ name?»

"Добрый комментарий vas tu $ prenom?"

Вот для примера, я не хочу делать:

  • «Привет» и «Добрый день» жирным шрифтом;
  • «как» и «комментарий» в пользовательском шрифте;
  • "Ты" и "VAS Tu" в красном;
  • и есть параметр для получения имени.

Можно ли сделать это по-быстрому? Я создал один из файлов:

enter image description here

Я пытался поместить объекты HTML:

enter image description here

Как я это называю:

    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)
...