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

getLocalizedURL() is not translating models from dimsav/laravel-translatable #134

Closed
mkwsra opened this Issue Oct 27, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@mkwsra

mkwsra commented Oct 27, 2018

  • Localization Version: 2.2.1
  • Laravel Version: 5.6.39
  • PHP Version: 7.1.7

Description:

As simple as the function getLocalizedURL() is not returning the correct value for a model bound into route value, and I'm using this library dimsav/laravel-translatable for models translation

Steps To Reproduce:

I have been facing this error for a very long time, I used to add this line $url = urldecode($url); at
vendor/arcanedev/localization/src/Localization.php:336 but recently it's not working at all.

Thank you!

@arcanedev-maroc

This comment has been minimized.

Member

arcanedev-maroc commented Oct 29, 2018

Have you tried the Localization's Events ?

@mkwsra

This comment has been minimized.

mkwsra commented Oct 29, 2018

No actually, I will give it a try and let you know very soon, thanks!

@arcanedev-maroc

This comment has been minimized.

Member

arcanedev-maroc commented Oct 29, 2018

Also, if you're using Laravel v5.6.x, upgrade the localization package to v3.x.

Check the documentation: https://github.com/ARCANEDEV/Localization/blob/master/_docs/1-Installation-and-Setup.md#version-compatibility

@mkwsra

This comment has been minimized.

mkwsra commented Nov 3, 2018

So I just checked out the events, and there is a huge misunderstanding, I'm not using your library to translate the models! the matter, in fact, your library wasn't translating models before as far as I can remember.

I'm using dimsav/laravel-translatable for translation and I think here where the problem lays.

I ended up changing on Localization.php and handling translating the $attributes, and the ['path'] value and it worked for me as a tweak!

Thank you, and it's worth to mention that the values should be urldecoded, otherwise, it will not be treated as a proper input, the second problem here is triggering the translation of such route variable (attribute)!

@arcanedev-maroc

This comment has been minimized.

Member

arcanedev-maroc commented Nov 6, 2018

If you've solved your issue, do you mind if you can share the solution for the others ?

Thanks for using the package 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment