You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language switcher returns to locale root, losing the current page #60
El toggle de locale enlaza a /${locale} incondicionalmente, así que cambiar de idioma desde /en/docs/getting-started o /en/app devuelve al usuario a la home en vez del equivalente traducido de la página actual.
Archivo:src/components/layout/Header.tsx:84-86
Solución sugerida: Construir el href destino intercambiando solo el segmento de locale inicial de usePathname(), con fallback a la raíz si no mapea.
🇬🇧 English
The locale toggle links to /${locale} unconditionally, so switching language from /en/docs/getting-started or /en/app drops the user back to the home page instead of the translated equivalent.
File:src/components/layout/Header.tsx:84-86
Suggested fix: Build the target href by swapping only the leading locale segment of usePathname(), falling back to root if unmapped.
Hi! I'd like to work on this. I have experience with Next.js and i18n. The fix looks clear: use usePathname() to swap only the leading locale segment, falling back to / if it's not mapped. Could you assign it to me?
Aviso importante: al revisar main, el fix que describe esta issue ya parece estar implementado en el commit 03d1694 (feature de i18n extensible). El componente ya usa getRedirectPath en src/components/layout/Header.tsx:38-46, que intercambia solo el segmento de locale de usePathname() con fallback a la raíz, y el dropdown enlaza a href={getRedirectPath(locale)} en vez de /${locale}.
¿Podrías verificarlo en tu entorno? Si confirmas que ya funciona, cerramos la issue. Si encuentras algún caso que aún falle (query string, hash, rutas sin locale, etc.), adelante con el PR. 🚀
🇬🇧 English
Assigned, thanks for volunteering! 🙌
Heads up: looking at main, the fix described here appears to already be implemented in commit 03d1694 (extensible i18n feature). The component already uses getRedirectPath at src/components/layout/Header.tsx:38-46, which swaps only the leading locale segment of usePathname() with a root fallback, and the dropdown links to href={getRedirectPath(locale)} instead of /${locale}.
Could you verify it on your end? If you confirm it already works, we can close the issue. If you find an edge case that still fails (query string, hash, locale-less routes, etc.), go ahead with the PR. 🚀
@DataDave-Dev, I checked both the code in main and the live site at weftmap.vercel.app. The language switcher now correctly stays on the current page (e.g., /en/docs → /es/docs). The fix is already working. I think this issue can be closed.
Excellent @rue-eru, thank you very much for the review, if you like to continue contributing you could see the other issues and if you like one I can assign it to you without problem.
Activity
rue-eru commentedon Jun 17, 2026
Hi! I'd like to work on this. I have experience with Next.js and i18n. The fix looks clear: use usePathname() to swap only the leading locale segment, falling back to / if it's not mapped. Could you assign it to me?
DataDave-Dev commentedon Jun 17, 2026
🇪🇸 Español
¡Asignado, gracias por ofrecerte! 🙌
Aviso importante: al revisar
main, el fix que describe esta issue ya parece estar implementado en el commit03d1694(feature de i18n extensible). El componente ya usagetRedirectPathensrc/components/layout/Header.tsx:38-46, que intercambia solo el segmento de locale deusePathname()con fallback a la raíz, y el dropdown enlaza ahref={getRedirectPath(locale)}en vez de/${locale}.Casos que funcionan:
/en/docs/getting-started→/es/docs/getting-started,/en/app→/es/app,/→/es(fallback).¿Podrías verificarlo en tu entorno? Si confirmas que ya funciona, cerramos la issue. Si encuentras algún caso que aún falle (query string, hash, rutas sin locale, etc.), adelante con el PR. 🚀
🇬🇧 English
Assigned, thanks for volunteering! 🙌
Heads up: looking at
main, the fix described here appears to already be implemented in commit03d1694(extensible i18n feature). The component already usesgetRedirectPathatsrc/components/layout/Header.tsx:38-46, which swaps only the leading locale segment ofusePathname()with a root fallback, and the dropdown links tohref={getRedirectPath(locale)}instead of/${locale}.Working cases:
/en/docs/getting-started→/es/docs/getting-started,/en/app→/es/app,/→/es(fallback).Could you verify it on your end? If you confirm it already works, we can close the issue. If you find an edge case that still fails (query string, hash, locale-less routes, etc.), go ahead with the PR. 🚀
rue-eru commentedon Jun 18, 2026
@DataDave-Dev, I checked both the code in
mainand the live site atweftmap.vercel.app. The language switcher now correctly stays on the current page (e.g.,/en/docs→/es/docs). The fix is already working. I think this issue can be closed.DataDave-Dev commentedon Jun 18, 2026
Excellent @rue-eru, thank you very much for the review, if you like to continue contributing you could see the other issues and if you like one I can assign it to you without problem.