[Bug]: Language Switcher on main pages doesn't work ?_locale=xx
Closed this issue · 4 comments
capitalfuse commented
Expected behavior
ex)
When change language from English to German on the main page;
Links shows the following ---> 'https://demo.pimcore.com/?_locale=de'
and not changed to the German site.
The following code has the main reason.
src/Twig/Extension/LanguageSwitcherExtension.php
Actual behavior
It should be the following;
'https://demo.pimcore.com/de'
Steps to reproduce
Commented out the following codes, fixed, but it will affect the links of news document detail pages.
src/Twig/Extension/LanguageSwitcherExtension.php
$route = $request->get('_route');
$routeParams = $request->get('_route_params');
if ($route && $routeParams) {
$routeParams['_locale'] = \Locale::getPrimaryLanguage($language);
$route = $this->urlGenerator->generate($route, $routeParams);
$target = $route;
}
capitalfuse commented
I changed if condition like below.
if ($route && $routeParams['newstitle'] ) {
$routeParams['_locale'] = \Locale::getPrimaryLanguage($language);
$route = $this->urlGenerator->generate($route, $routeParams);
$target = $route;
}
---> But the above method has not been applied for the page view.
robertSt7 commented
It only works for static routes at the moment