feat(i18n): Enhance internationalization with dynamic locale management

- Add comprehensive locale management with `useLocale` composable
- Implement dynamic locale loading and persistent storage
- Create type-safe internationalization infrastructure
- Add flag emojis and locale selection utilities
- Expand English locale with more comprehensive message schemas
This commit is contained in:
padreug 2025-03-09 13:27:45 +01:00
parent b359838f2a
commit f02576d94a
5 changed files with 1436 additions and 150 deletions

53
src/i18n/types.ts Normal file
View file

@ -0,0 +1,53 @@
export interface LocaleMessages {
nav: {
title: string
home: string
directory: string
faq: string
support: string
login: string
logout: string
}
// Add more message categories here
common: {
loading: string
error: string
success: string
}
errors: {
notFound: string
serverError: string
networkError: string
}
// Add date/time formats
dateTimeFormats: {
short: {
year: 'numeric'
month: 'short'
day: 'numeric'
}
long: {
year: 'numeric'
month: 'long'
day: 'numeric'
weekday: 'long'
hour: 'numeric'
minute: 'numeric'
}
}
// Add number formats
numberFormats: {
currency: {
style: 'currency'
currencyDisplay: 'symbol'
}
decimal: {
style: 'decimal'
minimumFractionDigits: 2
}
percent: {
style: 'percent'
useGrouping: false
}
}
}