Error Page is shown in wrong language

I have spotted a really weird behaviour with my error pages.

If I browse my site in english and enter a not existing url, I get redirected correctly to the error page. Unfortunately all the content (and navigation and everything else) there is always shown in the default language german. However the URL path is still with /en/.

Any ideas on where I need to start debugging?

I tried a few things out and it seems that everything is set up as it should be.
There is an /error folder with the content files for each language. If i hit an error, i get forwarded to the correct error site. However, everything still remains in german, and the language switcher changes to german as well. Is this potentially a bug in Kirby with multilanguage sites?

Please post your language configuration. Also, are you using any routes? Language detection? Plugins?

Iā€™m not using any routes, language detection is on. Plugins Iā€™m using are kirby3-xmlsitemap and uniform.
Language configurations:
DE
ā€˜codeā€™ => ā€˜deā€™,
ā€˜defaultā€™ => true,
ā€˜localeā€™ => ā€˜de_CHā€™,
ā€˜nameā€™ => ā€˜Deutschā€™,
ā€˜urlā€™ => ā€˜/deā€™,
ā€˜translationsā€™ => [ā€¦]

EN
ā€˜codeā€™ => ā€˜enā€™,
ā€˜localeā€™ => ā€˜en_USā€™,
ā€˜nameā€™ => ā€˜Englishā€™,
ā€˜urlā€™ => ā€˜/enā€™,
ā€˜translationsā€™ => [ā€¦]

@texnixe do you have any other ideas here?

No, I havenā€™t tested this myself yet, but found this issue: https://github.com/getkirby/kirby/issues/2609

I just tested this with a fresh Starterkit and can reproduce the issue.

Sorry to jump on this, but is it solved? I happen to have the same issue with the kirby 3.6.6.

Canā€™t reproduce this in a 3.6.6 Starterkit. What are your exact settings? and is the error page actually translated?

Hi texnixe,

Thanks for the answer, yes the page is translated in all languages.

Settings:

config.php

return [
  'debug' => false,
  'languages' => true,
  'languages.detect' => true,
  'date.handler' => 'strftime',
  'smartypants' => true,
  'panel' => [
    'css' => '/assets/css/panel.css',
    'slug' => 'secret'
  ],
  'bnomei.boost.cache' => [
    'type'     => 'sqlite'
  ],
  'bnomei.janitor.jobs' => require_once 'jobs.php',
  'routes' => require_once 'routes.php',
  'thumbs' => require_once 'thumbs.php',
  'cache' => [
    'pages' => [
      'active' => true,
      'ignore' => function ($page) {
        return in_array($page->id(), ['bank', 'archives', 'agenda', 'error']);
      }
    ]
  ],
  'hooks' => require_once 'hooks.php',
  'bnomei.sqlite-cachedriver.pragmas-construct' => [
    // your pragmas or none
    'PRAGMA read_uncommitted = true;',
    'PRAGMA busy_timeout = 10000;',
    'PRAGMA main.cache_size = 20000;',
    'PRAGMA case_sensitive_like = false',
    'PRAGMA main.auto_vacuum = INCREMENTAL;',
    'PRAGMA main.page_size = 8096;',
    'PRAGMA temp_store = MEMORY;',
  ],
  // Sitemap
  'omz13.xmlsitemap' => [
    'cacheTTL' => 60,
    'includeUnlistedWhenTemplateIs' => ['exhibitions'],
    'excludePageWhenTemplateIs' => ['events','year-press'],
    'excludeChildrenWhenTemplateIs' => [ 'events','shop'],
    'disableImages' => false,
  ],
  // Retour
  'distantnative.retour' => [
    'ignore' => ['sites', 'en/nodes', 'de/nodes'],
  ]
];

System:

routes.php:

return [
    [
        'pattern' => '/',
        'action'  => function () {
            $session = kirby()->session();
            if ($session->get('languages.detect', false) === false && option('languages.detect') === true) {
                $session->set('languages.detect', true);
                return kirby()
                    ->response()
                    ->redirect(kirby()->detectedLanguage()->url());
            }
            return page();
        }
    ]

I tried to completely remove the routes.php to see if this was causing issue, but didnā€™t change. That bit of code came from the issue where languages autodetect didnā€™t work when the default language url is set to ā€˜/ā€™. To avoid to have the default language shown in the url.

Languages pages:

return [
  'code' => 'fr',
  'default' => true,
  'direction' => 'ltr',
  'locale' => 'fr_FR.utf-8',
  'name' => 'FranƧais',
  'url' => '/',
  'translations' => [ā€¦]
]
return [
    'code' => 'en',
    'default' => false,
    'direction' => 'ltr',
    'locale' => 'en_US.utf-8',
    'name' => 'English',
    'url' => 'en',
    'translations' => [ā€¦]
]
return [
    'code' => 'de',
    'default' => false,
    'direction' => 'ltr',
    'locale' => 'de_DE.utf-8',
    'name' => 'Deutsch',
    'url' => 'de',
    'translations' => [ā€¦]
]

Sorry for the long post. Will try to disable other plugins in the meantime.

With a test of removing all plugins, it was still not working, I just added this on top* of my routes.php, donā€™t know if thatā€™s a nasty hack but itā€™s a temporary solution to me:

[
        'pattern' => '(:all)',
        'language' => '*',
        'action'  => function ($language, $uid) {
            if(!$uid) $page = site()->homePage();
            else $page = page($uid);
            if(!$page) $page = site()->errorPage();
            return site()->visit($page, $language);
        }
    ]

*Edit: Bottom part if you have other routing rules. This should be the last resort.