getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.26k stars 166 forks source link

Error page always rendered in default language for some languages #4834

Open afbora opened 1 year ago

afbora commented 1 year ago

Scenario to reproduce:

Have 2 languages:

If you visit /en/asdf, the url is right, but the content is not translated (appears in default language). If you visite /asdf, the url is right and the content is translated.

Fix: If I set the french url => "fr", it works as intended. Both "/" and "/en" are displaying the right locale. If I set the english as default, with url => "/", it works as intended.

This means I cannot have French as default language with url => "/".

Same issue as this user: https://forum.getkirby.com/t/error-page-is-shown-in-wrong-language/18084/9

Originally posted by @juliencharette in https://github.com/getkirby/kirby/issues/2609#issuecomment-1306071201

afbora commented 1 year ago

This issue is only reproducible for some languages, we've tested following languages:

adamkiss commented 1 year ago

Ha, it almost looks like only $language <= "en" can have a root url.

lukasbestle commented 1 year ago

That's super weird...

distantnative commented 1 year ago

Ha, it almost looks like only $language <= "en" can have a root url.

Is it just en or is it en and de from your test, @afbora @adamkiss?

adamkiss commented 1 year ago

@distantnative I'm not involved, I just noticed it looks like it's broken alphabetically.

afbora commented 1 year ago

@distantnative EN is always the secondary language in manual tests. Only DE passed the test when we changed the primary language.

distantnative commented 1 year ago

I think I am getting to the source of the problem, without quite knowing yet how to solve it:

On the one hand, I see how we thought a fallback to also check for a page en/not-there in the / context would make sense. But it doesn't quite when we already checked for not-there in the /en context. It creates parallel universes :D

This is why right now the secondary-language error page cannot really be reached. I didn't check for German, but I would be surprised if that one is actually working either.

distantnative commented 3 weeks ago

I looked into this again. I am not sure we can solve this:

I see two options, both not sure how to implement yet: a) We implement a way where we don't move to the next route, but skip all other language routes while not skipping all other routes. b) We find a way how a language without URL prefix cannot match any path that would match any other language.