From cc2e656e142ea7f4f4703f3559e63b981e7e1843 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Tue, 18 Aug 2026 00:06:34 -0400 Subject: [PATCH 1/6] update localization for notifications, colors, and icons across multiple components --- public/locales/en/chores.json | 17 +++++++++++- public/locales/en/common.json | 26 +++++++++++++++++++ public/locales/en/history.json | 14 ++++++++++ public/locales/en/projects.json | 26 +++++++++++++++++++ src/components/NotificationTemplate.jsx | 26 +++++++++---------- .../Modals/Inputs/AdvancedFilterBuilder.jsx | 2 +- src/views/Modals/Inputs/IconPickerModal.jsx | 2 +- 7 files changed, 97 insertions(+), 16 deletions(-) diff --git a/public/locales/en/chores.json b/public/locales/en/chores.json index 6555089..f929aac 100644 --- a/public/locales/en/chores.json +++ b/public/locales/en/chores.json @@ -394,8 +394,23 @@ "failedScan": "Failed scan" }, "descriptionPlaceholder": "Enter description...", - "notifTemplate": { + "notificationTemplate": { "onDueDate": "On due date", + "timing": { + "before": "Before", + "ondue": "Due", + "after": "After" + }, + "unitName": { + "m": "minutes", + "h": "hours", + "d": "days" + }, + "unitShort": { + "m": "Mins", + "h": "Hours", + "d": "Days" + }, "beforeDue": "{{count}} {{unit}} before due", "afterDue": "{{count}} {{unit}} after due", "errDuplicate": "This notification setting already exists. Please use a different timing.", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 6801e6f..f2a5667 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -9,6 +9,32 @@ "error": "Error", "success": "Success", "warning": "Warning", + "colors": { + "Salmon": "Salmon", + "Teal": "Teal", + "Sky Blue": "Sky Blue", + "Grape": "Grape", + "Sunshine": "Sunshine", + "Coral": "Coral", + "Lavender": "Lavender", + "Rose": "Rose", + "Charcoal": "Charcoal", + "Sienna": "Sienna", + "Mint": "Mint", + "Amber": "Amber", + "Cobalt": "Cobalt", + "Emerald": "Emerald", + "Peach": "Peach", + "Ocean": "Ocean", + "Mustard": "Mustard", + "Ruby": "Ruby", + "Periwinkle": "Periwinkle", + "Turquoise": "Turquoise", + "Lime": "Lime", + "Blush": "Blush", + "Ash": "Ash", + "Sand": "Sand" + }, "refresh": "Refresh", "copy": "Copy", "copied": "Copied!", diff --git a/public/locales/en/history.json b/public/locales/en/history.json index 9d4b256..d0da7fe 100644 --- a/public/locales/en/history.json +++ b/public/locales/en/history.json @@ -21,6 +21,20 @@ "onTime": "On Time", "onTimeLabel": "On time" }, + "card": { + "wasDue": "Was due {{date}}", + "daysBeforeDue_one": "{{count}}d before due date", + "daysBeforeDue_other": "{{count}}d before due date", + "daysAfterDue_one": "{{count}}d after due date", + "daysAfterDue_other": "{{count}}d after due date", + "hoursBeforeDue_one": "{{count}}h before due date", + "hoursBeforeDue_other": "{{count}}h before due date", + "hoursAfterDue_one": "{{count}}h after due date", + "hoursAfterDue_other": "{{count}}h after due date", + "assignedTo": "Assigned to {{name}}", + "points_one": "★ {{count}} pt", + "points_other": "★ {{count}} pts" + }, "detail": { "title": "Activity Detail", "openTask": "Open Task", diff --git a/public/locales/en/projects.json b/public/locales/en/projects.json index d9c34d8..97c2f62 100644 --- a/public/locales/en/projects.json +++ b/public/locales/en/projects.json @@ -3,6 +3,32 @@ "chooseIcon": "Choose Project Icon", "availableIcons": "Available Icons" }, + "icons": { + "FolderOpen": "Folder", + "Work": "Work", + "Home": "Home", + "School": "School", + "BusinessCenter": "Business", + "Code": "Code", + "Build": "Build", + "Palette": "Design", + "SportsSoccer": "Sports", + "FitnessCenter": "Fitness", + "ShoppingCart": "Shopping", + "Restaurant": "Food", + "Flight": "Travel", + "Book": "Study", + "MusicNote": "Music", + "PhotoCamera": "Photo", + "Games": "Games", + "Science": "Science", + "AccountBalance": "Finance", + "LocalHospital": "Health", + "DirectionsCar": "Auto", + "Pets": "Pets", + "Garden": "Garden", + "Computer": "Tech" + }, "defaultChip": "Default", "tasks_one": "{{count}} task", "tasks_other": "{{count}} tasks", diff --git a/src/components/NotificationTemplate.jsx b/src/components/NotificationTemplate.jsx index 2db2d90..66c8644 100644 --- a/src/components/NotificationTemplate.jsx +++ b/src/components/NotificationTemplate.jsx @@ -30,13 +30,13 @@ function getRelativeLabel(notification, t) { const { unit, value } = notification const numericValue = Number(value) if (numericValue === 0) { - return t('notifTemplate.onDueDate') + return t('notificationTemplate.onDueDate') } - const unitName = t(`notifTemplate.unitName.${unit}`) + const unitName = t(`notificationTemplate.unitName.${unit}`) const absValue = Math.abs(numericValue) return numericValue < 0 - ? t('notifTemplate.beforeDue', { count: absValue, unit: unitName }) - : t('notifTemplate.afterDue', { count: absValue, unit: unitName }) + ? t('notificationTemplate.beforeDue', { count: absValue, unit: unitName }) + : t('notificationTemplate.afterDue', { count: absValue, unit: unitName }) } // Helper functions to convert between internal value and UI representation @@ -223,7 +223,7 @@ const NotificationTemplate = ({ if (!currentNotification) return if (isDuplicate(currentNotification, idx, currentList)) { - setError(t('notifTemplate.errDuplicate')) + setError(t('notificationTemplate.errDuplicate')) return } } @@ -235,14 +235,14 @@ const NotificationTemplate = ({ if (type === 'due') { if (notificationsRef.current.some(n => Number(n.value) === 0)) { - setError(t('notifTemplate.errOneDue')) + setError(t('notificationTemplate.errOneDue')) return } newNotification = { value: 0, unit: 'm' } } else { newNotification = getSmartSuggestion(type) if (!newNotification) { - setError(t('notifTemplate.errAllConfigured', { type })) + setError(t('notificationTemplate.errAllConfigured', { type })) return } } @@ -578,7 +578,7 @@ const NotificationTemplate = ({ value={opt.value} disabled={opt.value === 'ondue' && hasOnDueElsewhere} > - {t(`notifTemplate.timing.${opt.value}`)} + {t(`notificationTemplate.timing.${opt.value}`)} ))} @@ -641,7 +641,7 @@ const NotificationTemplate = ({ > {timeUnits.map(opt => ( ))} @@ -691,7 +691,7 @@ const NotificationTemplate = ({ }, }} > - {t('notifTemplate.reminder')} + {t('notificationTemplate.reminder')} {showSaveDefault && ( @@ -765,7 +765,7 @@ const NotificationTemplate = ({ setShowSaveDefault(false) }} > - {t('notifTemplate.rememberFuture')} + {t('notificationTemplate.rememberFuture')} )} diff --git a/src/views/Modals/Inputs/AdvancedFilterBuilder.jsx b/src/views/Modals/Inputs/AdvancedFilterBuilder.jsx index 8f01b96..9e150eb 100644 --- a/src/views/Modals/Inputs/AdvancedFilterBuilder.jsx +++ b/src/views/Modals/Inputs/AdvancedFilterBuilder.jsx @@ -202,7 +202,7 @@ const AdvancedFilterBuilder = ({ {FILTER_COLORS.map(c => ( setFilterColor(c.value)} sx={{ width: 26, diff --git a/src/views/Modals/Inputs/IconPickerModal.jsx b/src/views/Modals/Inputs/IconPickerModal.jsx index 1dcab74..8e1b1d7 100644 --- a/src/views/Modals/Inputs/IconPickerModal.jsx +++ b/src/views/Modals/Inputs/IconPickerModal.jsx @@ -90,7 +90,7 @@ const IconPickerModal = ({ lineHeight: 1.2, }} > - {t(`icons.${iconData.key}`)} + {t(`icons.${iconData.value}`)} From c1318a2cc4f59df09e89bc98feeee2c7cd7b9f32 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Tue, 18 Aug 2026 01:11:26 -0400 Subject: [PATCH 2/6] feat: add i18n support to Settings and AddTaskModal components - Integrated translation functionality using react-i18next in Settings.jsx - Replaced hardcoded strings with translation keys for better localization support - Updated AddTaskModal.jsx to include translations for task-related strings - Enhanced user experience by providing localized messages for various actions and notifications --- public/locales/en/chores.json | 133 ++ public/locales/en/common.json | 87 +- public/locales/en/settings.json | 9 +- src/views/ChoreEdit/ChoreEdit.jsx | 289 ++--- src/views/Onboarding/OnboardingVignettes.jsx | 1137 +++++++++--------- src/views/Settings/Settings.jsx | 270 ++--- src/views/components/AddTaskModal.jsx | 40 +- 7 files changed, 1130 insertions(+), 835 deletions(-) diff --git a/public/locales/en/chores.json b/public/locales/en/chores.json index f929aac..892905d 100644 --- a/public/locales/en/chores.json +++ b/public/locales/en/chores.json @@ -420,5 +420,138 @@ "dueAlert": "Due Alert", "followUp": "Follow-up", "rememberFuture": "Remember for Future Tasks" + }, + "choreEdit": { + "errNameRequired": "Name is required", + "errFrequencyInvalid": "Invalid frequency, the {{unit}} should be > 0", + "errSelectDayOfWeek": "Please select at least one day of the week", + "errSelectDayOccurrence": "Please select at least one day occurrence for the month", + "errSelectMonth": "Please select at least one month", + "errStartDateRequired": "Start date is required", + "errDueDateRequired": "Due date is required", + "errThingTrigger": "Thing trigger is invalid", + "errTitle": "Please resolve the following errors:", + "savedOfflineTitle": "Saved Offline", + "savedOfflineMessage": "Your changes will sync when you are back online.", + "savedTitle": "Chore Saved", + "savedMessage": "Your task has been saved successfully!", + "saveFailedTitle": "Save Failed", + "saveFailedMessage": "Failed to save chore, please try again.", + "uploadFailedTitle": "Upload Failed", + "uploadFailedMessage": "Failed to upload attachment.", + "scanFailedTitle": "Scan Failed", + "scanFailedMessage": "Could not scan the document.", + "scanReadFailedMessage": "Could not read the scanned image.", + "deleteFailedTitle": "Delete Failed", + "deleteAttachmentFailed": "Failed to delete attachment.", + "deleteChoreFailed": "Failed to delete chore: {{error}}", + "deleteChoreTitle": "Delete Chore", + "name": "Name", + "nameDesc": "What is the name of this task?", + "description": "Description", + "descriptionDesc": "What is this task about?", + "priority": "Priority", + "priorityDesc": "How important is this task?", + "noPriority": "No Priority", + "project": "Project", + "projectDesc": "Which project does this task belong to?", + "defaultProject": "Default Project", + "labels": "Labels", + "labelsDesc": "Things to remember about this task or to tag it", + "addNewLabel": "Add New Label", + "subTasks": "Sub Tasks", + "attachments": "Attachments", + "attachmentsDesc": "Files attached to this task", + "uploadFile": "Upload File", + "scan": "Scan", + "assignees": "Assignees", + "assigneesDesc": "Who can do this task?", + "anyone": "Anyone", + "rememberFuture": "Remember for Future Tasks", + "currentlyAssigned": "Currently Assigned To", + "currentlyAssignedDesc": "Who is assigned the next due?", + "noAssigneesPlaceholder": "No Assignees yet can perform this task", + "selectAssigneePlaceholder": "Select an assignee for this task", + "assignStrategy": "Assignment Strategy", + "assignStrategyDesc": "How to pick the next assignee for the following task?", + "strategy": { + "random": "Random", + "least_assigned": "Least Assigned", + "least_completed": "Least Completed", + "keep_last_assigned": "Keep Last Assigned", + "random_except_last_assigned": "Random Except Last Assigned", + "round_robin": "Round Robin", + "no_assignee": "No Assignee" + }, + "startDate": "Start Date", + "dueDate": "Due Date", + "triggerDueHint": "Due Date will be set when the trigger of the thing is met", + "giveDueDate": "Give this task a due date", + "giveDueDateHelp": "Task needs to be completed by a specific time", + "startWhen": "When does this task start?", + "dueWhen": "When is the next first time this task is due?", + "setSpecificTime": "Set a specific time", + "dueAtSpecifiedTime": "Task will be due at the specified time", + "dueEndOfDay": "Task will be due at the end of the day (11:59 PM)", + "timeLabel": "Time:", + "taskWindow": "Task Window", + "taskWindowDesc": "Define when this task can be completed and when it expires", + "earliestCompletion": "Set earliest completion time", + "earliestCompletionHelp": "Task becomes available to complete X hours before the due date", + "hoursLabel": "Hours:", + "hoursPlaceholder": "Hours", + "afterDueDate": "after due date", + "schedulingPrefs": "Scheduling Preferences", + "schedulingPrefsDesc": "How to reschedule the next due date?", + "rescheduleFromDue": "Reschedule from due date", + "rescheduleFromDueHelp": "the next task will be scheduled from the original due date, even if the previous task was completed late", + "rescheduleFromCompletion": "Reschedule from completion date", + "rescheduleFromCompletionHelp": "the next task will be scheduled from the actual completion date of the previous task", + "notifications": "Notifications", + "notificationsPlanWarning": "Task notifications are not available in the Basic plan. Upgrade to Plus to receive reminders when tasks are due or completed.", + "notifyForTask": "Notify for this task", + "notifyForTaskHelp": "When should receive notifications for this task", + "notificationSchedule": "Notification Schedule", + "whoToNotify": "Who to Notify", + "allAssignees": "All Assignees", + "allAssigneesHelp": "Notify all assignees", + "specificGroup": "Specific Group", + "specificGroupHelp": "Notify a specific group", + "telegramGroupIdLabel": "Telegram Group ID:", + "telegramGroupIdPlaceholder": "Telegram Group ID", + "taskSettings": "Task Settings:", + "pointsSystem": "Points System", + "assignPoints": "Assign points for completion", + "assignPointsHelp": "Assign points to this task and user will earn points when they completed it", + "pointsLabel": "Points:", + "pointsPlaceholder": "Points", + "approvalRequirement": "Approval Requirement", + "requireApproval": "Require admin approval", + "requireApprovalHelp": "This task will need approval from an admin before being marked as complete", + "privacySettings": "Privacy Settings", + "privacyDesc": "Who can see this task?", + "public": "Public", + "publicHelp": "Everyone in your circle", + "limited": "Limited", + "limitedHelp": "You and others that are assigned to the task", + "limitedDisabledHint": " (No assignees selected, Limited option is disabled)", + "createdBy": "Created by", + "updatedBy": "Updated by", + "archive": "Archive", + "unarchive": "Unarchive", + "create": "Create" + }, + "addTask": { + "title": "Create new task", + "defaultProject": "Default Project", + "anyone": "Anyone", + "taskPlaceholder": "Type your task...", + "descriptionChip": "Description", + "subtasksChip": "Subtasks", + "creating": "Creating…", + "createCount": "Create {{count}} Tasks", + "useTask": "Use Task", + "processing": "Processing", + "create": "Create" } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index f2a5667..6f175b8 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -243,5 +243,90 @@ "cancelAll": "Cancel All" }, "attachments": "Attachments", - "fileNumbered": "File {{index}}" + "fileNumbered": "File {{index}}", + "onboarding": { + "sources": { + "speak": "Speak", + "snap": "Snap", + "type": "Type" + }, + "capture": { + "voiceCaption": "Dates, labels and points from your words", + "deviceCaption": "Read on your device", + "typeCaption": "#labels @people *points as you type", + "trashTitle": "♻️ Take out the trash", + "trashDue": "Due tomorrow", + "trashRepeat": "Every Monday", + "homeLabel": "Home", + "vehicleTitle": "🚗 Vehicle Registration Renewal", + "vehicleDue": "Due Aug 3", + "acTitle": "💨 Change the AC filter", + "acDue": "Due Fri", + "acRepeat": "Every 3 months" + }, + "schedule": { + "fromDueDate": "Reschedule from due date", + "fromCompletionDate": "Reschedule from completion date", + "due": "Due", + "done": "Done", + "next": "Next" + }, + "nfc": { + "tagOnWasher": "Tag on the washer", + "tapToOpen": "Tap to open", + "swapFilter": "Swap the washer filter", + "done": "Done", + "skip": "Skip", + "startTimer": "Start timer", + "waitingApproval": "{{name}} marked it done · waiting on you", + "approve": "Approve", + "reject": "Reject", + "completed": "Completed", + "note": "Used the delicate cycle — filter needs a clean next time.", + "metaJustNow": "Just now · ★ 5 pts", + "metaLastWeek": "Last week · ★ 5 pts" + }, + "circle": { + "kitchenTitle": "Kitchen deep clean", + "kitchenDue": "Due Sat", + "kitchenRepeat": "Every week", + "takesTurns": "Takes turns" + }, + "turns": { + "binsTitle": "🗑️ Take bins to the curb", + "binsDue": "Due Tomorrow", + "binsRepeat": "Every week", + "completed": "Completed", + "metaJustNow": "Just now · ★ 5 pts" + }, + "widget": { + "schoolForms": "School forms", + "takeOutTrash": "Take out the trash", + "waterPlants": "Water the plants", + "today": "Today", + "left": "{{count}} left" + }, + "reminders": { + "trashTitle": "Take out the trash", + "trashBody": "Due in 30 minutes · Bin night", + "finishedTitle": "Amalie finished Kitchen deep clean", + "finishedBody": "Your turn is next Saturday" + }, + "things": { + "waterBill": "Water bill", + "acFilter": "AC filter", + "trashDay": "Trash day", + "dogMedicine": "Dog's medicine", + "whoseTurn": "Whose turn to cook", + "monthly": "Monthly", + "everyThreeMonths": "Every 3 months", + "everyMonday": "Every Monday", + "daily": "Daily", + "weekly": "Weekly", + "tagBills": "Bills", + "tagHome": "Home", + "tagPets": "Pets", + "tagCooking": "Cooking" + } + } } diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index ba1e81c..18847d2 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -168,7 +168,8 @@ "joinCircle": "Join Circle", "joinedPending": "Joined circle successfully, wait for the circle owner to accept your request.", "alreadyMember": "You are already a member of this circle", - "joinFailed": "Failed to join circle" + "joinFailed": "Failed to join circle", + "copyLink": "Copy Link" }, "accountSettings": { "title": "Account Settings", @@ -423,7 +424,8 @@ "name": "Weekly Goals", "description": "Shows weekly progress and family completion stats" } - } + }, + "detailedDescription": "Customize the layout and visibility of cards in the sidepanel. the section only available on large screen devices such as tablets and desktops.." }, "theme": { "title": "Theme Preferences", @@ -457,7 +459,8 @@ "ymd": "YYYY-MM-DD (ISO)", "long": "Long format (e.g., January 1, 2024)", "short": "Short format (e.g., Jan 1, 2024)" - } + }, + "descriptionLong": "Customize language, date format, and regional preferences for your account. These settings will apply throughout the application." }, "advanced": { "title": "Advanced Settings", diff --git a/src/views/ChoreEdit/ChoreEdit.jsx b/src/views/ChoreEdit/ChoreEdit.jsx index fbceee6..a599a6c 100644 --- a/src/views/ChoreEdit/ChoreEdit.jsx +++ b/src/views/ChoreEdit/ChoreEdit.jsx @@ -37,6 +37,7 @@ import { } from '@mui/joy' import moment from 'moment' import { useEffect, useState } from 'react' +import { useTranslation } from 'react-i18next' import { useNavigate, useParams, useSearchParams } from 'react-router-dom' import DurationInput from '../../components/common/DurationInput' @@ -94,6 +95,7 @@ const REPEAT_ON_TYPE = ['interval', 'days_of_the_week', 'day_of_the_month'] const NO_DUE_DATE_REQUIRED_TYPE = ['no_repeat', 'once'] const NO_DUE_DATE_ALLOWED_TYPE = ['trigger'] const ChoreEdit = () => { + const { t } = useTranslation('chores') const { data: userProfile, isLoading: isUserProfileLoading } = useUserProfile() @@ -207,16 +209,18 @@ const ChoreEdit = () => { const errors = {} if (name.trim() === '') { - errors.name = 'Name is required' + errors.name = t('choreEdit.errNameRequired') } if (frequencyType === 'interval' && !frequency > 0) { - errors.frequency = `Invalid frequency, the ${frequencyMetadata.unit} should be > 0` + errors.frequency = t('choreEdit.errFrequencyInvalid', { + unit: frequencyMetadata.unit, + }) } if ( frequencyType === 'days_of_the_week' && frequencyMetadata['days']?.length === 0 ) { - errors.frequency = 'Please select at least one day of the week' + errors.frequency = t('choreEdit.errSelectDayOfWeek') } // Validate advanced scheduling patterns @@ -226,14 +230,13 @@ const ChoreEdit = () => { (!frequencyMetadata?.occurrences || frequencyMetadata.occurrences.length === 0) ) { - errors.frequency = - 'Please select at least one day occurrence for the month' + errors.frequency = t('choreEdit.errSelectDayOccurrence') } if ( frequencyType === 'day_of_the_month' && frequencyMetadata['months']?.length === 0 ) { - errors.frequency = 'Please select at least one month' + errors.frequency = t('choreEdit.errSelectMonth') } if ( dueDate === null && @@ -243,14 +246,14 @@ const ChoreEdit = () => { if (REPEAT_ON_TYPE.includes(frequencyType)) { console.log('VALIDATION:', dueDate, frequencyType) - errors.dueDate = 'Start date is required' + errors.dueDate = t('choreEdit.errStartDateRequired') } else { - errors.dueDate = 'Due date is required' + errors.dueDate = t('choreEdit.errDueDateRequired') } } if (frequencyType === 'trigger') { if (!isThingValid) { - errors.thingTrigger = 'Thing trigger is invalid' + errors.thingTrigger = t('choreEdit.errThingTrigger') } } @@ -263,7 +266,7 @@ const ChoreEdit = () => { {errors[key]} )) showError({ - title: 'Please resolve the following errors:', + title: t('choreEdit.errTitle'), message: {errorList}, }) return false @@ -417,13 +420,13 @@ const ChoreEdit = () => { result?.res?._pendingCreate ) { showSuccess({ - title: 'Saved Offline', - message: 'Your changes will sync when you are back online.', + title: t('choreEdit.savedOfflineTitle'), + message: t('choreEdit.savedOfflineMessage'), }) } else { showSuccess({ - title: 'Chore Saved', - message: 'Your task has been saved successfully!', + title: t('choreEdit.savedTitle'), + message: t('choreEdit.savedMessage'), }) } Navigate('/chores') @@ -431,10 +434,10 @@ const ChoreEdit = () => { .catch(error => { console.error('Failed to save chore:', error) showError({ - title: 'Save Failed', + title: t('choreEdit.saveFailedTitle'), message: error?.isServerMessage ? error.message - : 'Failed to save chore, please try again.', + : t('choreEdit.saveFailedMessage'), }) }) } @@ -693,8 +696,8 @@ const ChoreEdit = () => { }) if (!response.ok) { showError({ - title: 'Upload Failed', - message: 'Failed to upload attachment.', + title: t('choreEdit.uploadFailedTitle'), + message: t('choreEdit.uploadFailedMessage'), }) return } @@ -710,8 +713,8 @@ const ChoreEdit = () => { ]) } catch { showError({ - title: 'Upload Failed', - message: 'Failed to upload attachment.', + title: t('choreEdit.uploadFailedTitle'), + message: t('choreEdit.uploadFailedMessage'), }) } finally { setIsUploadingAttachment(false) @@ -725,16 +728,16 @@ const ChoreEdit = () => { if (cancelled) return if (error || !image) { showError({ - title: 'Scan Failed', - message: error || 'Could not scan the document.', + title: t('choreEdit.scanFailedTitle'), + message: error || t('choreEdit.scanFailedMessage'), }) return } const file = await imageSourceToFile(image, `scan-${Date.now()}.jpg`) if (!file) { showError({ - title: 'Scan Failed', - message: 'Could not read the scanned image.', + title: t('choreEdit.scanFailedTitle'), + message: t('choreEdit.scanReadFailedMessage'), }) return } @@ -744,10 +747,10 @@ const ChoreEdit = () => { const handleDelete = () => { setConfirmModelConfig({ isOpen: true, - title: 'Delete Chore', - confirmText: 'Delete', - cancelText: 'Cancel', - message: 'Are you sure you want to delete this chore?', + title: t('choreEdit.deleteChoreTitle'), + confirmText: t('common:delete'), + cancelText: t('common:cancel'), + message: t('edit.deleteConfirm'), onClose: isConfirmed => { if (isConfirmed === true) { deleteChores.mutate([choreId], { @@ -756,8 +759,10 @@ const ChoreEdit = () => { }, onError: error => { showError({ - title: 'Delete Failed', - message: `Failed to delete chore: ${error.message}`, + title: t('choreEdit.deleteFailedTitle'), + message: t('choreEdit.deleteChoreFailed', { + error: error.message, + }), }) }, }) @@ -789,10 +794,8 @@ const ChoreEdit = () => { - Name - - What is the name of this task? - + {t('choreEdit.name')} + {t('choreEdit.nameDesc')} setName(e.target.value)} /> {errors.name} @@ -800,8 +803,10 @@ const ChoreEdit = () => { - Description - What is this task about? + {t('choreEdit.description')} + + {t('choreEdit.descriptionDesc')} + { - Priority - How important is this task? + {t('choreEdit.priority')} + {t('choreEdit.priorityDesc')} {/* Priority Chip Selection */} { minHeight: 34, }} > - No Priority + {t('choreEdit.noPriority')} @@ -869,9 +874,9 @@ const ChoreEdit = () => { {/* Project Selection - Show only if there are multiple projects */} {projects.length >= 1 && ( - Project + {t('choreEdit.project')} - Which project does this task belong to? + {t('choreEdit.projectDesc')} { @@ -1010,13 +1013,13 @@ const ChoreEdit = () => { }} > - Add New Label + {t('choreEdit.addNewLabel')} - Sub Tasks + {t('choreEdit.subTasks')} {/* { @@ -1049,8 +1052,10 @@ const ChoreEdit = () => { - Attachments - Files attached to this task + {t('choreEdit.attachments')} + + {t('choreEdit.attachmentsDesc')} + {attachments.length > 0 && ( { }) .catch(() => { showError({ - title: 'Delete Failed', - message: 'Failed to delete attachment.', + title: t('choreEdit.deleteFailedTitle'), + message: t('choreEdit.deleteAttachmentFailed'), }) }) }} @@ -1166,8 +1171,8 @@ const ChoreEdit = () => { }) .catch(() => { showError({ - title: 'Delete Failed', - message: 'Failed to delete attachment.', + title: t('choreEdit.deleteFailedTitle'), + message: t('choreEdit.deleteAttachmentFailed'), }) }) }} @@ -1188,7 +1193,7 @@ const ChoreEdit = () => { startDecorator={isUploadingAttachment ? null : } loading={isUploadingAttachment} > - Upload File + {t('choreEdit.uploadFile')} { disabled={isUploadingAttachment} onClick={handleScanAttachment} > - Scan + {t('choreEdit.scan')} )} @@ -1219,8 +1224,10 @@ const ChoreEdit = () => { {/* Section 2: Assignment & Responsibility */} - Assignees - Who can do this task? + {t('choreEdit.assignees')} + + {t('choreEdit.assigneesDesc')} + { overlay disableIcon variant='soft' - label='Anyone' + label={t('choreEdit.anyone')} /> @@ -1308,7 +1315,7 @@ const ChoreEdit = () => { setShowSaveAssigneeDefault(false) }} > - Remember for Future Tasks + {t('choreEdit.rememberFuture')} )} @@ -1323,15 +1330,17 @@ const ChoreEdit = () => { assignStrategyValue === 'no_assignee' ? 'none' : 'block', }} > - Currently Assigned To + + {t('choreEdit.currentlyAssigned')} + - Who is assigned the next due? + {t('choreEdit.currentlyAssignedDesc')} { checked={useCustomTime} onChange={e => handleUseCustomTimeChange(e.target.checked)} overlay - label='Set a specific time' + label={t('choreEdit.setSpecificTime')} /> {useCustomTime - ? 'Task will be due at the specified time' - : 'Task will be due at the end of the day (11:59 PM)'} + ? t('choreEdit.dueAtSpecifiedTime') + : t('choreEdit.dueEndOfDay')} {useCustomTime && ( - Time: + {t('choreEdit.timeLabel')} { {dueDate && ( - Task Window + {t('choreEdit.taskWindow')} - Define when this task can be completed and when it expires + {t('choreEdit.taskWindowDesc')} {/* Available From (Completion Window) */} @@ -1516,10 +1524,10 @@ const ChoreEdit = () => { } }} overlay - label='Set earliest completion time' + label={t('choreEdit.earliestCompletion')} /> - Task becomes available to complete X hours before the due date + {t('choreEdit.earliestCompletionHelp')} @@ -1531,7 +1539,9 @@ const ChoreEdit = () => { ml: 4, }} > - Hours: + + {t('choreEdit.hoursLabel')} + { max: 24 * 7, }, }} - placeholder='Hours' + placeholder={t('choreEdit.hoursPlaceholder')} onChange={e => { setCompletionWindow(parseInt(e.target.value)) }} @@ -1589,7 +1599,9 @@ const ChoreEdit = () => { size='sm' minValue={0} /> - after due date + + {t('choreEdit.afterDueDate')} + )} @@ -1597,9 +1609,9 @@ const ChoreEdit = () => { {!['once', 'no_repeat'].includes(frequencyType) && ( - Scheduling Preferences + {t('choreEdit.schedulingPrefs')} - How to reschedule the next due date? + {t('choreEdit.schedulingPrefsDesc')} div': { p: 1 } }}> @@ -1607,11 +1619,10 @@ const ChoreEdit = () => { overlay checked={!isRolling} onClick={() => setIsRolling(false)} - label='Reschedule from due date' + label={t('choreEdit.rescheduleFromDue')} /> - the next task will be scheduled from the original due date, - even if the previous task was completed late + {t('choreEdit.rescheduleFromDueHelp')} @@ -1622,11 +1633,10 @@ const ChoreEdit = () => { setIsRolling(true) setDeadlineOffset(-1) }} - label='Reschedule from completion date' + label={t('choreEdit.rescheduleFromCompletion')} /> - the next task will be scheduled from the actual completion - date of the previous task + {t('choreEdit.rescheduleFromCompletionHelp')} @@ -1635,11 +1645,10 @@ const ChoreEdit = () => { {/* Section 3.1: Notifications */} - Notifications + {t('choreEdit.notifications')} {!isPlusAccount(userProfile) && ( - Task notifications are not available in the Basic plan. Upgrade to - Plus to receive reminders when tasks are due or completed. + {t('choreEdit.notificationsPlanWarning')} )} @@ -1655,14 +1664,14 @@ const ChoreEdit = () => { checked={isNotificable} disabled={!isPlusAccount(userProfile)} overlay - label='Notify for this task' + label={t('choreEdit.notifyForTask')} /> - When should receive notifications for this task + {t('choreEdit.notifyForTaskHelp')} @@ -1677,7 +1686,7 @@ const ChoreEdit = () => { > - Notification Schedule + {t('choreEdit.notificationSchedule')} { - Who to Notify + {t('choreEdit.whoToNotify')} - Notify all assignees + + {t('choreEdit.allAssigneesHelp')} + @@ -1725,9 +1736,11 @@ const ChoreEdit = () => { ? notificationMetadata?.circleGroup : false } - label='Specific Group' + label={t('choreEdit.specificGroup')} /> - Notify a specific group + + {t('choreEdit.specificGroupHelp')} + {notificationMetadata?.circleGroup && ( @@ -1737,11 +1750,13 @@ const ChoreEdit = () => { ml: 4, }} > - Telegram Group ID: + + {t('choreEdit.telegramGroupIdLabel')} + { setNotificationMetadata({ ...notificationMetadata, @@ -1766,11 +1781,11 @@ const ChoreEdit = () => { pb: 1, }} > - Task Settings: + {t('choreEdit.taskSettings')} - Points System + {t('choreEdit.pointsSystem')} { @@ -1782,12 +1797,9 @@ const ChoreEdit = () => { }} checked={points > -1} overlay - label='Assign points for completion' + label={t('choreEdit.assignPoints')} /> - - Assign points to this task and user will earn points when they - completed it - + {t('choreEdit.assignPointsHelp')} {points != -1 && ( @@ -1797,7 +1809,9 @@ const ChoreEdit = () => { ml: 4, }} > - Points: + + {t('choreEdit.pointsLabel')} + { max: 1000, }, }} - placeholder='Points' + placeholder={t('choreEdit.pointsPlaceholder')} onChange={e => { setPoints(parseInt(e.target.value)) }} @@ -1819,7 +1833,9 @@ const ChoreEdit = () => { - Approval Requirement + + {t('choreEdit.approvalRequirement')} + { @@ -1827,18 +1843,17 @@ const ChoreEdit = () => { }} checked={requireApproval} overlay - label='Require admin approval' + label={t('choreEdit.requireApproval')} /> - This task will need approval from an admin before being marked as - complete + {t('choreEdit.requireApprovalHelp')} - Privacy Settings - Who can see this task? + {t('choreEdit.privacySettings')} + {t('choreEdit.privacyDesc')} { }} > - - Everyone in your circle + + {t('choreEdit.publicHelp')} - You and others that are assigned to the task + {t('choreEdit.limitedHelp')} {anyone || assignableTo.length === 0 - ? ' (No assignees selected, Limited option is disabled)' + ? t('choreEdit.limitedDisabledHint') : ''} @@ -1893,7 +1908,7 @@ const ChoreEdit = () => { setShowSavePrivacyDefault(false) }} > - Remember for Future Tasks + {t('choreEdit.rememberFuture')} )} @@ -1910,7 +1925,7 @@ const ChoreEdit = () => { }} > - Created by{' '} + {t('choreEdit.createdBy')}{' '} {membersData.res.find(f => f.userId === createdBy)?.displayName} {' '} @@ -1921,7 +1936,7 @@ const ChoreEdit = () => { - Updated by{' '} + {t('choreEdit.updatedBy')}{' '} { membersData.res.find(f => f.userId === updatedBy) @@ -1971,7 +1986,7 @@ const ChoreEdit = () => { : unarchiveChore.mutate(choreId) }} > - {isActive ? 'Archive' : 'Unarchive'} + {isActive ? t('choreEdit.archive') : t('choreEdit.unarchive')} { - Delete + {t('common:delete')} @@ -1999,13 +2014,13 @@ const ChoreEdit = () => { window.history.back() }} > - Cancel + {t('common:cancel')} {showKeyboardShortcuts && ( )} {userCircles.length > 0 && userCircles[0]?.userRole === 'member' && ( )} - Circle Members + + {t('circleSettings.circleMembers')} + {circleMembers.map(member => ( @@ -336,19 +339,27 @@ const Settings = () => { {member.displayName.charAt(0).toUpperCase() + member.displayName.slice(1)} - {member.userId === userProfile.id ? '(You)' : ''}{' '} + {member.userId === userProfile.id + ? t('circleSettings.you') + : ''}{' '} {' '} - {member.isActive ? member.role : 'Pending Approval'} + {member.isActive + ? member.role + : t('circleSettings.pendingApproval')} {member.isActive ? ( - Joined on {fmt.date(member.createdAt)} + {t('circleSettings.joinedOn', { + date: fmt.date(member.createdAt), + })} ) : ( - Request to join {fmt.date(member.updatedAt)} + {t('circleSettings.requestedToJoin', { + date: fmt.date(member.updatedAt), + })} )} @@ -378,28 +389,14 @@ const Settings = () => { } else { showNotification({ type: 'error', - message: 'Failed to update role', + message: t('circleSettings.roleUpdateFailed'), }) } }) }} > - {[ - { - value: 'member', - description: 'Just a regular member of the circle', - }, - { - value: 'manager', - description: - 'Can impersonate users and perform actions on their behalf', - }, - { - value: 'admin', - description: 'Full access to the circle', - }, - ].map((option, index) => ( - - {option.description} + {t(`circleSettings.roles.${option}Description`)} @@ -437,8 +433,10 @@ const Settings = () => { size='sm' onClick={() => { showConfirmation( - `Are you sure you want to remove ${member.displayName} from your circle?`, - 'Remove Member', + t('circleSettings.removeMemberMessage', { + name: member.displayName, + }), + t('circleSettings.removeMemberTitle'), () => { DeleteCircleMember( member.circleId, @@ -447,7 +445,7 @@ const Settings = () => { if (resp.ok) { showNotification({ type: 'success', - message: 'Removed member successfully', + message: t('circleSettings.memberRemoved'), }) // Invalidate and refetch circle-related queries queryClient.invalidateQueries(['circleMembers']) @@ -463,8 +461,8 @@ const Settings = () => { } }) }, - 'Remove', - 'Cancel', + t('common.remove'), + t('common.cancel'), 'danger', ) }} @@ -485,11 +483,15 @@ const Settings = () => { mb: 1, }} > - Circle Member Requests + + {t('circleSettings.circleMemberRequests')} + {lastRefresh && ( - Last updated: {fmt.dateTime(lastRefresh)} + {t('circleSettings.lastUpdated', { + time: fmt.dateTime(lastRefresh), + })} )} @@ -509,21 +513,24 @@ const Settings = () => { {circleMemberRequests.map(request => ( - {request.displayName} wants to join your circle. + {t('circleSettings.wantsToJoin', { name: request.displayName })} ))} - or + {t('circleSettings.or')} - if want to join someone else's Circle? Ask them for their unique - Circle code or join link. Enter the code below to join their Circle. + {t('circleSettings.joinOtherDescription')} - Enter Circle code: + {t('circleSettings.enterCircleCode')} setCircleInviteCode(e.target.value)} size='lg' @@ -575,20 +581,19 @@ const Settings = () => { if (resp.ok) { showNotification({ type: 'success', - message: - 'Joined circle successfully, wait for the circle owner to accept your request.', + message: t('circleSettings.joinedPending'), }) setTimeout(() => navigate('/'), 3000) } else { if (resp.status === 409) { showNotification({ type: 'error', - message: 'You are already a member of this circle', + message: t('circleSettings.alreadyMember'), }) } else { showNotification({ type: 'error', - message: 'Failed to join circle', + message: t('circleSettings.joinFailed'), }) } setTimeout(() => navigate('/'), 3000) @@ -596,24 +601,21 @@ const Settings = () => { }) }} > - Join Circle + {t('circleSettings.joinCircle')} {circleMembers.find(m => userProfile.id == m.userId)?.role === 'admin' && ( <> - Webhook + {t('advanced.webhookTitle')} - Webhooks allow you to send real-time notifications to other - services when events happen in your Circle. Configure a webhook - URL to receive real-time updates. + {t('advanced.webhookDescription')} {!isPlusAccount(userProfile) && ( - Webhook notifications are not available in the Basic plan. - Upgrade to Plus to receive real-time updates via webhooks. + {t('advanced.webhookPlusNotice')} )} @@ -627,7 +629,7 @@ const Settings = () => { } }} variant='soft' - label='Enable Webhook' + label={t('advanced.webhookToggle')} disabled={!isPlusAccount(userProfile)} overlay /> @@ -636,10 +638,10 @@ const Settings = () => { opacity: !isPlusAccount(userProfile) ? 0.5 : 1, }} > - Enable webhook notifications for tasks and things updates.{' '} + {t('advanced.webhookHelper')}{' '} {userProfile && !isPlusAccount(userProfile) && ( - Plus Feature + {t('common.plusFeature')} )} @@ -647,7 +649,9 @@ const Settings = () => { {webhookURL !== null && ( - Webhook URL + + {t('advanced.webhookURL')} + setWebhookURL(e.target.value)} @@ -670,19 +674,19 @@ const Settings = () => { if (resp.ok) { showNotification({ type: 'success', - message: 'Webhook URL updated successfully', + message: t('advanced.webhookUpdated'), }) } else { showNotification({ type: 'error', - message: 'Failed to update webhook URL', + message: t('advanced.webhookUpdateFailed'), }) } }) }} disabled={!isPlusAccount(userProfile)} > - Save + {t('common.save')} )} @@ -695,13 +699,13 @@ const Settings = () => {
- Account Settings + {t('accountSettings.title')} - Change your account settings, type or update your password + {t('accountSettings.description')} - Account Type : {getSubscriptionStatus()} + {t('accountSettings.accountType', { type: getSubscriptionStatus() })} {getSubscriptionDetails()} @@ -733,8 +737,7 @@ const Settings = () => { queryClient.refetchQueries(['userProfile']) showNotification({ type: 'success', - message: - 'Purchase successful! Please restart the app to access Plus features.', + message: t('accountSettings.purchase.success'), }) // invalidate user profile to get new subscription status: } @@ -749,57 +752,49 @@ const Settings = () => { // Store problem showNotification({ type: 'error', - message: - 'Store connection issue. Please check your network and try again.', + message: t('accountSettings.purchase.storeConnection'), }) } else if (error.code === '3') { // Purchase not allowed showNotification({ type: 'error', - message: - 'Purchases are not allowed on this device. Please check your device restrictions.', + message: t('accountSettings.purchase.notAllowed'), }) } else if (error.code === '4') { // Product not available showNotification({ type: 'error', - message: - 'This subscription is not available. Please try again later.', + message: t('accountSettings.purchase.unavailable'), }) } else if (error.code === '5') { // Receipt already in use showNotification({ type: 'error', - message: - 'This purchase has already been processed. If you believe this is an error, please contact support.', + message: t('accountSettings.purchase.alreadyProcessed'), }) } else if (error.code === '6') { // Missing receipt file showNotification({ type: 'error', - message: - 'Purchase receipt missing. Please try purchasing again.', + message: t('accountSettings.purchase.receiptMissing'), }) } else if (error.code === '7') { // Network error showNotification({ type: 'error', - message: - 'Network error. Please check your connection and try again.', + message: t('accountSettings.purchase.networkError'), }) } else if (error.code === '8') { // Invalid receipt showNotification({ type: 'error', - message: - 'Invalid purchase receipt. Please contact support if this persists.', + message: t('accountSettings.purchase.invalidReceipt'), }) } else if (error.code === '9') { // Payment pending showNotification({ type: 'warning', - message: - 'Payment is pending approval. You will receive access once approved.', + message: t('accountSettings.purchase.pending'), }) } else { // Generic error @@ -808,7 +803,11 @@ const Settings = () => { console.error('Error occurred in purchase flow') showNotification({ type: 'error', - message: `Purchase failed: ${error.message || 'Unknown error'}. Please try again or contact support.`, + message: t('accountSettings.purchase.failed', { + error: + error.message || + t('accountSettings.purchase.unknownError'), + }), }) } } @@ -817,7 +816,7 @@ const Settings = () => { } }} > - Upgrade + {t('accountSettings.upgrade')} {userProfile?.subscription === 'active' && ( @@ -833,14 +832,14 @@ const Settings = () => { setNativeCancelModal(true) }} > - Cancel + {t('accountSettings.cancel')} )} {import.meta.env.VITE_IS_SELF_HOSTED === 'true' && ( - Password : + {t('accountSettings.password')} {changePasswordModal ? ( { if (resp.ok) { showNotification({ type: 'success', - message: 'Password changed successfully', + message: t('accountSettings.passwordChanged'), }) } else { showNotification({ type: 'error', - message: 'Password change failed', + message: t('accountSettings.passwordChangeFailed'), }) } }) @@ -879,18 +878,17 @@ const Settings = () => { - Danger Zone + {t('accountSettings.dangerZone')} - Once you delete your account, there is no going back. Please be - certain. + {t('accountSettings.dangerZoneDescription')}
@@ -899,32 +897,26 @@ const Settings = () => {
- Sidepanel Customization + {t('sidepanel.title')} - Customize the layout and visibility of cards in the sidepanel. the - section only available on large screen devices such as tablets and - desktops.. + {t('sidepanel.detailedDescription')}
- Theme preferences + {t('theme.title')} - - Choose how the site looks to you. Select a single theme, or sync with - your system and automatically switch between day and night themes. - + {t('theme.description')}
- Localization + {t('localization.title')} - Customize language, date format, and regional preferences for your - account. These settings will apply throughout the application. + {t('localization.descriptionLong')}
diff --git a/src/views/components/AddTaskModal.jsx b/src/views/components/AddTaskModal.jsx index 8c23ce6..94e6a65 100644 --- a/src/views/components/AddTaskModal.jsx +++ b/src/views/components/AddTaskModal.jsx @@ -15,6 +15,7 @@ import * as chrono from 'chrono-node' import moment from 'moment' import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { flushSync } from 'react-dom' +import { useTranslation } from 'react-i18next' import KeyboardShortcutHint from '../../components/common/KeyboardShortcutHint' import ModalActions from '../../components/common/ModalActions' @@ -186,6 +187,7 @@ const POINTS_SUGGESTIONS = { const PARSE_DEBOUNCE_MS = 150 const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { + const { t } = useTranslation('chores') const { ResponsiveModal } = useResponsiveModal() const isMobile = useMediaQuery(theme => theme.breakpoints.down('sm')) const pickerEmptyDisplay = isMobile ? 'icon' : 'icon-text' @@ -229,13 +231,13 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { value: 'userId', display: 'displayName', options: [ - { userId: 'anyone', displayName: 'Anyone' }, + { userId: 'anyone', displayName: t('addTask.anyone') }, ...(circleMembers?.res || []), ], }, '*': POINTS_SUGGESTIONS, }), - [userLabels, circleMembers, handleCreateLabel], + [userLabels, circleMembers, handleCreateLabel, t], ) const [taskText, setTaskText] = useState('') @@ -1156,7 +1158,7 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { onClose={handleCloseModal} size='lg' fullWidth={true} - title='Create new task' + title={t('addTask.title')} footer={ {!showScan && !showVoice && projects?.length >= 1 && ( @@ -1177,7 +1179,9 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { fontWeight: 'normal', }} > - {selectedProject.name} + {selectedProject.id === 'default' + ? t('addTask.defaultProject') + : selectedProject.name} { sx={{ fontSize: 18, color: project.color }} /> - {project.name} + {project.id === 'default' + ? t('addTask.defaultProject') + : project.name} ) })} @@ -1211,7 +1217,7 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { color='neutral' onClick={handleCloseModal} > - Cancel + {t('common:cancel')} {showKeyboardShortcuts && ( { onClick={handleVoiceConfirm} > {creatingVoiceTasks - ? 'Creating…' + ? t('addTask.creating') : voiceState.segments.length > 1 - ? `Create ${voiceState.segments.length} Tasks` - : 'Use Task'} + ? t('addTask.createCount', { + count: voiceState.segments.length, + }) + : t('addTask.useTask')} )} {showScan && scanState.primaryAction && ( @@ -1249,7 +1257,7 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { )} {showScan && scanState.phase === 'processing' && ( )} {!showScan && !showVoice && ( @@ -1260,7 +1268,7 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { disabled={!taskTitle.trim() || isAttachingScan} onClick={submitChore} > - Create + {t('addTask.create')} {showKeyboardShortcuts && ( )} @@ -1349,7 +1357,7 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { onVoiceClick={ voiceAvailable ? () => setShowVoice(true) : undefined } - placeholder='Type your task...' + placeholder={t('addTask.taskPlaceholder')} onChange={text => { setTaskText(text) if (!text) setTaskTitle('') @@ -1484,7 +1492,9 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { }} > - Description + + {t('addTask.descriptionChip')} + )} {!hasSubTasks && ( @@ -1507,7 +1517,9 @@ const TaskInput = ({ initialMode, isModalOpen, onChoreUpdate, onClose }) => { }} > - Subtasks + + {t('addTask.subtasksChip')} + )} Date: Tue, 18 Aug 2026 01:27:57 -0400 Subject: [PATCH 3/6] feat: integrate i18n for translation in various components - Updated NativeCancelSubscriptionModal to use translation keys for titles and messages. - Enhanced CircleSetupView with translation for notifications and UI text. - Refactored ThingsView to implement translation for notifications, titles, and descriptions. - Added translation support in AdvancedOptionsSection for labels and descriptions. - Implemented i18n in RepeatPickerField for various UI elements and labels. --- public/locales/en/chores.json | 254 +++++++++++++++++- public/locales/en/common.json | 85 +++++- public/locales/en/settings.json | 26 ++ public/locales/en/things.json | 42 +++ scripts/i18n-audit.mjs | 136 ++++++++++ src/components/UserProfileAvatar.jsx | 28 +- src/views/ChoreEdit/RepeatSection.jsx | 181 ++++++------- src/views/Chores/ChoreListView.jsx | 12 +- src/views/Chores/MyChores.jsx | 70 ++--- .../components/ChoreToolbarPrototype.jsx | 34 +-- .../components/FilterBuilderContent.jsx | 132 +++++---- .../Chores/components/MultiSelectToolbar.jsx | 59 ++-- src/views/Circles/JoinCircle.jsx | 50 ++-- src/views/Modals/ErrorReportModal.jsx | 62 +++-- .../Inputs/NativeCancelSubscriptionModal.jsx | 100 +++---- src/views/Onboarding/CircleSetupView.jsx | 44 +-- src/views/Things/ThingsView.jsx | 106 ++++---- .../components/AdvancedOptionsSection.jsx | 47 ++-- src/views/components/RepeatPickerField.jsx | 197 +++++++------- 19 files changed, 1110 insertions(+), 555 deletions(-) create mode 100644 scripts/i18n-audit.mjs diff --git a/public/locales/en/chores.json b/public/locales/en/chores.json index 892905d..98675d7 100644 --- a/public/locales/en/chores.json +++ b/public/locales/en/chores.json @@ -273,7 +273,11 @@ "filterUpdated": "Filter Updated", "filterUpdatedMsg": "\"{{name}}\" has been updated successfully", "advancedFilterCreated": "Advanced Filter Created", - "advancedFilterCreatedMsg": "\"{{name}}\" has been created successfully" + "advancedFilterCreatedMsg": "\"{{name}}\" has been created successfully", + "reject": "Reject", + "pending": "Pending", + "schedule": "Schedule", + "nudge": "Nudge" }, "multiToolbar": { "skip": "Skip", @@ -282,7 +286,27 @@ "skipTitle": "Skip selected tasks (/)", "archiveTitle": "Archive selected tasks (X)", "archive": "Archive", - "deleteTitle": "Delete selected tasks (Shift+X)" + "deleteTitle": "Delete selected tasks (Shift+X)", + "mixed": "Mixed", + "due": "Due", + "dueTitleSet": "Due date on selected tasks: {{value}}", + "dueTitleEmpty": "Set due date on selected tasks", + "presetToday": "Today", + "presetTomorrow": "Tomorrow", + "presetNextWeek": "Next week", + "pickDate": "Pick date…", + "noDueDate": "No due date", + "moveTitle": "Move selected tasks to a project", + "move": "Move", + "defaultProject": "Default Project", + "moreTitle": "Set priority, assignee, or labels", + "more": "More", + "priority": "Priority", + "assignee": "Assignee", + "labels": "Labels", + "labelsHint": "Tap to add · tap again to remove", + "done": "Done", + "noPriority": "None" }, "remind": { "title": "Reminders" @@ -553,5 +577,231 @@ "useTask": "Use Task", "processing": "Processing", "create": "Create" + }, + "repeat": { + "days": { + "monday": "Monday", + "tuesday": "Tuesday", + "wednesday": "Wednesday", + "thursday": "Thursday", + "friday": "Friday", + "saturday": "Saturday", + "sunday": "Sunday" + }, + "months": { + "january": "January", + "february": "February", + "march": "March", + "april": "April", + "may": "May", + "june": "June", + "july": "July", + "august": "August", + "september": "September", + "october": "October", + "november": "November", + "december": "December" + }, + "freqType": { + "daily": "Daily", + "weekly": "Weekly", + "monthly": "Monthly", + "yearly": "Yearly", + "adaptive": "Adaptive", + "custom": "Custom" + }, + "freqMessage": { + "adaptive": "This chore will be scheduled dynamically based on previous completion dates.", + "custom": "This chore will be scheduled based on a custom frequency." + }, + "weekPattern": { + "every_week": "Every week", + "week_of_month": "Specific occurrences in the month" + }, + "weekPatternHelp": { + "every_week": "Task repeats every week on selected days", + "week_of_month": "Task repeats on specific day occurrences each month (e.g., 1st Monday, 3rd Friday)" + }, + "occurrence": { + "1": "1st occurrence", + "2": "2nd occurrence", + "3": "3rd occurrence", + "4": "4th occurrence", + "last": "Last occurrence" + }, + "ordinal": { + "1": "1st", + "2": "2nd", + "3": "3rd", + "4": "4th", + "last": "last" + }, + "unit": { + "hours": "Hours", + "days": "Days", + "weeks": "Weeks", + "months": "Months", + "years": "Years" + }, + "repeatOnType": { + "interval": "Interval", + "days_of_the_week": "Days of the week", + "day_of_the_month": "Day of the month" + }, + "timeOfDay": "Time of day: ", + "every": "Every: ", + "unitPlaceholder": "Unit", + "selectAll": "Select All", + "unselectAll": "Unselect All", + "selectOccurrences": "Select which occurrences of the selected days:", + "occurrenceExample": "Example: \"1st Monday\" means the first Monday of each month", + "onThe": "on the ", + "ofAboveMonths": "of the above month/s", + "title": "Repeat:", + "repeatThisTask": "Repeat this task", + "repeatThisTaskHelp": "Is this something needed to be done regularly?", + "howOften": "How often should it be repeated?", + "repeatOn": "Repeat on:", + "triggerLabel": "Trigger this task based on a thing state", + "triggerHelp": "Is this something that should be done when a thing state changes?", + "triggerPlanWarning": "Thing-based triggers are not available in the Basic plan. Upgrade to Plus to automatically trigger tasks when device states change.", + "previewEvery": "Every {{days}} at {{time}}", + "previewOccurrence": "Every {{occurrences}} {{days}} of the month at {{time}}", + "defaultTime": "6:00 PM", + "daysShort": { + "monday": "Mon", + "tuesday": "Tue", + "wednesday": "Wed", + "thursday": "Thu", + "friday": "Fri", + "saturday": "Sat", + "sunday": "Sun" + }, + "monthsShort": { + "january": "Jan", + "february": "Feb", + "march": "Mar", + "april": "Apr", + "may": "May", + "june": "Jun", + "july": "Jul", + "august": "Aug", + "september": "Sep", + "october": "Oct", + "november": "Nov", + "december": "Dec" + }, + "occurrenceShort": { + "1": "1st", + "2": "2nd", + "3": "3rd", + "4": "4th", + "last": "Last" + }, + "picker": { + "modalTitle": "Repeat Schedule", + "trigger": "Repeat", + "clearAria": "Clear repeat schedule", + "remove": "Remove", + "apply": "Apply", + "frequency": "Frequency", + "scheduleType": "Schedule type", + "timeOfDay": "Time of day", + "repeatEvery": "Repeat every", + "days": "Days", + "pattern": "Pattern", + "everyWeek": "Every week", + "specificWeeks": "Specific weeks", + "occurrences": "Occurrences", + "months": "Months", + "dayOfMonth": "Day of month" + } + }, + "advancedOptions": { + "points": "Points", + "pointsDescription": "Award points for completing this task", + "requireApproval": "Require approval", + "requireApprovalDescription": "Task needs admin sign-off before it can be closed", + "limitedVisibility": "Limited visibility", + "limitedVisibilityDisabled": "Assign someone to enable limited visibility", + "limitedVisibilityDescription": "Only you and assignees can see this task", + "assignStrategy": "Assign strategy", + "assignStrategyDescription": "How to pick the next assignee each recurrence", + "availableFrom": "Available from", + "availableFromDescription": "Hours before the due date the task becomes available", + "strategy": { + "keep_last_assigned": "Keep same assignee", + "random": "Random", + "least_completed": "Least completed", + "round_robin": "Round robin" + }, + "hrs": "hrs", + "setDueDateHint": "Set a due date to configure completion window", + "more": "More" + }, + "filterBuilder": { + "dueDateOption": { + "isOverdue": "Overdue", + "isDueToday": "Today", + "isDueTomorrow": "Tomorrow", + "isDueThisWeek": "This Week", + "isDueThisMonth": "This Month", + "hasNoDueDate": "No Due Date", + "hasDueDate": "Has Due Date" + }, + "status": { + "0": "Active", + "1": "Started", + "2": "In Progress", + "3": "Pending Approval" + }, + "include": "Include", + "exclude": "Exclude", + "has": "Has", + "doesntHave": "Doesn't Have", + "assignee": "Assignee", + "createdBy": "Created By", + "statusHeading": "Status", + "priority": "Priority", + "dueDate": "Due Date", + "labels": "Labels", + "projects": "Projects", + "defaultProject": "Default Project", + "points": "Points", + "project": "Project", + "filterFallback": "Filter", + "notPrefix": "Not ", + "customDueDate": "Custom", + "clear": "Clear" + }, + "empty": { + "errorTitle": "Can't reach Donetick", + "errorDescription": "Your tasks are safe. We just could not load them right now, check your connection and try again.", + "errorAction": "Try again", + "noTasksTitle": "No tasks yet", + "noTasksDescription": "Create your first task and Donetick keeps track of when it is due, whose turn it is, and what comes next.", + "createTask": "Create a task", + "moreOptions": "More options", + "noMatchTitle": "No tasks match this view", + "noMatchSearch": "Nothing matches \"{{term}}\". Try a different search, or clear what is narrowing the list.", + "noMatchFilters": "You have tasks, but none of them fit the filters that are currently on.", + "clearSearch": "Clear search", + "showEveryone": "Show everyone's tasks", + "clearFilters": "Clear filters", + "projectTitle": "Nothing in {{name}} yet", + "projectDescription": "Tasks you add to this project show up here. Your other tasks are still where you left them.", + "addTaskHere": "Add a task here", + "seeOutsideProjects": "See tasks outside projects", + "noProjectTitle": "No tasks here yet", + "noProjectDescription": "Tasks that do not belong to a project live here. Add one, or switch projects to see what is in them.", + "dayFreeDescription": "This day is free. Add a task if you want something to land here.", + "addTask": "Add task", + "assignee": { + "assigned_to_me": "There are tasks here, but none of them are assigned to you. Switch back to everyone to see the rest.", + "available_for_me": "There are tasks here, but none of them are available for you to pick up. Switch back to everyone to see the rest.", + "assigned_to_others": "There are tasks here, but none of them are assigned to someone else. Switch back to everyone to see the rest.", + "assigned_to_me_tasks": "There are tasks here, but none of them are assigned to you. Switch back to everyone to see the rest.", + "created_by_me": "There are tasks here, but none of them are created by you. Switch back to everyone to see the rest." + } } } diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 6f175b8..6af526c 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -212,7 +212,18 @@ "accountPrefs": "Account & preferences", "invitePeople": "Invite People", "addMembers": "Add members to your circle", - "sidePanelSettings": "Side Panel Settings" + "sidePanelSettings": "Side Panel Settings", + "planFree": "Free", + "planPlus": "Plus", + "planPlusExpiring": "Plus (expires soon)", + "switchUser": "Switch User", + "impersonateUser": "Impersonate User", + "switchToLight": "Switch to Light", + "switchToDark": "Switch to Dark", + "unlockPremium": "Unlock premium features", + "impersonating": "Impersonating", + "toggleThemeAppearance": "Toggle theme appearance", + "upgradeToPlus": "Upgrade to Plus" }, "realtime": { "newTaskTitle": "New Task Created", @@ -328,5 +339,77 @@ "tagPets": "Pets", "tagCooking": "Cooking" } + }, + "errorReport": { + "titleBug": "Report an issue", + "titleCrash": "Report this problem", + "subtitleBug": "Tell us what went wrong and we’ll attach the technical details for you.", + "subtitleCrash": "A sentence about what you were doing turns this into something we can actually fix.", + "labelBug": "What went wrong?", + "labelCrash": "What were you doing?", + "placeholderBug": "e.g. Completing a chore from the list doesn’t update the due date", + "placeholderCrash": "e.g. I tapped a chore in My Chores and the screen went blank", + "email": "Email", + "emailOptional": "(optional — only if you want a reply)", + "emailPlaceholder": "you@example.com", + "showWhatGetsSent": "Show what gets sent", + "hideWhatGetsSent": "Hide what gets sent", + "copyDiagnostics": "Copy diagnostics", + "collecting": "Collecting diagnostics…", + "privacyNote": "No chore names, notes or attachments are included.", + "send": "Send report", + "cancel": "Cancel", + "notNow": "Not now", + "sentTitle": "Report sent", + "sentBody": "Thanks! this goes straight to the people who can fix it.", + "reference": "Reference", + "copyReference": "Copy reference", + "done": "Done", + "githubTitle": "Finish on GitHub", + "githubBody": "Nothing has been sent. We've filled in an issue with your notes and the diagnostics — review it and post when you're happy with it.", + "openIssue": "Open pre-filled issue", + "copied": "Copied", + "copyInstead": "Copy details instead", + "close": "Close" + }, + "circleSetup": { + "inviteTitle": "Bring your squad in", + "inviteSubtitle": "Everyone who joins your Circle sees the same chores, takes their own turn, and stays in sync automatically.", + "joinTitle": "Join a circle", + "joinSubtitle": "Enter the code you were given and we'll send a request to join — the circle owner just needs to approve it.", + "loadingCode": "Loading…", + "copyCodeAria": "Copy circle code", + "copyLinkInstead": "Copy invite link instead", + "continue": "Continue", + "joinInstead": "Join an existing circle instead", + "codePlaceholder": "Enter code", + "joinButton": "Join Circle", + "back": "Back", + "codeCopied": "Code copied to clipboard", + "linkCopied": "Link copied to clipboard", + "requestSentTitle": "Request Sent", + "requestSentBody": "Your join request has been sent! The circle owner will need to approve it before you can see their chores. You'll get a notification once you're in.", + "alreadyMember": "You are already a member of this circle", + "joinFailed": "Failed to join circle" + }, + "joinCircle": { + "title": "You're invited to join a circle", + "incompleteTitle": "Invite link is incomplete", + "incompleteSubtitle": "This invite link is missing a code. Ask the person who invited you to send a new link.", + "goToDonetick": "Go to Donetick", + "signedOutSubtitle": "Sign in or create a Donetick account to continue. We'll send your join request once you're signed in.", + "signIn": "Sign in", + "createAccount": "Create an account", + "sendingTitle": "Sending your request", + "sendingSubtitle": "Sending your request…", + "greetingSubtitle": "Hi {{name}}. Send a request to share this circle's chores with its members.", + "adminReviewNote": "A circle admin will review your request before you get access.", + "sendRequest": "Send join request", + "requestSentTitle": "Request sent", + "requestSentBody": "Your request has been sent. A circle admin will need to approve it before you can access the circle and its chores. We'll notify you when it's approved.", + "gotIt": "Got it", + "alreadyMember": "You are already a member of this circle", + "joinFailed": "Failed to join circle", + "requestError": "Could not send your join request. Please try again." } } diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index 18847d2..02714c5 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -583,5 +583,31 @@ }, "realtime": { "titleSse": "Real-time Updates (SSE)" + }, + "nativeCancel": { + "title": "Cancel Subscription", + "dismiss": "Dismiss", + "cancelViaStore": "I'll cancel from my app store", + "cancelDesktop": "Cancel desktop subscription", + "intro": "To cancel your subscription, please follow the instructions for your platform (you should cancel through the same platform you used to subscribe).", + "iosHeading": "For iOS (iPhone/iPad):", + "iosStep1": "1. Open the Settings app on your device", + "iosStep2": "2. Tap your name at the top of the screen", + "iosStep3": "3. Tap Subscriptions", + "iosStep4": "4. Find and tap Donetick", + "iosStep5": "5. Tap Cancel Subscription", + "iosNote": "Note: If you subscribed through iOS and are using the web/desktop version, you must cancel through iOS Settings as described above.", + "androidHeading": "For Android:", + "androidStep1": "1. Open the Google Play Store app", + "androidStep2": "2. Tap the profile icon in the top right", + "androidStep3": "3. Tap Payments & subscriptions", + "androidStep4": "4. Tap Subscriptions", + "androidStep5": "5. Find and tap Donetick", + "androidStep6": "6. Tap Cancel subscription", + "androidNote": "Note: If you subscribed through Google Play and are using the web/desktop version, you must cancel through Google Play as described above.", + "webHeading": "For Web/Desktop Subscriptions:", + "webBody": "If you originally subscribed through our website or desktop app, you can cancel your subscription by going to the Account Settings section on our website. using a web browser", + "webNote": "Important: You must cancel your subscription through the same platform where you originally subscribed. If you subscribed through the iOS App Store or Google Play Store (even if you're now using the web/desktop version), you must cancel through that original platform using the instructions above.", + "footer": "Your subscription will remain active until the end of your current billing period." } } diff --git a/public/locales/en/things.json b/public/locales/en/things.json index 1181eb5..f54086c 100644 --- a/public/locales/en/things.json +++ b/public/locales/en/things.json @@ -14,5 +14,47 @@ "visualization": "Data Visualization", "changeHistory": "Change History", "updated": "Updated" + }, + "view": { + "title": "Things", + "description": "Things are custom fields that can be attached to tasks to capture additional information. They can be of type text, number, or boolean. You can associate things with tasks and have the task due once condition is met", + "searchPlaceholder": "Search things", + "sortName": "Name", + "sortType": "Type", + "sortState": "State", + "sortUpdated": "Last updated", + "filterTitle": "Type", + "filterAll": "All types", + "emptyTitle": "No things yet", + "emptyDescription": "A thing tracks a value, like a counter or a switch, that other tasks can react to. Create one to trigger tasks automatically.", + "emptyAction": "Create a thing", + "noResultsTitle": "No things match", + "noResultsSearch": "No thing matches \"{{term}}\".", + "noResultsFilter": "No thing matches the current filter.", + "clearSearch": "Clear search", + "showAll": "Show all things", + "toggle": "Toggle" + }, + "types": { + "text": "Text", + "number": "Number", + "boolean": "Boolean" + }, + "notify": { + "savedTitle": "Saved", + "savedMessage": "Thing saved successfully", + "saveFailTitle": "Unable to save thing", + "queuedMessage": "You are offline and the request has been queued", + "saveFailMessage": "An error occurred while saving the thing", + "deleteTitle": "Delete Things", + "deleteMessage": "Are you sure you want to delete this Thing?", + "deleteBlockedTitle": "Unable to Delete Thing", + "deleteBlockedMessage": "Unable to delete thing with associated tasks", + "deleteFailTitle": "Unable to delete thing", + "deleteFailMessage": "An error occurred while deleting the thing", + "updatedTitle": "Updated", + "updatedMessage": "Thing state updated successfully", + "updateFailTitle": "Unable to update thing state", + "updateFailMessage": "An error occurred while updating the thing state" } } diff --git a/scripts/i18n-audit.mjs b/scripts/i18n-audit.mjs new file mode 100644 index 0000000..7295c5f --- /dev/null +++ b/scripts/i18n-audit.mjs @@ -0,0 +1,136 @@ +#!/usr/bin/env node +/** + * Fails if any t() / key in src/ has no entry in public/locales/en/. + * + * Why this is a script and not an ESLint rule: the namespace for a bare + * t('foo') comes from the useTranslation('chores') call at the top of the + * component, so resolving a key needs whole-file context that a per-node lint + * rule does not have. Editor i18n plugins get this wrong constantly — they + * assume the default namespace and flag half the codebase. + * + * Usage: node scripts/i18n-audit.mjs [--orphans] + * --orphans also list en/*.json keys that nothing in src/ references + */ + +import { readdirSync, readFileSync, statSync } from 'node:fs' +import { basename, join } from 'node:path' + +const LOCALE_DIR = 'public/locales/en' +const SRC_DIR = 'src' +const DEFAULT_NS = 'common' + +const bundles = Object.fromEntries( + readdirSync(LOCALE_DIR) + .filter(f => f.endsWith('.json')) + .map(f => [ + basename(f, '.json'), + JSON.parse(readFileSync(join(LOCALE_DIR, f), 'utf8')), + ]), +) + +const walk = dir => + readdirSync(dir).flatMap(entry => { + const full = join(dir, entry) + return statSync(full).isDirectory() + ? walk(full) + : /\.jsx?$/.test(full) + ? [full] + : [] + }) + +const lookup = (ns, key) => + key.split('.').reduce((cur, part) => { + if (cur === null || typeof cur !== 'object' || !(part in cur)) return null + return cur[part] + }, bundles[ns] ?? null) + +/** + * i18next appends _one/_other to plural keys, so `card.points` is present in + * the bundle as `card.points_one` + `card.points_other`. Treat a leaf whose + * siblings carry a plural suffix as resolved. + */ +const exists = (ns, key) => { + if (lookup(ns, key) !== null) return true + const dot = key.lastIndexOf('.') + const parent = dot === -1 ? (bundles[ns] ?? null) : lookup(ns, key.slice(0, dot)) + const leaf = key.slice(dot + 1) + return ( + parent !== null && + typeof parent === 'object' && + Object.keys(parent).some(k => k.startsWith(`${leaf}_`)) + ) +} + +const collectKeys = src => { + const found = new Set() + const push = re => { + for (const m of src.matchAll(re)) found.add(m[1]) + } + // t('key') / t("key") / t(`key`) + push(/\bt\(\s*'([A-Za-z][\w.:-]*)'/g) + push(/\bt\(\s*"([A-Za-z][\w.:-]*)"/g) + push(/\bt\(\s*`([A-Za-z][\w.:-]*)`/g) + // t(`prefix.${expr}`) — the interpolated leaf is unknowable, but the + // prefix must at least resolve to an object + push(/\bt\(\s*`([A-Za-z][\w.:-]*)\.\$\{/g) + return found +} + +const failures = [] + +for (const file of walk(SRC_DIR).sort()) { + const src = readFileSync(file, 'utf8') + const nsMatch = src.match(/useTranslation\(\s*(?:'([^']+)'|\[\s*'([^']+)')/) + const hasTrans = src.includes('i18nKey') + if (!nsMatch && !hasTrans) continue + + const fallbackNs = nsMatch ? (nsMatch[1] ?? nsMatch[2]) : DEFAULT_NS + + const check = (raw, kind, nsOverride) => { + const [ns, key] = raw.includes(':') + ? raw.split(/:(.+)/) + : [nsOverride ?? fallbackNs, raw] + if (!exists(ns, key)) failures.push(`${file} ${kind} ${ns}:${key}`) + } + + for (const raw of collectKeys(src)) check(raw, 't()') + + // and thin wrappers that forward i18nKey + const transNs = src.match(/\bns='([^']+)'/)?.[1] + for (const m of src.matchAll(/i18nKey=(?:'([^']+)'|\{'([^']+)'\})/g)) { + check(m[1] ?? m[2], 'Trans', transNs) + } +} + +if (process.argv.includes('--orphans')) { + const allSrc = walk(SRC_DIR) + .map(f => readFileSync(f, 'utf8')) + .join('\n') + const flatten = (obj, prefix = '') => + Object.entries(obj).flatMap(([k, v]) => + v !== null && typeof v === 'object' + ? flatten(v, `${prefix}${k}.`) + : [`${prefix}${k}`], + ) + const orphans = [] + for (const [ns, bundle] of Object.entries(bundles)) { + for (const key of flatten(bundle)) { + const leaf = key.replace(/_(one|other|zero|two|few|many)$/, '') + if (!allSrc.includes(leaf) && !allSrc.includes(leaf.split('.').pop())) { + orphans.push(`${ns}:${leaf}`) + } + } + } + if (orphans.length) { + console.log(`\nPossibly unused (${new Set(orphans).size}):`) + console.log([...new Set(orphans)].sort().join('\n')) + } +} + +const unique = [...new Set(failures)].sort() +if (unique.length) { + console.error(`i18n audit: ${unique.length} unresolved key(s)\n`) + console.error(unique.join('\n')) + process.exit(1) +} +console.log('i18n audit: all keys resolve') diff --git a/src/components/UserProfileAvatar.jsx b/src/components/UserProfileAvatar.jsx index 1bacdfa..f2bad91 100644 --- a/src/components/UserProfileAvatar.jsx +++ b/src/components/UserProfileAvatar.jsx @@ -63,20 +63,20 @@ const UserProfileAvatar = () => { const isPlusUser = isPlusAccount(userProfile) const getSubscriptionStatus = () => { - if (!userProfile) return 'Free' + if (!userProfile) return t('userMenu.planFree') if (userProfile.subscription === 'active') { - return 'Plus' + return t('userMenu.planPlus') } if ( userProfile.subscription === 'cancelled' && moment().isBefore(userProfile.expiration) ) { - return 'Plus (expires soon)' + return t('userMenu.planPlusExpiring') } - return 'Free' + return t('userMenu.planFree') } const handleLogout = () => { @@ -270,7 +270,7 @@ const UserProfileAvatar = () => { fontWeight: 500, }} > - Impersonating + {t('userMenu.impersonating')} )} @@ -296,7 +296,9 @@ const UserProfileAvatar = () => { - {isImpersonating ? 'Switch User' : 'Impersonate User'} + {isImpersonating + ? t('userMenu.switchUser') + : t('userMenu.impersonateUser')} { - {isDarkMode ? 'Switch to Light' : 'Switch to Dark'} + {isDarkMode + ? t('userMenu.switchToLight') + : t('userMenu.switchToDark')} - Toggle theme appearance + {t('userMenu.toggleThemeAppearance')} @@ -465,9 +469,11 @@ const UserProfileAvatar = () => { fontWeight: 500, }} > - Upgrade to Plus + {t('userMenu.upgradeToPlus')} + + + {t('userMenu.unlockPremium')} - Unlock premium features )} @@ -516,7 +522,7 @@ const UserProfileAvatar = () => { level='body-sm' sx={{ fontWeight: 500, color: 'var(--joy-palette-danger-500)' }} > - Logout + {t('logout')} diff --git a/src/views/ChoreEdit/RepeatSection.jsx b/src/views/ChoreEdit/RepeatSection.jsx index ed030fd..dacaea5 100644 --- a/src/views/ChoreEdit/RepeatSection.jsx +++ b/src/views/ChoreEdit/RepeatSection.jsx @@ -18,6 +18,7 @@ import { } from '@mui/joy' import moment from 'moment' import { useEffect } from 'react' +import { useTranslation } from 'react-i18next' import { useLocalization } from '../../contexts/LocalizationContext' import { useUserProfile } from '../../queries/UserQueries' @@ -33,11 +34,7 @@ const FREQUENCY_TYPES_RADIOS = [ 'custom', ] -const FREQUENCY_TYPE_MESSAGE = { - adaptive: - 'This chore will be scheduled dynamically based on previous completion dates.', - custom: 'This chore will be scheduled based on a custom frequency.', -} +const FREQUENCY_TYPE_WITH_MESSAGE = ['adaptive', 'custom'] const REPEAT_ON_TYPE = ['interval', 'days_of_the_week', 'day_of_the_month'] const MONTHS = [ 'january', @@ -64,46 +61,40 @@ const DAYS = [ 'sunday', ] -const WEEK_PATTERNS = { - every_week: 'Every week', - week_of_month: 'Specific occurrences in the month', -} +const WEEK_PATTERNS = ['every_week', 'week_of_month'] + +const DAY_OCCURRENCE_VALUES = [1, 2, 3, 4, -1] + +// -1 is the "last occurrence" sentinel; everything else keys off its number. +const occurrenceKey = value => (value === -1 ? 'last' : String(value)) -const DAY_OCCURRENCE_OPTIONS = [ - { value: 1, label: '1st occurrence' }, - { value: 2, label: '2nd occurrence' }, - { value: 3, label: '3rd occurrence' }, - { value: 4, label: '4th occurrence' }, - { value: -1, label: 'Last occurrence' }, -] // Helper function to generate schedule preview text -const generateSchedulePreview = (metadata, formatTimeFn) => { +const generateSchedulePreview = (metadata, formatTimeFn, t) => { if (!metadata?.days?.length) return '' const dayNames = metadata.days - .map(day => day.charAt(0).toUpperCase() + day.slice(1, 3)) + .map(day => t(`repeat.daysShort.${day}`)) .join(', ') - const timeStr = metadata.time ? formatTimeFn(metadata.time) : '6:00 PM' - - if (metadata.weekPattern === 'every_week' || !metadata.weekPattern) { - return `Every ${dayNames} at ${timeStr}` - } + const timeStr = metadata.time + ? formatTimeFn(metadata.time) + : t('repeat.defaultTime') if ( metadata.weekPattern === 'week_of_month' && metadata.occurrences?.length ) { const occurrenceStr = metadata.occurrences - .map(w => { - if (w === -1) return 'last' - return `${w}${w === 1 ? 'st' : w === 2 ? 'nd' : w === 3 ? 'rd' : 'th'}` - }) + .map(w => t(`repeat.ordinal.${occurrenceKey(w)}`)) .join(', ') - return `Every ${occurrenceStr} ${dayNames} of the month at ${timeStr}` + return t('repeat.previewOccurrence', { + occurrences: occurrenceStr, + days: dayNames, + time: timeStr, + }) } - return `Every ${dayNames} at ${timeStr}` + return t('repeat.previewEvery', { days: dayNames, time: timeStr }) } export const RepeatOnSections = ({ @@ -114,6 +105,7 @@ export const RepeatOnSections = ({ onFrequencyUpdate, }) => { const { fmt } = useLocalization() + const { t } = useTranslation('chores') // if time on frequencyMetadata is not set, try to set it to the nextDueDate if available, // otherwise set it to 18:00 of the current day useEffect(() => { @@ -142,7 +134,7 @@ export const RepeatOnSections = ({ flexDirection: 'column', }} > - Time of day: + {t('repeat.timeOfDay')} - Every: + {t('repeat.every')} @@ -239,7 +231,7 @@ export const RepeatOnSections = ({ overlay disableIcon variant='soft' - label={item.charAt(0).toUpperCase() + item.slice(1)} + label={t(`repeat.days.${item}`)} /> ))} @@ -268,8 +260,8 @@ export const RepeatOnSections = ({ disableIcon > {frequencyMetadata?.days?.length === 7 - ? 'Unselect All' - : 'Select All'} + ? t('repeat.unselectAll') + : t('repeat.selectAll')} @@ -291,20 +283,16 @@ export const RepeatOnSections = ({ }} sx={{ gap: 1, '& > div': { p: 1 } }} > - {Object.entries(WEEK_PATTERNS).map(([value, label]) => ( + {WEEK_PATTERNS.map(value => ( - - {value === 'every_week' && ( - - Task repeats every week on selected days - - )} - {value === 'week_of_month' && ( - - Task repeats on specific day occurrences each month - (e.g., 1st Monday, 3rd Friday) - - )} + + + {t(`repeat.weekPatternHelp.${value}`)} + ))} @@ -312,10 +300,10 @@ export const RepeatOnSections = ({ {frequencyMetadata?.weekPattern === 'week_of_month' && ( - Select which occurrences of the selected days: + {t('repeat.selectOccurrences')} - Example: "1st Monday" means the first Monday of each month + {t('repeat.occurrenceExample')} - {DAY_OCCURRENCE_OPTIONS.map(option => ( - + {DAY_OCCURRENCE_VALUES.map(option => ( + { const currentOccurrences = frequencyMetadata?.occurrences || [] const newOccurrences = - currentOccurrences.includes(option.value) - ? currentOccurrences.filter( - w => w !== option.value, - ) - : [...currentOccurrences, option.value] + currentOccurrences.includes(option) + ? currentOccurrences.filter(w => w !== option) + : [...currentOccurrences, option] onFrequencyMetadataUpdate({ ...frequencyMetadata, occurrences: newOccurrences.sort((a, b) => { @@ -355,7 +341,9 @@ export const RepeatOnSections = ({ overlay disableIcon variant='soft' - label={option.label} + label={t( + `repeat.occurrence.${occurrenceKey(option)}`, + )} /> ))} @@ -367,7 +355,7 @@ export const RepeatOnSections = ({ onClick={() => { if ( frequencyMetadata?.occurrences?.length === - DAY_OCCURRENCE_OPTIONS.length + DAY_OCCURRENCE_VALUES.length ) { onFrequencyMetadataUpdate({ ...frequencyMetadata, @@ -376,9 +364,7 @@ export const RepeatOnSections = ({ } else { onFrequencyMetadataUpdate({ ...frequencyMetadata, - occurrences: DAY_OCCURRENCE_OPTIONS.map( - option => option.value, - ), + occurrences: [...DAY_OCCURRENCE_VALUES], }) } }} @@ -386,9 +372,9 @@ export const RepeatOnSections = ({ disableIcon > {frequencyMetadata?.occurrences?.length === - DAY_OCCURRENCE_OPTIONS.length - ? 'Unselect All' - : 'Select All'} + DAY_OCCURRENCE_VALUES.length + ? t('repeat.unselectAll') + : t('repeat.selectAll')} @@ -400,7 +386,7 @@ export const RepeatOnSections = ({ {frequencyMetadata?.days?.length > 0 && ( - {generateSchedulePreview(frequencyMetadata, fmt.time)} + {generateSchedulePreview(frequencyMetadata, fmt.time, t)} )} @@ -458,7 +444,7 @@ export const RepeatOnSections = ({ overlay disableIcon variant='soft' - label={item.charAt(0).toUpperCase() + item.slice(1)} + label={t(`repeat.months.${item}`)} /> ))} @@ -485,8 +471,8 @@ export const RepeatOnSections = ({ disableIcon > {frequencyMetadata?.months?.length === 12 - ? 'Unselect All' - : 'Select All'} + ? t('repeat.unselectAll') + : t('repeat.selectAll')} @@ -497,7 +483,7 @@ export const RepeatOnSections = ({ mb: 1.5, }} > - on the + {t('repeat.onThe')} - of the above month/s + {t('repeat.ofAboveMonths')} {timePickerComponent} @@ -540,10 +526,11 @@ const RepeatSection = ({ viewOnly = false, }) => { const { data: userProfile } = useUserProfile({ enabled: !viewOnly }) + const { t } = useTranslation('chores') return ( - Repeat: + {t('repeat.title')} { @@ -556,16 +543,14 @@ const RepeatSection = ({ checked={!['once', 'trigger'].includes(frequencyType)} value={!['once', 'trigger'].includes(frequencyType)} overlay - label='Repeat this task' + label={t('repeat.repeatThisTask')} /> - - Is this something needed to be done regularly? - + {t('repeat.repeatThisTaskHelp')} {!['once', 'trigger'].includes(frequencyType) && ( <> - How often should it be repeated? + {t('repeat.howOften')} ))} - {FREQUENCY_TYPE_MESSAGE[frequencyType]} + + {FREQUENCY_TYPE_WITH_MESSAGE.includes(frequencyType) + ? t(`repeat.freqMessage.${frequencyType}`) + : ''} + {frequencyType === 'custom' || (REPEAT_ON_TYPE.includes(frequencyType) && ( <> - Repeat on: + {t('repeat.repeatOn')} @@ -678,21 +664,7 @@ const RepeatSection = ({ }} value={item} disableIcon - label={item - .split('_') - .map((i, idx) => { - // first or last word - if ( - idx === 0 || - idx === item.split('_').length - 1 - ) { - return ( - i.charAt(0).toUpperCase() + i.slice(1) - ) - } - return i - }) - .join(' ')} + label={t(`repeat.repeatOnType.${item}`)} variant='plain' sx={{ px: 2, @@ -749,24 +721,23 @@ const RepeatSection = ({ value={frequencyType === 'trigger'} disabled={!isPlusAccount(userProfile)} overlay - label='Trigger this task based on a thing state' + label={t('repeat.triggerLabel')} /> - Is this something that should be done when a thing state changes?{' '} + {t('repeat.triggerHelp')}{' '} {userProfile && !isPlusAccount(userProfile) && ( - Plus Feature + {t('settings:common.plusFeature')} )} {!isPlusAccount(userProfile) && ( - Thing-based triggers are not available in the Basic plan. Upgrade to - Plus to automatically trigger tasks when device states change. + {t('repeat.triggerPlanWarning')} )} diff --git a/src/views/Chores/ChoreListView.jsx b/src/views/Chores/ChoreListView.jsx index 968d160..1f399ed 100644 --- a/src/views/Chores/ChoreListView.jsx +++ b/src/views/Chores/ChoreListView.jsx @@ -152,7 +152,7 @@ const ChoreListView = ({ > - Reject + {t('list.reject')} @@ -173,7 +173,7 @@ const ChoreListView = ({ > - Pending + {t('list.pending')} @@ -231,7 +231,7 @@ const ChoreListView = ({ > - Schedule + {t('list.schedule')} @@ -251,7 +251,7 @@ const ChoreListView = ({ > - Edit + {t('common:edit')} @@ -272,7 +272,7 @@ const ChoreListView = ({ > - Nudge + {t('list.nudge')} @@ -293,7 +293,7 @@ const ChoreListView = ({ > - Delete + {t('common:delete')} diff --git a/src/views/Chores/MyChores.jsx b/src/views/Chores/MyChores.jsx index 36f318d..61117b1 100644 --- a/src/views/Chores/MyChores.jsx +++ b/src/views/Chores/MyChores.jsx @@ -77,13 +77,17 @@ import { INSIGHT_FILTER_DEFS } from './SmartInsightsCard' // Mirrors the assignee options in the toolbar, phrased to drop into a // sentence ("none of them are assigned to you"). -const ASSIGNEE_FILTER_LABELS = { - assigned_to_me: 'assigned to you', - available_for_me: 'available for you to pick up', - assigned_to_others: 'assigned to someone else', - assigned_to_me_tasks: 'assigned to you', - created_by_me: 'created by you', -} +// Which assignee filters describe a subset of "everyone" — the empty-state +// copy for each lives under `chores:empty.assignee.*` as a whole sentence, +// since the fragment ("assigned to you") cannot be slotted mid-sentence in +// every language. +const ASSIGNEE_FILTER_KEYS = [ + 'assigned_to_me', + 'available_for_me', + 'assigned_to_others', + 'assigned_to_me_tasks', + 'created_by_me', +] const MyChores = () => { const { data: userProfile, isLoading: isUserProfileLoading } = @@ -899,7 +903,8 @@ const MyChores = () => { // The assignee filter ("Mine", "Available to me", ...) is applied inside // ChoresGrouper, not in projectFilteredChores, so it can hide every task // while the unfiltered list still looks full. It narrows like any other. - const assigneeFilterLabel = ASSIGNEE_FILTER_LABELS[selectedChoreFilter] + const hasAssigneeNarrowing = + ASSIGNEE_FILTER_KEYS.includes(selectedChoreFilter) const hasAssigneeFilter = Boolean( selectedChoreFilter && selectedChoreFilter !== 'anyone', ) @@ -919,7 +924,7 @@ const MyChores = () => { // Worth its own wording: the assignee filter is the one narrowing that is // easy to forget you left on, so name it rather than saying "filters". const isAssigneeOnlyNarrowing = Boolean( - assigneeFilterLabel && + hasAssigneeNarrowing && !searchTerm?.length && !hasQuickFilters && !activeFilterId, @@ -973,13 +978,12 @@ const MyChores = () => { variant='error' fullHeight icon={} - title={"Can't reach Donetick"} + title={t('empty.errorTitle')} description={ - choresErrorDetails?.message || - 'Your tasks are safe. We just could not load them right now, check your connection and try again.' + choresErrorDetails?.message || t('empty.errorDescription') } primaryAction={{ - label: 'Try again', + label: t('empty.errorAction'), onClick: () => { refetchChores() queryClient.invalidateQueries(['circleMembers']) @@ -1163,15 +1167,15 @@ const MyChores = () => { variant='empty' fullHeight icon={} - title='No tasks yet' - description='Create your first task and Donetick keeps track of when it is due, whose turn it is, and what comes next.' + title={t('empty.noTasksTitle')} + description={t('empty.noTasksDescription')} primaryAction={{ - label: 'Create a task', + label: t('empty.createTask'), startDecorator: , onClick: () => setAddTaskModalOpen(true), }} secondaryAction={{ - label: 'More options', + label: t('empty.moreOptions'), onClick: () => Navigate('/chores/create'), }} /> @@ -1183,21 +1187,21 @@ const MyChores = () => { variant='no-results' fullHeight icon={} - title='No tasks match this view' + title={t('empty.noMatchTitle')} description={ searchTerm?.length > 0 - ? `Nothing matches "${searchTerm}". Try a different search, or clear what is narrowing the list.` + ? t('empty.noMatchSearch', { term: searchTerm }) : isAssigneeOnlyNarrowing - ? `There are tasks here, but none of them are ${assigneeFilterLabel}. Switch back to everyone to see the rest.` - : 'You have tasks, but none of them fit the filters that are currently on.' + ? t(`empty.assignee.${selectedChoreFilter}`) + : t('empty.noMatchFilters') } primaryAction={{ label: searchTerm?.length > 0 - ? 'Clear search' + ? t('empty.clearSearch') : isAssigneeOnlyNarrowing - ? "Show everyone's tasks" - : 'Clear filters', + ? t('empty.showEveryone') + : t('empty.clearFilters'), onClick: clearNarrowing, }} /> @@ -1206,15 +1210,15 @@ const MyChores = () => { variant='empty' fullHeight icon={} - title={`Nothing in ${selectedProject.name} yet`} - description='Tasks you add to this project show up here. Your other tasks are still where you left them.' + title={t('empty.projectTitle', { name: selectedProject.name })} + description={t('empty.projectDescription')} primaryAction={{ - label: 'Add a task here', + label: t('empty.addTaskHere'), startDecorator: , onClick: () => setAddTaskModalOpen(true), }} secondaryAction={{ - label: 'See tasks outside projects', + label: t('empty.seeOutsideProjects'), onClick: () => setSelectedProjectWithCache(null), }} /> @@ -1223,10 +1227,10 @@ const MyChores = () => { variant='empty' fullHeight icon={} - title='No tasks here yet' - description='Tasks that do not belong to a project live here. Add one, or switch projects to see what is in them.' + title={t('empty.noProjectTitle')} + description={t('empty.noProjectDescription')} primaryAction={{ - label: 'Create a task', + label: t('empty.createTask'), startDecorator: , onClick: () => setAddTaskModalOpen(true), }} @@ -1404,9 +1408,9 @@ const MyChores = () => { size='sm' icon={} title={t('list.nothingScheduled')} - description='This day is free. Add a task if you want something to land here.' + description={t('empty.dayFreeDescription')} primaryAction={{ - label: 'Add task', + label: t('empty.addTask'), startDecorator: , onClick: () => setAddTaskModalOpen(true), }} diff --git a/src/views/Chores/components/ChoreToolbarPrototype.jsx b/src/views/Chores/components/ChoreToolbarPrototype.jsx index ea8e995..65d1d7e 100644 --- a/src/views/Chores/components/ChoreToolbarPrototype.jsx +++ b/src/views/Chores/components/ChoreToolbarPrototype.jsx @@ -252,23 +252,27 @@ const ChoreToolbar = ({ if (!condition?.type) return 'Filter' const typeLabels = { - assignee: 'Assignee', - createdBy: 'Created By', - status: 'Status', - priority: 'Priority', + assignee: t('filterBuilder.assignee'), + createdBy: t('filterBuilder.createdBy'), + status: t('filterBuilder.statusHeading'), + priority: t('filterBuilder.priority'), label: t('labels.label'), - project: 'Project', - dueDate: 'Due Date', - points: 'Points', + project: t('filterBuilder.project'), + dueDate: t('filterBuilder.dueDate'), + points: t('filterBuilder.points'), } - const typeLabel = typeLabels[condition.type] || 'Filter' - const prefix = condition.operator === 'isNot' ? 'Not ' : '' + const typeLabel = + typeLabels[condition.type] || t('filterBuilder.filterFallback') + const prefix = + condition.operator === 'isNot' ? t('filterBuilder.notPrefix') : '' if (condition.type === 'dueDate') { - const dueDateLabel = - DUE_DATE_OPTIONS.find(o => o.value === condition.operator)?.label || - 'Custom' + const dueDateLabel = DUE_DATE_OPTIONS.some( + o => o.value === condition.operator, + ) + ? t(`filterBuilder.dueDateOption.${condition.operator}`) + : t('filterBuilder.customDueDate') return `${typeLabel}: ${dueDateLabel}` } @@ -292,9 +296,9 @@ const ChoreToolbar = ({ return member?.displayName || member?.username || String(value) } if (condition.type === 'status') { - return ( - CHORE_STATUSES.find(s => s.value === value)?.label || String(value) - ) + return CHORE_STATUSES.some(s => s.value === value) + ? t(`filterBuilder.status.${value}`) + : String(value) } if (condition.type === 'priority') { return Priorities.find(p => p.value === value)?.name || String(value) diff --git a/src/views/Chores/components/FilterBuilderContent.jsx b/src/views/Chores/components/FilterBuilderContent.jsx index a973032..348a47b 100644 --- a/src/views/Chores/components/FilterBuilderContent.jsx +++ b/src/views/Chores/components/FilterBuilderContent.jsx @@ -9,17 +9,20 @@ import { TaskAlt, } from '@mui/icons-material' import { Avatar, Box, Chip, Divider, Input, Typography } from '@mui/joy' +import { useTranslation } from 'react-i18next' import Priorities from '../../../utils/Priorities' +// `labelKey` resolves against `chores:filterBuilder.dueDateOption.*` — these +// are also read by ChoreToolbarPrototype, which translates them the same way. export const DUE_DATE_OPTIONS = [ - { value: 'isOverdue', label: 'Overdue', color: 'danger' }, - { value: 'isDueToday', label: 'Today', color: 'warning' }, - { value: 'isDueTomorrow', label: 'Tomorrow', color: 'primary' }, - { value: 'isDueThisWeek', label: 'This Week', color: 'primary' }, - { value: 'isDueThisMonth', label: 'This Month', color: 'neutral' }, - { value: 'hasNoDueDate', label: 'No Due Date', color: 'neutral' }, - { value: 'hasDueDate', label: 'Has Due Date', color: 'neutral' }, + { value: 'isOverdue', color: 'danger' }, + { value: 'isDueToday', color: 'warning' }, + { value: 'isDueTomorrow', color: 'primary' }, + { value: 'isDueThisWeek', color: 'primary' }, + { value: 'isDueThisMonth', color: 'neutral' }, + { value: 'hasNoDueDate', color: 'neutral' }, + { value: 'hasDueDate', color: 'neutral' }, ] export const POINTS_OPERATORS = [ @@ -31,10 +34,10 @@ export const POINTS_OPERATORS = [ ] export const CHORE_STATUSES = [ - { value: 0, label: 'Active' }, - { value: 1, label: 'Started' }, - { value: 2, label: 'In Progress' }, - { value: 3, label: 'Pending Approval' }, + { value: 0 }, + { value: 1 }, + { value: 2 }, + { value: 3 }, ] export const defaultSelections = () => ({ @@ -119,35 +122,39 @@ const SectionHeader = ({ children, icon, label }) => ( ) -const IncludeExcludeToggle = ({ - labels = ['Include', 'Exclude'], - onChange, - value, -}) => ( - - {[ - { op: 'is', label: labels[0] }, - { op: 'isNot', label: labels[1] }, - ].map(o => ( - onChange(o.op)} - sx={{ - cursor: 'pointer', - userSelect: 'none', - transition: 'all 0.15s ease', - }} - > - {o.label} - - ))} - -) +const IncludeExcludeToggle = ({ labelKeys, onChange, value }) => { + const { t } = useTranslation('chores') + const [includeKey, excludeKey] = labelKeys ?? ['include', 'exclude'] + return ( + + {[ + { op: 'is', labelKey: includeKey }, + { op: 'isNot', labelKey: excludeKey }, + ].map(o => ( + onChange(o.op)} + sx={{ + cursor: 'pointer', + userSelect: 'none', + transition: 'all 0.15s ease', + }} + > + {t(`filterBuilder.${o.labelKey}`)} + + ))} + + ) +} /** * Reusable filter conditions UI used by both the filter sheet in ChoreToolbar @@ -163,6 +170,7 @@ const FilterBuilderContent = ({ projects = [], selections, }) => { + const { t } = useTranslation('chores') const toggleValue = (type, value) => onSelectionsChange(prev => { const cur = prev[type].values || [] @@ -272,7 +280,7 @@ const FilterBuilderContent = ({ {/* Assignee */} {members.length > 0 && ( <> - } label='Assignee'> + } label={t('filterBuilder.assignee')}> setOperator('assignee', op)} @@ -286,7 +294,7 @@ const FilterBuilderContent = ({ {/* Created By */} {members.length > 0 && ( <> - } label='Created By'> + } label={t('filterBuilder.createdBy')}> setOperator('createdBy', op)} @@ -298,17 +306,29 @@ const FilterBuilderContent = ({ )} {/* Status */} - } label='Status'> + } + label={t('filterBuilder.statusHeading')} + > setOperator('status', op)} /> - {chipRow('status', CHORE_STATUSES)} + {chipRow( + 'status', + CHORE_STATUSES.map(st => ({ + value: st.value, + label: t(`filterBuilder.status.${st.value}`), + })), + )} {/* Priority */} - } label='Priority'> + } + label={t('filterBuilder.priority')} + > setOperator('priority', op)} @@ -329,7 +349,10 @@ const FilterBuilderContent = ({ {/* Due Date */} - } label='Due Date' /> + } + label={t('filterBuilder.dueDate')} + /> {DUE_DATE_OPTIONS.map(opt => { const isSelected = selections.dueDate.operator === opt.value @@ -348,7 +371,7 @@ const FilterBuilderContent = ({ transition: 'all 0.15s ease', }} > - {opt.label} + {t(`filterBuilder.dueDateOption.${opt.value}`)} ) })} @@ -358,11 +381,11 @@ const FilterBuilderContent = ({ {/* Labels */} {labels.length > 0 && ( <> - } label='Labels'> + } label={t('filterBuilder.labels')}> setOperator('label', op)} - labels={['Has', "Doesn't Have"]} + labelKeys={['has', 'doesntHave']} /> @@ -410,14 +433,17 @@ const FilterBuilderContent = ({ {/* Projects */} {projects.length > 0 && ( <> - } label='Projects'> + } + label={t('filterBuilder.projects')} + > setOperator('project', op)} /> {chipRow('project', [ - { value: 'default', label: 'Default Project' }, + { value: 'default', label: t('filterBuilder.defaultProject') }, ...projects .filter(p => p.id !== 'default') .map(p => ({ value: p.id, label: p.name })), @@ -427,7 +453,7 @@ const FilterBuilderContent = ({ )} {/* Points */} - } label='Points' /> + } label={t('filterBuilder.points')} /> @@ -479,7 +505,7 @@ const FilterBuilderContent = ({ } sx={{ cursor: 'pointer' }} > - Clear + {t('filterBuilder.clear')} )} diff --git a/src/views/Chores/components/MultiSelectToolbar.jsx b/src/views/Chores/components/MultiSelectToolbar.jsx index 1f7dbad..2d7b2c1 100644 --- a/src/views/Chores/components/MultiSelectToolbar.jsx +++ b/src/views/Chores/components/MultiSelectToolbar.jsx @@ -78,19 +78,19 @@ const dateOnly = date => ({ const DUE_DATE_PRESETS = [ { key: 'today', - label: 'Today', + labelKey: 'presetToday', resolve: () => dateOnly(moment()), hint: () => moment().format('ddd, MMM D'), }, { key: 'tomorrow', - label: 'Tomorrow', + labelKey: 'presetTomorrow', resolve: () => dateOnly(moment().add(1, 'day')), hint: () => moment().add(1, 'day').format('ddd, MMM D'), }, { key: 'next-week', - label: 'Next week', + labelKey: 'presetNextWeek', resolve: () => dateOnly(moment().add(1, 'week').startOf('isoWeek')), hint: () => moment().add(1, 'week').startOf('isoWeek').format('ddd, MMM D'), }, @@ -189,18 +189,18 @@ const MultiSelectToolbar = ({ } const dueDateValue = summary.dueDate?.isMixed - ? 'Mixed' + ? t('multiToolbar.mixed') : summary.dueDate?.value ? moment(summary.dueDate.value).format('MMM D') : null const priorityValue = summary.priority?.isMixed - ? 'Mixed' + ? t('multiToolbar.mixed') : Priorities.find(p => p.value === summary.priority?.value)?.name.trim() || null const assigneeValue = summary.assignee?.isMixed - ? 'Mixed' + ? t('multiToolbar.mixed') : members.find(m => m.userId === summary.assignee?.value)?.displayName || null @@ -389,11 +389,11 @@ const MultiSelectToolbar = ({ }} title={ dueDateValue - ? `Due date on selected tasks: ${dueDateValue}` - : 'Set due date on selected tasks' + ? t('multiToolbar.dueTitleSet', { value: dueDateValue }) + : t('multiToolbar.dueTitleEmpty') } > - Due + {t('multiToolbar.due')} - {preset.label} + + {t(`multiToolbar.${preset.labelKey}`)} + - Pick date… + + {t('multiToolbar.pickDate')} + - No due date + + {t('multiToolbar.noDueDate')} + @@ -500,9 +506,9 @@ const MultiSelectToolbar = ({ sx={{ '--Button-paddingInline': { xs: '0.75rem', sm: '1rem' }, }} - title='Move selected tasks to a project' + title={t('multiToolbar.moveTitle')} > - Move + {t('multiToolbar.move')} { closeProjectMenu() - onMoveToProject({ id: null, name: 'Default Project' }) + onMoveToProject({ + id: null, + name: t('multiToolbar.defaultProject'), + }) }} > {renderProjectAvatar(LABEL_COLORS[0].value, 'FolderOpen')} - Default Project + + {t('multiToolbar.defaultProject')} + {projects.map(project => ( @@ -608,9 +619,9 @@ const MultiSelectToolbar = ({ sx={{ '--Button-paddingInline': { xs: '0.75rem', sm: '1rem' }, }} - title='Set priority, assignee, or labels' + title={t('multiToolbar.moreTitle')} > - More + {t('multiToolbar.more')} @@ -634,7 +645,7 @@ const MultiSelectToolbar = ({ onClick={() => setMoreOpen(false)} sx={{ minWidth: 140 }} > - Done + {t('multiToolbar.done')} } > @@ -646,7 +657,7 @@ const MultiSelectToolbar = ({ <> } - label='Priority' + label={t('multiToolbar.priority')} value={priorityValue} /> @@ -677,7 +688,7 @@ const MultiSelectToolbar = ({ onClick={runAndClose(() => onSetPriority(0))} sx={selectableChipSx} > - None + {t('multiToolbar.noPriority')} @@ -688,7 +699,7 @@ const MultiSelectToolbar = ({ } - label='Assignee' + label={t('multiToolbar.assignee')} value={assigneeValue} /> @@ -731,8 +742,8 @@ const MultiSelectToolbar = ({ only some of the selection has it — tapping completes the set. */} } - label='Labels' - value='Tap to add · tap again to remove' + label={t('multiToolbar.labels')} + value={t('multiToolbar.labelsHint')} /> {labels.map(label => { diff --git a/src/views/Circles/JoinCircle.jsx b/src/views/Circles/JoinCircle.jsx index a62b99f..8e1d306 100644 --- a/src/views/Circles/JoinCircle.jsx +++ b/src/views/Circles/JoinCircle.jsx @@ -1,5 +1,6 @@ import { Box, Button, CircularProgress, Input, Typography } from '@mui/joy' import { useCallback, useEffect, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' import { useNavigate, useSearchParams } from 'react-router-dom' import useAcknowledgmentModal from '../../hooks/useAcknowledgmentModal' @@ -23,6 +24,7 @@ const enter = (delay = 0) => ({ }) const JoinCircleView = () => { + const { t } = useTranslation() const { data: userProfile, isLoading: isProfileLoading } = useUserProfile() // Read the token rather than useAuth(): the provider's copy only updates // through its own login(), so signup and the OAuth callback — which save @@ -49,20 +51,18 @@ const JoinCircleView = () => { clearPendingInvite() if (resp.ok) { showAcknowledgment( - 'Your request has been sent. A circle admin will need to approve ' + - "it before you can access the circle and its chores. We'll " + - "notify you when it's approved.", - 'Request sent', + t('joinCircle.requestSentBody'), + t('joinCircle.requestSentTitle'), () => navigate('/chores'), - 'Got it', + t('joinCircle.gotIt'), 'success', ) } else { setIsJoining(false) if (resp.status === 409) { - showError('You are already a member of this circle') + showError(t('joinCircle.alreadyMember')) } else { - showError('Failed to join circle') + showError(t('joinCircle.joinFailed')) } navigate('/chores') } @@ -70,9 +70,9 @@ const JoinCircleView = () => { .catch(() => { setIsJoining(false) clearPendingInvite() - showError('Could not send your join request. Please try again.') + showError(t('joinCircle.requestError')) }) - }, [code, navigate, showAcknowledgment, showError]) + }, [code, navigate, showAcknowledgment, showError, t]) // Coming back from login/signup the user already said yes by opening the // link, so send the request instead of asking a second time. This step used @@ -102,14 +102,13 @@ const JoinCircleView = () => { /> ) - let title = "You're invited to join a circle" + let title = t('joinCircle.title') let subtitle = null let body = null if (!code) { - title = 'Invite link is incomplete' - subtitle = - 'This invite link is missing a code. Ask the person who invited you to send a new link.' + title = t('joinCircle.incompleteTitle') + subtitle = t('joinCircle.incompleteSubtitle') body = ( ) // A token that no longer resolves to a profile is as good as signed out — // better to offer sign-in than to spin forever. } else if (!isAuthenticated || (!isProfileLoading && !userProfile)) { - subtitle = - "Sign in or create a Donetick account to continue. We'll send your join request once you're signed in." + subtitle = t('joinCircle.signedOutSubtitle') body = ( {inviteCodeField} @@ -134,7 +132,7 @@ const JoinCircleView = () => { sx={authButtonSx} onClick={() => goToAuth('/login')} > - Sign in + {t('joinCircle.signIn')} ) } else if (isProfileLoading || isJoining) { - title = 'Sending your request' - subtitle = 'Sending your request…' + title = t('joinCircle.sendingTitle') + subtitle = t('joinCircle.sendingSubtitle') body = ( ) } else { - subtitle = - `Hi ${userProfile?.displayName || userProfile?.username}. ` + - "Send a request to share this circle's chores with its members." + subtitle = t('joinCircle.greetingSubtitle', { + name: userProfile?.displayName || userProfile?.username, + }) body = ( - A circle admin will review your request before you get access. + {t('joinCircle.adminReviewNote')} ) diff --git a/src/views/Modals/ErrorReportModal.jsx b/src/views/Modals/ErrorReportModal.jsx index ca8caba..d147905 100644 --- a/src/views/Modals/ErrorReportModal.jsx +++ b/src/views/Modals/ErrorReportModal.jsx @@ -19,6 +19,7 @@ import { Typography, } from '@mui/joy' import { useEffect, useState } from 'react' +import { useTranslation } from 'react-i18next' import { useResponsiveModal } from '../../hooks/useResponsiveModal.js' import { @@ -106,6 +107,7 @@ const IconHalo = ({ color = 'primary', icon }) => ( */ const ErrorReportModal = ({ error, errorInfo, onClose, open }) => { const { ResponsiveModal } = useResponsiveModal() + const { t } = useTranslation('common') const isBugReport = !error const [report, setReport] = useState(null) @@ -175,21 +177,25 @@ const ErrorReportModal = ({ error, errorInfo, onClose, open }) => { level='h4' sx={{ fontWeight: 700, letterSpacing: '-0.01em' }} > - {isBugReport ? 'Report an issue' : 'Report this problem'} + {isBugReport + ? t('errorReport.titleBug') + : t('errorReport.titleCrash')} {isBugReport - ? 'Tell us what went wrong and we’ll attach the technical details for you.' - : 'A sentence about what you were doing turns this into something we can actually fix.'} + ? t('errorReport.subtitleBug') + : t('errorReport.subtitleCrash')} - {isBugReport ? 'What went wrong?' : 'What were you doing?'} + {isBugReport + ? t('errorReport.labelBug') + : t('errorReport.labelCrash')}