why aimeos doesn't save locale
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
why aimeos doesn't save locale
Hello,
Why aimeos doesn't save the locale of the user?
The locale was changed, but when I go to other page, it returns to the default locale.
this is the locale parameter that I passed to the route : "?locale=ar¤cy=ILS".
Note: I didn't activate the multilocale option in the .env file. Is this the problem?
Why aimeos doesn't save the locale of the user?
The locale was changed, but when I go to other page, it returns to the default locale.
this is the locale parameter that I passed to the route : "?locale=ar¤cy=ILS".
Note: I didn't activate the multilocale option in the .env file. Is this the problem?
Re: why aimeos doesn't save locale
Yes, you have to set SHOP_MULTILOCALE=true in your .env file
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: why aimeos doesn't save locale
I was afraid to turn it on because when I run "php artisan optimize", I got this:
Code: Select all
Route pattern "/{locale}/site/{locale}" cannot reference variable name "locale" more than once.
at C:\xampp\htdocs\WomenTemplate\vendor\symfony\routing\RouteCompiler.php:144
140▕ if (preg_match('/^\d/', $varName)) {
141▕ throw new \DomainException(sprintf('Variable name "%s" cannot start with a digit in route pattern "%s". Please use a different name.', $varName, $pattern));
142▕ }
143▕ if (\in_array($varName, $variables)) {
➜ 144▕ throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName));
145▕ }
146▕
147▕ if (\strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) {
148▕ throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %d characters in router than %d characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIAB;LE_MAXIMUM_LENGTH, $pattern));
1 C:\xampp\htdocs\WomenTemplate\vendor\symfony\routing\RouteCompiler.php:72 Route), "/{locale}/site/{loca
Symfony\Component\Routing\RouteCompiler::compilePattern(Object(Symfony\Component\Routing\Route), "/{locale}/site/{locale}")
2 C:\xampp\htdocs\WomenTemplate\vendor\symfony\routing\Route.php:410 PS C:\xampp\htdocs\WomenTempl
Symfony\Component\Routing\RouteCompiler::compile(Object(Symfony\Component\Routing\Route))
Re: why aimeos doesn't save locale
because you didn't register any local in you're app.
https://github.com/aimeos/aimeos/blob/m ... Locale.php
https://github.com/aimeos/aimeos/blob/m ... Locale.php
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: why aimeos doesn't save locale
I already added the locale. But the problem is from the format of the route.
All links must start with the locale id, and I have some have not.
It seems is solved.
All links must start with the locale id, and I have some have not.
It seems is solved.
- Attachments
-
- Screenshot 2022-06-01 091120.png (24.59 KiB) Viewed 1497 times
Re: why aimeos doesn't save locale
In your ./config/shop.php, you've added the "{locale}" placeholder yourself to the routes and it's not allowed to use the same placeholder twice in an URL. Remove the "{locale}" string you've added to the routes and it will work with SHOP_MULTILOCALE=true
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: why aimeos doesn't save locale
Thanks, now I have no errors.
But, I have some notes:
- Can I overwrite "airoute" function?
- When I remove this from the url "?currency=USD", it go back to the default currency?
- Why in guest user, It doesn't store the locale in the session?
But, I have some notes:
- Can I overwrite "airoute" function?
- When I remove this from the url "?currency=USD", it go back to the default currency?
- Why in guest user, It doesn't store the locale in the session?
Re: why aimeos doesn't save locale
If you define your own function before this code is executed, you can overwrite the function:
https://github.com/aimeos/aimeos-larave ... hp#L10-L33
Yes, back the to first locale combination which is matching the language in the URL.ahmed31916 wrote: ↑04 Jun 2022, 12:38 - When I remove this from the url "?currency=USD", it go back to the default currency?
Whenever you save something into the session of a user but your content depends on it, it's impossible to cache the page.ahmed31916 wrote: ↑04 Jun 2022, 12:38 - Why in guest user, It doesn't store the locale in the session?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Re: why aimeos doesn't save locale
Why not return the last currency that was traded?Yes, back the to first locale combination which is matching the language in the URL.
Isn't this link set the locale of the app?
Re: why aimeos doesn't save locale
You can have several locale combinations with the same language but different currencies. Thus, the currency must be added as well if you don't have only one combination. In that case, you should overwrite the airoute() function to leave out the currency if it's always the same or only depends on the language.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star