I need to insert a special character in the html file translation. The character is a space, need it to try to solve another problem.
But it is not working. The code for that character is displayed in the subject of the email.
For this I insert these lines:
pt.yml
subjects:
...
release_auto_pause_triggered_html: "%{project_name} %{release_name} - pausa automática disparada"
release_mailer.rb
subject = t('subjects.release_auto_pause_triggered_html', project_name: @project.name, release_name: @release.name).html_safe
But the subject of the email sent is as follows: pausa automática disparada
I need to look like this: "pausa automática disparada"
Where am I going wrong?
I think I manage to do it. Try this "pausa automática\xA0disparada"
Source:
Using single-quoted scalars, you may express any value that does not contain special characters. No escaping occurs for single quoted scalars except that a pair of adjacent quotes '' is replaced with a lone single quote '.
Double-quoted is the most powerful style and the only style that can express any scalar value. Double-quoted scalars allow escaping. Using escaping sequences \x** and \u**, you may express any ASCII or Unicode character.
And here I found the necessary code
My output is:
# YML
title: "Title \xA0 aaa"
# console
I18n.t('title')
=> "Title aaa"
It should work this way. Try to check for typos.
In your example
"pausa automática ';disparada""
there is extra '
between  
and ;
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With