Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions frontend/src/i18n/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@ Object.entries(localeFiles).forEach(([path, module]) => {
})

const getStoredLanguage = (): string => {
let stored: string | null = null
try {
const stored = localStorage.getItem('altsendme-language')
return stored || 'en'
stored = localStorage.getItem('altsendme-language')
} catch {
// Continue with browser-locale detection when storage is unavailable.
}

try {
const tag = (navigator.language || 'en').toLowerCase()
const keys = Object.keys(resources)
const pick = (t: string) => keys.find((k) => k.toLowerCase().startsWith(t))
return stored || pick(tag) || pick(tag.slice(0, 2)) || 'en'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
} catch {
return 'en'
}
Expand Down
Loading