2026.06.05 frontend javítgatás és új belépési logika megvalósítva

This commit is contained in:
Roo
2026-06-05 05:46:04 +00:00
parent 59a30ac428
commit 18524a08f2
38 changed files with 3967 additions and 1028 deletions

View File

@@ -12,9 +12,31 @@ const messages = {
en,
}
/**
* Determine the initial locale:
* 1. If a saved locale exists in localStorage, use it.
* 2. Otherwise, detect the browser language (navigator.language).
* If it starts with 'hu', use 'hu'. For everything else, use 'en'.
*/
function detectLocale(): string {
const saved = localStorage.getItem('user-locale')
if (saved) return saved
if (typeof navigator !== 'undefined' && navigator.language) {
const browserLang = navigator.language.toLowerCase()
if (browserLang === 'hu' || browserLang.startsWith('hu-')) {
return 'hu'
}
}
return 'en'
}
const initialLocale = detectLocale()
const i18n = createI18n({
legacy: false,
locale: 'hu',
locale: initialLocale,
fallbackLocale: 'en',
messages,
})