feat: Implement frontend localization with i18n and measurement units
Implemented comprehensive frontend localization infrastructure supporting 5 languages (English, Spanish, French, Portuguese, Chinese) with measurement unit preferences (Metric/Imperial). This lays the foundation for international user support. **Core Infrastructure:** - Installed i18next, react-i18next, i18next-browser-languagedetector - Created I18nProvider component integrated into app layout - Configured i18next with language detection and localStorage persistence - Created 35 translation files (5 languages × 7 namespaces) **Translation Namespaces:** - common: App-wide UI elements, navigation, actions - tracking: Activity tracking (feeding, sleep, diaper, milestones) - ai: AI assistant chat interface - auth: Authentication flows (login, signup, password reset) - settings: Settings and preferences - onboarding: Onboarding flow - errors: Error messages and validation **Custom Hooks:** - useTranslation: Type-safe translation wrapper - useLocale: Language and measurement system management - useFormatting: Date, time, number, and unit formatting **Measurement Unit Support:** - Created unit conversion utilities (weight, height, temperature, volume) - Metric: kg, cm, °C, ml - Imperial: lb, in, °F, oz - Bidirectional conversion functions **UI Components:** - LanguageSelector: Dropdown to change app language - MeasurementUnitSelector: Toggle between Metric/Imperial - Integrated both into Settings page Preferences section **Next Steps (Remaining):** - Add measurement preferences to backend user schema - Create onboarding flow with language/measurement selection - Apply translations to existing components (dashboard, tracking forms) - Implement multi-language AI responses - Add professional translations (currently using basic translations) **File Highlights:** - lib/i18n/config.ts: i18next configuration - hooks/useFormatting.ts: Formatting utilities with locale support - lib/utils/unitConversion.ts: Unit conversion logic - components/settings/*Selector.tsx: Language and measurement selectors - locales/*/: Translation files for 5 languages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
66
maternal-web/locales/es/common.json
Normal file
66
maternal-web/locales/es/common.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"appName": "Maternal",
|
||||
"appDescription": "Asistente de Cuidado Infantil con IA",
|
||||
"welcome": "Bienvenido",
|
||||
"loading": "Cargando...",
|
||||
"save": "Guardar",
|
||||
"cancel": "Cancelar",
|
||||
"delete": "Eliminar",
|
||||
"edit": "Editar",
|
||||
"add": "Agregar",
|
||||
"close": "Cerrar",
|
||||
"confirm": "Confirmar",
|
||||
"back": "Atrás",
|
||||
"next": "Siguiente",
|
||||
"previous": "Anterior",
|
||||
"finish": "Finalizar",
|
||||
"search": "Buscar",
|
||||
"filter": "Filtrar",
|
||||
"sort": "Ordenar",
|
||||
"refresh": "Actualizar",
|
||||
"retry": "Reintentar",
|
||||
"continue": "Continuar",
|
||||
"submit": "Enviar",
|
||||
"reset": "Restablecer",
|
||||
"clear": "Limpiar",
|
||||
"yes": "Sí",
|
||||
"no": "No",
|
||||
"ok": "OK",
|
||||
"error": "Error",
|
||||
"success": "Éxito",
|
||||
"warning": "Advertencia",
|
||||
"info": "Información",
|
||||
"home": "Inicio",
|
||||
"settings": "Configuración",
|
||||
"profile": "Perfil",
|
||||
"logout": "Cerrar sesión",
|
||||
"login": "Iniciar sesión",
|
||||
"signup": "Registrarse",
|
||||
"email": "Correo electrónico",
|
||||
"password": "Contraseña",
|
||||
"name": "Nombre",
|
||||
"date": "Fecha",
|
||||
"time": "Hora",
|
||||
"duration": "Duración",
|
||||
"notes": "Notas",
|
||||
"optional": "Opcional",
|
||||
"required": "Obligatorio",
|
||||
"units": {
|
||||
"metric": "Métrico",
|
||||
"imperial": "Imperial"
|
||||
},
|
||||
"measurements": {
|
||||
"weight": "Peso",
|
||||
"height": "Altura",
|
||||
"temperature": "Temperatura",
|
||||
"volume": "Volumen"
|
||||
},
|
||||
"navigation": {
|
||||
"home": "Inicio",
|
||||
"tracking": "Seguimiento",
|
||||
"ai": "Asistente IA",
|
||||
"family": "Familia",
|
||||
"insights": "Análisis",
|
||||
"settings": "Configuración"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user