feat: Localize Sleep, Diaper, Activity, and Settings pages
Added comprehensive localization to tracking and settings pages: **Translation Keys Added:** - Sleep: locations, status, duration formatting, success/delete messages - Diaper: conditions, rash severity and alert, success/delete messages - Activity: activity types, form labels, placeholders - Settings: profile, preferences, notifications, appearance, account actions - Common: shared labels (selectChild, noChildrenAdded, etc.) **Pages Localized:** 1. Sleep tracking page (/app/track/sleep/page.tsx) - All form labels and dropdowns - Location options (crib, bed, stroller, carrier, other) - Sleep status (completed/ongoing) - Duration display with interpolation - Success and delete messages 2. Diaper tracking page (/app/track/diaper/page.tsx) - Diaper types (wet, dirty, both, dry) - Conditions (normal, soft, hard, watery, mucus, blood) - Rash detection with severity levels - Alert message for diaper rash - Recent diapers display with translated labels 3. Activity tracking page (/app/track/activity/page.tsx) - Activity types (play, walk, music, reading, tummy time, outdoor, other) - Duration and description fields - Form placeholders - Recent activities display 4. Settings page (/app/settings/page.tsx) - Profile information section - Preferences, notifications, appearance sections - Account actions (logout) - Save/saving button states - Success message All pages now support multi-language translation and are ready for Spanish, French, Portuguese, and Chinese translations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -230,7 +230,7 @@ export default function SleepTrackPage() {
|
||||
notes: notes || undefined,
|
||||
});
|
||||
|
||||
setSuccessMessage('Sleep logged successfully!');
|
||||
setSuccessMessage(t('sleep.success'));
|
||||
|
||||
// Reset form
|
||||
resetForm();
|
||||
@@ -265,7 +265,7 @@ export default function SleepTrackPage() {
|
||||
try {
|
||||
setLoading(true);
|
||||
await trackingApi.deleteActivity(activityToDelete);
|
||||
setSuccessMessage('Sleep deleted successfully');
|
||||
setSuccessMessage(t('sleep.deleted'));
|
||||
setDeleteDialogOpen(false);
|
||||
setActivityToDelete(null);
|
||||
await loadRecentSleeps();
|
||||
@@ -314,7 +314,7 @@ export default function SleepTrackPage() {
|
||||
const duration = data.endTime
|
||||
? formatDuration(data.startTime, data.endTime)
|
||||
: data.isOngoing
|
||||
? `Ongoing - ${formatDuration(data.startTime)}`
|
||||
? t('sleep.ongoing_duration', { duration: formatDuration(data.startTime) })
|
||||
: 'No end time';
|
||||
|
||||
return `${duration} - ${data.location.charAt(0).toUpperCase() + data.location.slice(1)}`;
|
||||
@@ -349,17 +349,17 @@ export default function SleepTrackPage() {
|
||||
<CardContent sx={{ textAlign: 'center', py: 8 }}>
|
||||
<ChildCare sx={{ fontSize: 64, color: 'text.secondary', mb: 2 }} />
|
||||
<Typography variant="h6" color="text.secondary" gutterBottom>
|
||||
No Children Added
|
||||
{t('common.noChildrenAdded')}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary" sx={{ mb: 3 }}>
|
||||
You need to add a child before you can track sleep activities
|
||||
{t('common.noChildrenMessage')}
|
||||
</Typography>
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<Add />}
|
||||
onClick={() => router.push('/children')}
|
||||
>
|
||||
Add Child
|
||||
{t('common.addChild')}
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -396,11 +396,11 @@ export default function SleepTrackPage() {
|
||||
{children.length > 1 && (
|
||||
<Paper sx={{ p: 2, mb: 3 }}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>Select Child</InputLabel>
|
||||
<InputLabel>{t('common.selectChild')}</InputLabel>
|
||||
<Select
|
||||
value={selectedChild}
|
||||
onChange={(e) => setSelectedChild(e.target.value)}
|
||||
label="Select Child"
|
||||
label={t('common.selectChild')}
|
||||
>
|
||||
{children.map((child) => (
|
||||
<MenuItem key={child.id} value={child.id}>
|
||||
@@ -428,7 +428,7 @@ export default function SleepTrackPage() {
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
<Button variant="outlined" onClick={setStartNow} sx={{ minWidth: 100 }}>
|
||||
Now
|
||||
{t('sleep.now')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -436,14 +436,14 @@ export default function SleepTrackPage() {
|
||||
{/* Ongoing Checkbox */}
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel>Sleep Status</InputLabel>
|
||||
<InputLabel>{t('sleep.status.title')}</InputLabel>
|
||||
<Select
|
||||
value={isOngoing ? 'ongoing' : 'completed'}
|
||||
onChange={(e) => setIsOngoing(e.target.value === 'ongoing')}
|
||||
label="Sleep Status"
|
||||
label={t('sleep.status.title')}
|
||||
>
|
||||
<MenuItem value="completed">Completed (has end time)</MenuItem>
|
||||
<MenuItem value="ongoing">Ongoing (still sleeping)</MenuItem>
|
||||
<MenuItem value="completed">{t('sleep.status.completed')}</MenuItem>
|
||||
<MenuItem value="ongoing">{t('sleep.status.ongoing')}</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Box>
|
||||
@@ -463,7 +463,7 @@ export default function SleepTrackPage() {
|
||||
InputLabelProps={{ shrink: true }}
|
||||
/>
|
||||
<Button variant="outlined" onClick={setEndNow} sx={{ minWidth: 100 }}>
|
||||
Now
|
||||
{t('sleep.now')}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -473,7 +473,7 @@ export default function SleepTrackPage() {
|
||||
{calculateDuration() && (
|
||||
<Box sx={{ mb: 3, textAlign: 'center' }}>
|
||||
<Chip
|
||||
label={`Duration: ${calculateDuration()}`}
|
||||
label={`${t('sleep.duration')}: ${calculateDuration()}`}
|
||||
color="primary"
|
||||
sx={{ fontSize: '1rem', py: 3 }}
|
||||
/>
|
||||
@@ -497,17 +497,17 @@ export default function SleepTrackPage() {
|
||||
|
||||
{/* Location */}
|
||||
<FormControl fullWidth sx={{ mb: 3 }}>
|
||||
<InputLabel>Location</InputLabel>
|
||||
<InputLabel>{t('sleep.location')}</InputLabel>
|
||||
<Select
|
||||
value={location}
|
||||
onChange={(e) => setLocation(e.target.value)}
|
||||
label="Location"
|
||||
label={t('sleep.location')}
|
||||
>
|
||||
<MenuItem value="crib">Crib</MenuItem>
|
||||
<MenuItem value="bed">Bed</MenuItem>
|
||||
<MenuItem value="stroller">Stroller</MenuItem>
|
||||
<MenuItem value="carrier">Carrier</MenuItem>
|
||||
<MenuItem value="other">Other</MenuItem>
|
||||
<MenuItem value="crib">{t('sleep.locations.crib')}</MenuItem>
|
||||
<MenuItem value="bed">{t('sleep.locations.bed')}</MenuItem>
|
||||
<MenuItem value="stroller">{t('sleep.locations.stroller')}</MenuItem>
|
||||
<MenuItem value="carrier">{t('sleep.locations.carrier')}</MenuItem>
|
||||
<MenuItem value="other">{t('sleep.locations.other')}</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
|
||||
@@ -533,7 +533,7 @@ export default function SleepTrackPage() {
|
||||
onClick={handleSubmit}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? t('sleep.addSleep') : t('sleep.addSleep')}
|
||||
{loading ? t('sleep.logSleep') : t('sleep.logSleep')}
|
||||
</Button>
|
||||
</Paper>
|
||||
|
||||
@@ -541,7 +541,7 @@ export default function SleepTrackPage() {
|
||||
<Paper sx={{ p: 3 }}>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
|
||||
<Typography variant="h6" fontWeight="600">
|
||||
{t('sleep.title')}
|
||||
{t('sleep.recentSleeps')}
|
||||
</Typography>
|
||||
<IconButton onClick={loadRecentSleeps} disabled={sleepsLoading}>
|
||||
<Refresh />
|
||||
@@ -581,7 +581,7 @@ export default function SleepTrackPage() {
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5, flexWrap: 'wrap' }}>
|
||||
<Typography variant="body1" fontWeight="600">
|
||||
Sleep
|
||||
{t('sleep.title')}
|
||||
</Typography>
|
||||
<Chip
|
||||
label={data.quality.charAt(0).toUpperCase() + data.quality.slice(1)}
|
||||
@@ -638,10 +638,10 @@ export default function SleepTrackPage() {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setDeleteDialogOpen(false)} disabled={loading}>
|
||||
Cancel
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
<Button onClick={handleDeleteConfirm} color="error" disabled={loading}>
|
||||
{loading ? t('deleteEntry') : t('deleteEntry')}
|
||||
{loading ? t('common.delete') : t('common.delete')}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
Reference in New Issue
Block a user