joedixon / laravel-translation

Translation management for your Laravel application.
MIT License
694 stars 230 forks source link

Decode PHP strings to prevent slashes in output #296

Open q-- opened 5 months ago

q-- commented 5 months ago

Decode PHP strings, so in the final JSON e.g. __('Don\'t') becomes "Don't" instead of "Don\\'t"

Steps to reproduce:

Blade file

({{ __('This is a text with an apostrophe in it; let\'s add it to my translations file!') }})

Run php artisan translation:sync-missing-translation-keys

How laravel-translation stores it in <language>.json after running that:

"This is a text with an apostrophe in it; let\\'s add it to my translations file!": "",

What it should be storing:

"This is a text with an apostrophe in it; let's add it to my translations file!": "",