I'm using Nextjs, and when I redirect to a page(pages/search/index), I can get the query in getServerSideProps but when I change the language using setAppLanguage by importing it from next-translate/setLanguage, the search page is reloaded again but the query is empty in getServerSideProps and I request with an empty query inside this page. By the way, the URL is updated from http://localhost:3000/tr/search?q=anything to http://localhost:3000/en/search?q=anything after the language is changed
It helped me
const router = useRouter()
const changeLanguage = (lang: string) => async () => {
await router.push(router.asPath, undefined, {
locale: lang
})
}
used it instead of setLanguage