Switching language through url locale not working

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Lyshatt
Posts: 8
Joined: 23 Sep 2021, 09:51

Switching language through url locale not working

Post by Lyshatt » 17 May 2022, 09:52

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.

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Switching language through url locale not working

Post by aimeos » 18 May 2022, 06:13

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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Lyshatt
Posts: 8
Joined: 23 Sep 2021, 09:51

Re: Switching language through url locale not working

Post by Lyshatt » 18 May 2022, 09:33

Okay I will update shortly. I doubt it causes the issue tho. I am using a custom larvel setup with Aimeos package added.


Lyshatt
Posts: 8
Joined: 23 Sep 2021, 09:51

Re: Switching language through url locale not working

Post by Lyshatt » 13 Jun 2022, 09:32

By reading the provided documentations and fixing the corresopnding parts of my project, I managed to resolve the issue. Thanks!

Post Reply