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

Prefix support #382

Open
insp3 opened this issue Dec 12, 2016 · 12 comments
Open

Prefix support #382

insp3 opened this issue Dec 12, 2016 · 12 comments

Comments

@insp3
Copy link

insp3 commented Dec 12, 2016

Hello

Please add prefix support. Like for b2b site:

www.example.com/b2b/en/

@ctf0
Copy link

ctf0 commented Jan 4, 2017

u can do it on ur own by simply wrapping all in a route prefix

Route::group(['prefix' => 'b2b'], function () {
    // all ur routes goes in here
});

https://laravel.com/docs/5.3/routing#route-group-prefixes

@insp3
Copy link
Author

insp3 commented Jan 4, 2017

Thank you for your response. I know how prefixes works.

If i just wrap and use localization then url will be redirected to:
www.example.com/en/b2b/
but i want
www.example.com/b2b/en/

It looks more natural and right.

@ctf0
Copy link

ctf0 commented Jan 4, 2017

@mcamara i think we can add a new config for this so it gets prepended to the locales

@insp3
Copy link
Author

insp3 commented Jan 4, 2017

If we can define in config file our prefixes where we like to use localization then it will be create. Like in array ['b2b', 'admin', 'etc']. Its simple enough.

@ctf0
Copy link

ctf0 commented Jan 4, 2017

i dont think its possible to have an array, cuz now you will need to have somthing that define which prefix you want to use at which time/case

@arquadrado
Copy link

I can't figure out how to wrap route group that already has a prefix, say 'admin', with localization. Can anyone tell me how, please?

@insp3
Copy link
Author

insp3 commented Jul 31, 2017

I think i and arquadrado are not the only one who needs this prefix support.

@MohamedSR
Copy link

in www.example.com/b2b/en/ to get 'en' just App::setLocale($request->segment(2));

@satvheck
Copy link

Any update on this issue yet? I'm having the same problem for a site completely deployed behind another site's sub-path. Thanks

@fpalamour
Copy link

Same issue here.

@AbdulBasit510
Copy link

Same issue here , I want to get Additional Prefix Parameter dynamically from database and language as it is , if any update please let me know Sir.

@iwasherefirst2
Copy link
Collaborator

iwasherefirst2 commented Oct 19, 2019

This is still not possible. PR are welcome, though it will be hard, because one would have to changed quite a lot of the package to add such a feature. The rule that the language parameter is the first parameter of the url is hardcoded in the LaravelLocalization model, in the redirect middleware and in the caching functionality. One would basically need to rewrite every model, middleware, trait and many tests in order to archive that.

Also, from a SEO perspective, its it recommended to have the locale as first parameter in the url: https://support.google.com/webmasters/answer/182192

Maybe its easier for you to create subdomains, like admin.yourdomain.com/en/ and guest.yourdomain.com/en/ this would work out of the box with this package.

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

No branches or pull requests

8 participants