I have a javascript variable that fills with Laravel translation system:
'are_you_sure' => '¿Remplacer l\'arbre?',
and then in JS:
swal({
title: "{{ trans('msg.are_you_sure') }}",
...
});
And it appears to me:
¿Remplacer l'arbre?
EDIT:
Sorry for htmlspecialchars
, the thing is it doesn't change removing htmlspecialchars
, adding it, or adding htmlspecialchars_decode
htmlspecialchars
takes a plain text string and turns it into HTML.
i.e. exactly the opposite of what you want it to do
Look at htmlspecialchars_decode
instead.
Beware "
and new line characters which will break the JS syntax.
htmlspecialchars()
is what is causing your '
to turn into the html translation('). Just removing it should do the trick.
Source: http://php.net/manual/en/function.htmlspecialchars.php
I finally found it. I had to replace {{ }}
by {!! !!}
I think you can use unescape() Function to convert the code into a string, i left you a web here https://www.w3schools.com/jsref/jsref_unescape.asp