Welcome Guest, Not a member yet? Register   Sign In
Localization duplicate page problem when locale set in routes
#8

jameslittle, thanks for the hint. Both of our questions are successfully resolved by this code in routes.php:

PHP Code:
// localized routes
$supportedLocalesWithoutDefault array_diff($this->config->supportedLocales, array($this->config->defaultLocale));
if (
in_array($this->request->uri->getSegment(1), $supportedLocalesWithoutDefault)) {
    
$routes->get('{locale}/books', 'App\Books::index'); 
    
//other localized routes


First of all we define all locales without default. Next we set localized routes only for this locales. This allows us to leave familiar URLs for the default language, and excludes access to invalid duplicate pages.

Anyway, it looks like a crutch, think decisions must be released in core
Reply


Messages In This Thread
RE: Localization duplicate page problem when locale set in routes - by Stormbringer - 01-28-2020, 04:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB