You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For values where the translation contains an apostrophe ('), a double escape character is added (\\); this will create a backslash in front of the apostrophe when rendered in the web page.
For example (from base locale en to target locale it, no overwrite existing translations, verbose on, json instead of PHP output):
"Export course": "Corso sull\\'esportazione",
This should be: "Export course": "Corso sull'esportazione",
The cause of this is the call to addslashes() in this line:
The text was updated successfully, but these errors were encountered:
q--
changed the title
Unnecessary backslashes added to translation JSON files
Unnecessary backslashes added before apostrophes in translation when using JSON output
Oct 26, 2023
q--
added a commit
to q--/laravel-google-translate
that referenced
this issue
Oct 26, 2023
For values where the translation contains an apostrophe (
'
), a double escape character is added (\\
); this will create a backslash in front of the apostrophe when rendered in the web page.For example (from base locale
en
to target localeit
, no overwrite existing translations, verbose on,json
instead of PHP output):This should be:
"Export course": "Corso sull'esportazione",
The cause of this is the call to
addslashes()
in this line:laravel-google-translate/src/TranslationFileTranslators/JsonArrayFileTranslator.php
Line 39 in 80e3e40
This is unnecessary, as
json_encode
, which is called on line 48, already takes care of the necessary escaping.The text was updated successfully, but these errors were encountered: