Reputation: 33
I am working on oracle chat bot and need formatted output string For example
“This is a book”
In the above string only the word ‘book’ should appear in bold
Upvotes: 3
Views: 11556
Reputation: 59
You can also create your tag like:
t('.this_is_a_book_html')
And then in the config/locales:
en:
this_is_a_book_html: 'This is a <b>book</b>
Also if you want to add a variable, you can do something like:
t('.this_is_an_object_html', object: 'Book')
en:
this_is_an_object_html: 'This is a <b>%{object}</b>'
Upvotes: 0
Reputation: 21
use safeHTML in the html file. In yaml you can use html tags and that content will print in html as
{{safeHTML value}}
value: "This is <b> a Book</b>"
Upvotes: 2
Reputation: 76599
If you want something like that, you can only use YAML to store the text. The formatting, and the way to emphasis book is up to the program that interprets the data loaded from YAML.
If all the occurences of book
should be boldened you could use a YAML file looking like:
bold:
- book
text: |
This is a book
with the proper interpretation of the root-level mapping.
Alternatively you could apply formatting like ReST or markdown, to the loaded text In that case your YAML could even be a root level scalar:
--- |
This is a **book**
I use multi-document formats like that combining ReST, code and output to generate package documentation and for rendering stackoverflow answers that include program output.
Upvotes: 3