Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode PHP strings to prevent slashes in output #1

Merged

Conversation

q--
Copy link
Owner

@q-- q-- commented Feb 27, 2024

I decided to add all relevant features and bugfixes to my own fork, as they don't really make sense to combine into a single PR back to upstream and I don't know when upstream will merge the multiple PRs.

The upstream PR for this bug is joedixon#296


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!": "",

Decode PHP strings, so in the final JSON e.g. __('Don\'t') becomes
"Don't" instead of "Don\\'t"
@q-- q-- merged commit f680759 into 2.x Feb 27, 2024
q-- pushed a commit that referenced this pull request Feb 27, 2024
…tion

auto-translate value instead of key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant