mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-11 11:39:43 +08:00
16 lines
403 B
JavaScript
16 lines
403 B
JavaScript
;(() => {
|
|
const supportedLangs = window.supportedLangs
|
|
|
|
const userPreferredLang =
|
|
localStorage.getItem('preferred_lang') || navigator.language
|
|
|
|
if (
|
|
supportedLangs.includes(userPreferredLang) &&
|
|
!location.pathname.startsWith(`/${userPreferredLang}`)
|
|
) {
|
|
location.pathname = [`/${userPreferredLang}`]
|
|
.concat(location.pathname.split('/').slice(2))
|
|
.join('/')
|
|
}
|
|
})()
|