Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
afbora opened this issue Nov 7, 2022 · 8 comments · May be fixed by #6608
Open

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

afbora opened this issue Nov 7, 2022 · 8 comments · May be fixed by #6608
Assignees
Labels
type: bug 🐛 Is a bug; fixes a bug

Comments

@afbora
Copy link
Member

afbora commented Nov 7, 2022

Scenario to reproduce:

Have 2 languages:

  • French (default), with "url" => "/"
  • English (secondary), with "url" => "en"

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 #2609 (comment)

@afbora
Copy link
Member Author

afbora commented Nov 7, 2022

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

  • FR ❌
  • IT ❌
  • TR ❌
  • ES ❌
  • DE ✅
  • RU ❌
  • NL ❌

@adamkiss
Copy link
Contributor

adamkiss commented Nov 9, 2022

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

@afbora afbora added the type: bug 🐛 Is a bug; fixes a bug label Nov 9, 2022
@lukasbestle
Copy link
Member

That's super weird...

@distantnative
Copy link
Member

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
Copy link
Contributor

adamkiss commented Dec 9, 2022

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

@afbora
Copy link
Member Author

afbora commented Dec 9, 2022

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

@distantnative
Copy link
Member

distantnative commented Dec 11, 2022

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 distantnative added needs: replication 🔬 Requires a sample to reproduce the issue and removed needs: replication 🔬 Requires a sample to reproduce the issue labels Aug 11, 2024
@distantnative
Copy link
Member

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

  • The issue occurs when the default language has no own prefix, but /
  • Our language routes are set up that it tries to match the path in a route for each language and move next if nothing is found (e.g. also to support custom routes that aren't set up by LanguageRoutes but share the prefix)
  • Since we move to the next routes, a path like en/foo matched for the secondary language English, didn't find the page, moves on and now matches the pattern for the primary language French route because it has no prefix. Now as en/foo full path. And thus the language is set to French and if no page is found, it's the French error page.

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.

@distantnative distantnative self-assigned this Aug 11, 2024
distantnative added a commit that referenced this issue Aug 11, 2024
@distantnative distantnative linked a pull request Aug 11, 2024 that will close this issue
4 tasks
@distantnative distantnative linked a pull request Aug 11, 2024 that will close this issue
4 tasks
distantnative added a commit that referenced this issue Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants