Multilanguage setup: translate search results

I have a multilanguage setup with two languages (de/en). Users can switch languages using a language switcher and a search input in the menu bar. The language switcher is redirecting the current de url to the en current url. to

The issue: on the search results page, when switching languages the query string ?q=teststring gets lost. Instead of redirecting to it’s redirecting to

(Also, the /search page is actually a hidden page.)

Am I missing something implementing the language switcher?

Thanks for any input!

Does it make sense to keep the search string? After all, a search term “Hamsterkäfig” wouldn’t yield any results in the English variant and vice versa?

1 Like

Hm, you’re right, that makes sense.
I guess I need a route for the /search page if the language is switched on the results page. Or is there some other trick?

From what you posted above, the language switch redirect seems to be correct? Or what’s wrong with

1 Like

There’s actually no page the page is only to display the search results.
If there’s no search query in the url, the page shouldn’t be accessible at all. That means, the only search input field is in the menu bar.

So I guess, I basically need a route for if no search query redirect to home or something. Hm.

Then I wouldn’t put the search into the language switcher?

What do you mean exactly? I can’t follow :smiley: Do you mean to make an if clause that’s excluding the /search page from translation?

(Thanks for your input btw!)

Why is there a link to the search page in the navigation if the search page is only there to display the search results?

Yes, you can use an if statement

That’s a misunderstanding i think, there’s no link in the navigation bar just the search input field which is redirecting to /search?q on submit.
I’ll figure out a route then.