When the window.location.href has no path parameters other than the currently selected locale code, calling changeLanguage("--new locale--") adds the new language to the end of the path without removing the original locale. The result is a url with 2 locales, which 404s on my system.
Steps to reproduce:
Go to site home page => url is http://localhost:8000/
Select first locale by calling changeLanguage('en') => url is http://localhost:8000/en
Select new locale by calling changeLanguage('zh-cn') => url is http://localhost:8000/zh-cn/en
It looks like the changeLanguage(...) function assumes that there will be atleast 1 path parameter after the locale
When the
window.location.href
has no path parameters other than the currently selected locale code, callingchangeLanguage("--new locale--")
adds the new language to the end of the path without removing the original locale. The result is a url with 2 locales, which 404s on my system.Steps to reproduce:
http://localhost:8000/
changeLanguage('en')
=> url ishttp://localhost:8000/en
changeLanguage('zh-cn')
=> url ishttp://localhost:8000/zh-cn/en
It looks like the
changeLanguage(...)
function assumes that there will be atleast 1 path parameter after the locale