feat(i18n): Add localized language names to internationalization schema
- Extend `LocaleMessages` type with `locales` field for language names - Update English, Spanish, and French locales with native language names - Enhance internationalization type safety and locale representation
This commit is contained in:
parent
f02576d94a
commit
1242d9179d
4 changed files with 130 additions and 4 deletions
|
|
@ -20,6 +20,13 @@ const messages: LocaleMessages = {
|
|||
serverError: 'Server error occurred',
|
||||
networkError: 'Network connection error'
|
||||
},
|
||||
locales: {
|
||||
en: 'English',
|
||||
es: 'Spanish',
|
||||
fr: 'French',
|
||||
de: 'German',
|
||||
zh: 'Chinese'
|
||||
},
|
||||
dateTimeFormats: {
|
||||
short: {
|
||||
year: 'numeric',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,61 @@
|
|||
export default {
|
||||
import type { LocaleMessages } from '../types'
|
||||
|
||||
const messages: LocaleMessages = {
|
||||
nav: {
|
||||
title: 'Título de la Aplicación',
|
||||
home: 'Inicio',
|
||||
directory: 'Directorio',
|
||||
faq: 'Preguntas',
|
||||
title: 'Titulo Aqui',
|
||||
faq: 'Preguntas Frecuentes',
|
||||
support: 'Soporte',
|
||||
login: 'Iniciar Sesión',
|
||||
logout: 'Cerrar Sesión'
|
||||
},
|
||||
}
|
||||
common: {
|
||||
loading: 'Cargando...',
|
||||
error: 'Ha ocurrido un error',
|
||||
success: 'Operación exitosa'
|
||||
},
|
||||
errors: {
|
||||
notFound: 'Página no encontrada',
|
||||
serverError: 'Error del servidor',
|
||||
networkError: 'Error de conexión de red'
|
||||
},
|
||||
locales: {
|
||||
en: 'Inglés',
|
||||
es: 'Español',
|
||||
fr: 'Francés',
|
||||
de: 'Alemán',
|
||||
zh: 'Chino'
|
||||
},
|
||||
dateTimeFormats: {
|
||||
short: {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
},
|
||||
long: {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric'
|
||||
}
|
||||
},
|
||||
numberFormats: {
|
||||
currency: {
|
||||
style: 'currency',
|
||||
currencyDisplay: 'symbol'
|
||||
},
|
||||
decimal: {
|
||||
style: 'decimal',
|
||||
minimumFractionDigits: 2
|
||||
},
|
||||
percent: {
|
||||
style: 'percent',
|
||||
useGrouping: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default messages
|
||||
|
|
|
|||
61
src/i18n/locales/fr.ts
Normal file
61
src/i18n/locales/fr.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import type { LocaleMessages } from '../types'
|
||||
|
||||
const messages: LocaleMessages = {
|
||||
nav: {
|
||||
title: 'Titre de l\'Application',
|
||||
home: 'Accueil',
|
||||
directory: 'Répertoire',
|
||||
faq: 'FAQ',
|
||||
support: 'Support',
|
||||
login: 'Connexion',
|
||||
logout: 'Déconnexion'
|
||||
},
|
||||
common: {
|
||||
loading: 'Chargement...',
|
||||
error: 'Une erreur est survenue',
|
||||
success: 'Opération réussie'
|
||||
},
|
||||
errors: {
|
||||
notFound: 'Page non trouvée',
|
||||
serverError: 'Erreur du serveur',
|
||||
networkError: 'Erreur de connexion réseau'
|
||||
},
|
||||
locales: {
|
||||
en: 'Anglais',
|
||||
es: 'Espagnol',
|
||||
fr: 'Français',
|
||||
de: 'Allemand',
|
||||
zh: 'Chinois'
|
||||
},
|
||||
dateTimeFormats: {
|
||||
short: {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric'
|
||||
},
|
||||
long: {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric'
|
||||
}
|
||||
},
|
||||
numberFormats: {
|
||||
currency: {
|
||||
style: 'currency',
|
||||
currencyDisplay: 'symbol'
|
||||
},
|
||||
decimal: {
|
||||
style: 'decimal',
|
||||
minimumFractionDigits: 2
|
||||
},
|
||||
percent: {
|
||||
style: 'percent',
|
||||
useGrouping: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default messages
|
||||
|
|
@ -19,6 +19,14 @@ export interface LocaleMessages {
|
|||
serverError: string
|
||||
networkError: string
|
||||
}
|
||||
// Language names in the current language
|
||||
locales: {
|
||||
en: string
|
||||
es: string
|
||||
fr: string
|
||||
de: string
|
||||
zh: string
|
||||
}
|
||||
// Add date/time formats
|
||||
dateTimeFormats: {
|
||||
short: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue