martinlindhe/laravel-vue-i18n-generator

Unnecessary escape character

GonzaloGPF opened this issue · 3 comments

Hello!
First of all, thanks for this awesome package, it really helps!
But now I'm facing an issue, when I place html string in my translation's files, then, the generated .js shows unnecesary escape characters.

For example, in lang/en/test.php
'test' => 'It is a <strong>Test</strong> ok!',

Then, after generating, in my messages.js, It shows
'test' => 'It is a <strong>Test<\/strong> ok!',

Notice the unnecessary escape character. How could I fix this? If possible!

Thanks!

Should be easy enough to write a isolated test case for this. I'll have a look soon.

However, for me this has never come up as i separate design from text. It's a good idea to keep them separated :-)

Had a closer look at this issue today.

Turns out this is the standard behaviour of php's json_encode().

There are some explanations of this here https://stackoverflow.com/a/10314758

I found a solution, and released 0.1.32 with a fix to not escape slashes.