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

UI fails if text contains {...} #449

Open
sclause2412 opened this issue Dec 19, 2023 · 0 comments
Open

UI fails if text contains {...} #449

sclause2412 opened this issue Dec 19, 2023 · 0 comments

Comments

@sclause2412
Copy link

Problem

If the text contains curly braces the interface fails because it tries to replace it with a route parameter.

How to reproduce

Make any translation containing curly braces like: `__('Use {red} to make the text red.')
Then import the translations. This will generate a line in the table containing the key "Use {red} to make the text red." which is fine at this point.
When now accessing the interface it fails with this message:

Illuminate \ Routing \ Exceptions \ UrlGenerationException
Missing required parameter for [Route: ] [URI: translations/delete/{groupKey}/{translationKey}] [Missing parameter: red].

The reason is that the function "action" gets the key as parameter without checking the content.

Solution

In the view file (resources/views/index.php) change the line

<a href="<?php echo action('\Barryvdh\TranslationManager\Controller@postDelete', [$group, $key]) ?>"

to

<a href="<?php echo action('\Barryvdh\TranslationManager\Controller@postDelete', [$group, urlencode($key)]) ?>"

and in the controller file (src/Controller.php) change the line

Translation::where('group', $group)->where('key', $key)->delete();

to

Translation::where('group', $group)->where('key', urldecode($key))->delete();
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

No branches or pull requests

1 participant