laravel-localization
laravel-localization copied to clipboard
Prefix support
Hello
Please add prefix support. Like for b2b site:
www.example.com/b2b/en/
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
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.
@mcamara i think we can add a new config for this so it gets prepended to the locales
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.
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
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?
I think i and arquadrado are not the only one who needs this prefix support.
in www.example.com/b2b/en/ to get 'en' just App::setLocale($request->segment(2));
Any update on this issue yet? I'm having the same problem for a site completely deployed behind another site's sub-path. Thanks
Same issue here.
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.
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.