Skip to content

Fix language switch#134

Draft
apriljunge wants to merge 1 commit intomainfrom
fix-language-switch
Draft

Fix language switch#134
apriljunge wants to merge 1 commit intomainfrom
fix-language-switch

Conversation

@apriljunge
Copy link
Contributor

@apriljunge apriljunge commented Feb 11, 2026

  • correct url in language switch
  • redirect wrong urls
  • add alternate meta tags

Wrong urls

The same content can be accessed by multiple urls. For example

URL gui lang content lang should redirect
/aktionen/[slug-de] de de
/actions/[slug-de] de de /aktionen/[slug-de]
/aktionen/[slug-en] de en /en/actions/[slug-en]
/actions/[slug-en] de en /en/actions/[slug-en]
/en/actions/[slug-en] en en
/en/actions/[slug-de] de en /aktionen/[slug-de]

@apriljunge apriljunge marked this pull request as draft February 11, 2026 09:13
@apriljunge
Copy link
Contributor Author

apriljunge commented Feb 11, 2026

I created a first draft to fix the language switch.
@azinazadi @Haliax @Moyaccercchi Can you review the draft if you think that would be a good solution?

Regarding the implementation, I have a pretty good idea how to fix the gui / content lang mismatch. But I have two open issues. If you know how to do this, please give me a hint:

  • How to create a redirect in actions/[..slug].js?
  • Why /actions/[slug-de] works? I guess it's an issue with the router, but I have no idea.

@azinazadi
Copy link
Contributor

what is the state with your changes? does it work for actions?

@apriljunge
Copy link
Contributor Author

what is the state with your changes? does it work for actions?

Yes, it works just for actions/[slug] not for /actions/. But it is easy to apply this approach to all other pages. I requested review to get feedback for the general approach to use the state and check if you have further ideas to my questions above.

What currently works:
Go to a specific action (e.g. /aktionen/graz-2026-02-22-get-together), click on en, then the page should change to /en/actions/graz-2026-02-22-get-together-en (the english version)

@Moyaccercchi
Copy link

We think we don't really understand your two questions / open issues ^^'
Could you describe a bit more what your problem with the redirects or the working page is?

Regarding this pull request:
If we understand this correctly, we call getLocalizedSlug asychronously on each request for each locale, but will only need it for the not-currently-selected locale... we would prefer a method where we only get the one we need, and ideally without any async requests, as we think for over 1000 views the language switch is only clicked once, so no need to load this all the time but instead just in the moment of the click do some custom logic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments