Files
maternal-app/maternal-web/locales/zh/common.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

67 lines
1.4 KiB
JSON

{
"appName": "Maternal",
"appDescription": "AI驱动的儿童护理助手",
"welcome": "欢迎",
"loading": "加载中...",
"save": "保存",
"cancel": "取消",
"delete": "删除",
"edit": "编辑",
"add": "添加",
"close": "关闭",
"confirm": "确认",
"back": "返回",
"next": "下一步",
"previous": "上一步",
"finish": "完成",
"search": "搜索",
"filter": "筛选",
"sort": "排序",
"refresh": "刷新",
"retry": "重试",
"continue": "继续",
"submit": "提交",
"reset": "重置",
"clear": "清除",
"yes": "是",
"no": "否",
"ok": "确定",
"error": "错误",
"success": "成功",
"warning": "警告",
"info": "信息",
"home": "首页",
"settings": "设置",
"profile": "个人资料",
"logout": "退出",
"login": "登录",
"signup": "注册",
"email": "邮箱",
"password": "密码",
"name": "姓名",
"date": "日期",
"time": "时间",
"duration": "持续时间",
"notes": "备注",
"optional": "可选",
"required": "必填",
"units": {
"metric": "公制",
"imperial": "英制"
},
"measurements": {
"weight": "体重",
"height": "身高",
"temperature": "温度",
"volume": "容量"
},
"navigation": {
"home": "首页",
"tracking": "追踪",
"ai": "AI助手",
"family": "家庭",
"insights": "分析",
"settings": "设置"
}
}