• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.