hoyvoy / laravel-subdomain-localization

Easy subdomain localization for Laravel - Language detection based on subdomain, browser settings and cookies.
MIT License
8 stars 3 forks source link

Allow Router::url() to work without route translations. #4

Closed gonssal closed 6 years ago

gonssal commented 6 years ago

So, I want to have a working language switcher and be able to generate it using the handy Router::getCurrentVersions() method or I want a locale-specific URL using the Router::current() one.

The problem is that my routes aren't named and for now I don't want to translate them. This means that Router::url() always returns false.

This PR makes it work even if there are no translations for a route, just changing the subdomain, instead of returning false in Router::url(). For this to happen, I don't unset the path from the parsed URL and instead use it if no translated path exists, thus making the url() function work even if the routes are not named and there's nothing in resources/lang.

I'm not sure if it's possible with the current repo architecture, but it would be nice if this could be released for the 5.4 and 5.5 versions.

Gracias.

maguilar92 commented 6 years ago

@gonssal Merged and released in 5.6.5 version.

Thanks!!!

gonssal commented 6 years ago

No chance on getting it into earlier versions?

maguilar92 commented 6 years ago

@gonssal Yes I will add at laravel 5.5. Next I will check package maintenance to follow laravel version standards.

maguilar92 commented 6 years ago

@gonssal Added changes in 5.5.1 version! 😄

gonssal commented 6 years ago

I know it's already EOL, but I have a project that due to business requirements needs to stay on PHP 5.6., so I can't update to Laravel 5.5.

I'd like to know if you could release a 5.4.1 version with this patched.

Thank you.

maguilar92 commented 6 years ago

Hi @gonssal.

Version 5.4 no longer has an update and will not receive them.

What you can do is update laravel, which is the most recommended for security and bugs fixes or fork the repository and update it according to your needs if you want to continue using version 5.4.