Page 1 of 1

Switching language through url locale not working

Posted: 17 May 2022, 09:52
by Lyshatt
I am using Laravel Framework Version 7.30.4 with php 7.4 and Aimeos 2021.07 on an Windows Environment.

We already had an existing laravel project with locale functionality. There the locale always comes right after the domain, so a URL could look like this: example.com/en/some-page. To configure aimeos the same way, I edited the routes inside /config/shop.php to look like this:

'routes' => [
'admin' => ['prefix' => '{locale}/admin', 'middleware' => ['web']],
'jqadm' => ['prefix' => '{locale}/admin/{site}/jqadm', 'middleware' => ['web', 'auth']],
'jsonadm' => ['prefix' => '{locale}/admin/{site}/jsonadm', 'middleware' => ['web', 'auth']],
'jsonapi' => ['prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
'account' => ['prefix' => '{locale}/profile', 'middleware' => ['web', 'auth']],
'default' => ['prefix' => '{locale}/shop', 'middleware' => ['web']],
'supplier' => ['prefix' => '{locale}/s', 'middleware' => ['web']],
'update' => [],
],

This does seem to work at first, because I can now call all the aimeos URLs the same way, e.g. example.com/en/store. But if I change the locale, nothing gets translated. So as an example I can open example.com/de/store, which works, but everything is still completely in english. Any information on where the mistake lies is appreciated.

Re: Switching language through url locale not working

Posted: 18 May 2022, 06:13
by aimeos
First of all, you need to update to 2021.10.x LTS because 2021.07 isn't supported any more.

Do you use the Aimeos distribution as base or a custom Laravel setup with Aimeos package added?

Re: Switching language through url locale not working

Posted: 18 May 2022, 09:33
by Lyshatt
Okay I will update shortly. I doubt it causes the issue tho. I am using a custom larvel setup with Aimeos package added.

Re: Switching language through url locale not working

Posted: 19 May 2022, 06:45
by aimeos

Re: Switching language through url locale not working

Posted: 13 Jun 2022, 09:32
by Lyshatt
By reading the provided documentations and fixing the corresopnding parts of my project, I managed to resolve the issue. Thanks!