TTikotok V4
This commit is contained in:
@@ -17,9 +17,11 @@ const LangContext = createContext<LangCtx>({
|
||||
|
||||
function getInitialLang(): Lang {
|
||||
if (typeof document === 'undefined') return 'de'
|
||||
if (window.location.pathname === '/') return 'de'
|
||||
if (window.location.pathname === '/de' || window.location.pathname.startsWith('/de/')) return 'de'
|
||||
if (window.location.pathname === '/es' || window.location.pathname.startsWith('/es/')) return 'es'
|
||||
const pathname = window.location.pathname
|
||||
if (pathname === '/') return 'de'
|
||||
if (pathname === '/en' || pathname.startsWith('/en/')) return 'en'
|
||||
if (pathname === '/de' || pathname.startsWith('/de/')) return 'de'
|
||||
if (pathname === '/es' || pathname.startsWith('/es/')) return 'es'
|
||||
const match = document.cookie.match(/(?:^|;\s*)lang=([^;]+)/)
|
||||
const val = match?.[1]
|
||||
return val === 'en' || val === 'es' || val === 'de' ? val : 'de'
|
||||
|
||||
Reference in New Issue
Block a user