Files
maternal-app/maternal-web/locales/es/errors.json
Andrei c1e37d30b0
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
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>
2025-10-03 10:52:38 +00:00

70 lines
2.8 KiB
JSON

{
"general": {
"unknown": "An unknown error occurred",
"networkError": "Network error. Please check your connection.",
"serverError": "Server error. Please try again later.",
"notFound": "The requested resource was not found",
"unauthorized": "You are not authorized to perform this action",
"forbidden": "Access denied",
"validation": "Please check your input and try again",
"timeout": "Request timed out. Please try again."
},
"auth": {
"invalidCredentials": "Invalid email or password",
"emailExists": "An account with this email already exists",
"emailNotVerified": "Please verify your email address",
"accountLocked": "Your account has been locked. Please contact support.",
"sessionExpired": "Your session has expired. Please sign in again.",
"weakPassword": "Password is too weak",
"tokenInvalid": "Invalid or expired token",
"deviceNotTrusted": "Device not trusted. Please verify your device."
},
"family": {
"limitExceeded": "Family size limit exceeded",
"memberNotFound": "Family member not found",
"cannotRemoveSelf": "You cannot remove yourself from the family",
"insufficientPermissions": "You don't have permission to perform this action",
"invitationExpired": "This invitation has expired",
"alreadyMember": "This person is already a family member"
},
"child": {
"notFound": "Child profile not found",
"invalidAge": "Invalid age. Please check the date of birth.",
"limitExceeded": "You've reached the maximum number of children"
},
"tracking": {
"invalidData": "Invalid tracking data",
"futureDate": "You cannot log activities in the future",
"duplicateEntry": "A similar entry already exists",
"invalidDuration": "Invalid duration",
"invalidAmount": "Invalid amount"
},
"ai": {
"dailyLimitReached": "Daily AI question limit reached",
"contextError": "Failed to load context for AI",
"responseError": "Failed to generate AI response",
"moderationFlag": "Your message was flagged by our content moderation system"
},
"offline": {
"noConnection": "No internet connection",
"syncFailed": "Failed to sync data",
"pendingChanges": "You have pending changes that need to be synced"
},
"validation": {
"required": "This field is required",
"invalidEmail": "Please enter a valid email address",
"invalidPhone": "Please enter a valid phone number",
"invalidDate": "Please enter a valid date",
"minLength": "Must be at least {{min}} characters",
"maxLength": "Must be no more than {{max}} characters",
"minValue": "Must be at least {{min}}",
"maxValue": "Must be no more than {{max}}",
"invalidFormat": "Invalid format",
"passwordMismatch": "Passwords do not match"
},
"retry": "Retry",
"goBack": "Go Back",
"contactSupport": "Contact Support",
"dismiss": "Dismiss"
}