|
39 | 39 | let form = $state({ ...defaultForm }); |
40 | 40 |
|
41 | 41 | const projectOptions = $derived([ |
42 | | - { value: '', label: 'Select a project...' }, |
| 42 | + { value: '', label: t('time.pomodoro.selectProject') }, |
43 | 43 | ...projects |
44 | 44 | .filter((project) => project.status === 'Active') |
45 | 45 | .map((project) => ({ |
|
111 | 111 | loaded = true; |
112 | 112 | } catch (err) { |
113 | 113 | console.warn('[pomodoro-settings] failed to load settings:', err); |
114 | | - error = `Failed to load settings: ${err?.message || err}`; |
| 114 | + error = t('time.pomodoro.loadError', { error: err?.message || err }); |
115 | 115 | } finally { |
116 | 116 | loading = false; |
117 | 117 | } |
|
135 | 135 | try { |
136 | 136 | const call = await getInvoke(); |
137 | 137 | await call('save_pomodoro_settings', { settings: toSettings(form) }); |
138 | | - status = 'Settings saved'; |
| 138 | + status = t('time.pomodoro.settingsSaved'); |
139 | 139 | } catch (err) { |
140 | 140 | console.warn('[pomodoro-settings] failed to save settings:', err); |
141 | | - error = `Failed to save settings: ${err?.message || err}`; |
| 141 | + error = t('time.pomodoro.saveError', { error: err?.message || err }); |
142 | 142 | } finally { |
143 | 143 | saving = false; |
144 | 144 | } |
|
171 | 171 | > |
172 | 172 | <div class="flex items-center justify-between border-b px-6 py-4" style="border-color: var(--ds-border);"> |
173 | 173 | <div> |
174 | | - <h2 id="pomodoro-settings-title" class="text-lg font-semibold">Pomodoro Settings</h2> |
175 | | - <p class="mt-1 text-sm" style="color: var(--ds-text-subtle);">Configure desktop timer behavior and automatic time logging.</p> |
| 174 | + <h2 id="pomodoro-settings-title" class="text-lg font-semibold">{t('time.pomodoro.title')}</h2> |
| 175 | + <p class="mt-1 text-sm" style="color: var(--ds-text-subtle);">{t('time.pomodoro.subtitle')}</p> |
176 | 176 | </div> |
177 | 177 | <Button variant="ghost" icon={X} onclick={close} title={t('common.close')} /> |
178 | 178 | </div> |
179 | 179 |
|
180 | 180 | <div class="px-6 py-5"> |
181 | 181 | {#if loading} |
182 | | - <p class="text-sm" style="color: var(--ds-text-subtle);">Loading settings...</p> |
| 182 | + <p class="text-sm" style="color: var(--ds-text-subtle);">{t('time.pomodoro.loadingSettings')}</p> |
183 | 183 | {:else} |
184 | 184 | <div class="grid gap-6 md:grid-cols-3"> |
185 | 185 | <section class="md:col-span-2"> |
186 | 186 | <div class="mb-3 flex items-center gap-2"> |
187 | 187 | <Clock class="h-5 w-5" style="color: var(--ds-icon);" /> |
188 | | - <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">Timer</h3> |
| 188 | + <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">{t('time.pomodoro.timer')}</h3> |
189 | 189 | </div> |
190 | 190 |
|
191 | 191 | <div class="grid gap-x-4 md:grid-cols-2"> |
192 | | - <FormField label="Work duration" helper="Minutes per focus session"> |
| 192 | + <FormField label={t('time.pomodoro.workDuration')} helper={t('time.pomodoro.workDurationHelper')}> |
193 | 193 | <Input type="number" min="1" step="1" bind:value={form.work_duration_minutes} /> |
194 | 194 | </FormField> |
195 | | - <FormField label="Short break" helper="Minutes between work sessions"> |
| 195 | + <FormField label={t('time.pomodoro.shortBreak')} helper={t('time.pomodoro.shortBreakHelper')}> |
196 | 196 | <Input type="number" min="1" step="1" bind:value={form.short_break_minutes} /> |
197 | 197 | </FormField> |
198 | | - <FormField label="Long break" helper="Minutes after a completed cycle"> |
| 198 | + <FormField label={t('time.pomodoro.longBreak')} helper={t('time.pomodoro.longBreakHelper')}> |
199 | 199 | <Input type="number" min="1" step="1" bind:value={form.long_break_minutes} /> |
200 | 200 | </FormField> |
201 | | - <FormField label="Sessions before long break" helper="Completed work sessions"> |
| 201 | + <FormField label={t('time.pomodoro.sessionsBeforeLongBreak')} helper={t('time.pomodoro.sessionsBeforeLongBreakHelper')}> |
202 | 202 | <Input type="number" min="1" step="1" bind:value={form.cycles_before_long_break} /> |
203 | 203 | </FormField> |
204 | 204 | </div> |
|
207 | 207 | <section> |
208 | 208 | <div class="mb-3 flex items-center gap-2"> |
209 | 209 | <Play class="h-5 w-5" style="color: var(--ds-icon);" /> |
210 | | - <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">Behavior</h3> |
| 210 | + <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">{t('time.pomodoro.behavior')}</h3> |
211 | 211 | </div> |
212 | 212 | <div class="space-y-4 rounded border p-4" style="border-color: var(--ds-border); background-color: var(--ds-surface);"> |
213 | | - <Toggle bind:checked={form.auto_start_break} label="Auto-start breaks" /> |
214 | | - <Toggle bind:checked={form.auto_start_work} label="Auto-start work" /> |
| 213 | + <Toggle bind:checked={form.auto_start_break} label={t('time.pomodoro.autoStartBreaks')} /> |
| 214 | + <Toggle bind:checked={form.auto_start_work} label={t('time.pomodoro.autoStartWork')} /> |
215 | 215 | </div> |
216 | 216 | </section> |
217 | 217 | </div> |
218 | 218 |
|
219 | 219 | <section class="mt-6"> |
220 | 220 | <div class="mb-3 flex items-center gap-2"> |
221 | 221 | <FileText class="h-5 w-5" style="color: var(--ds-icon);" /> |
222 | | - <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">Logging</h3> |
| 222 | + <h3 class="text-sm font-semibold uppercase tracking-wide" style="color: var(--ds-text-subtle);">{t('time.pomodoro.logging')}</h3> |
223 | 223 | </div> |
224 | 224 |
|
225 | 225 | <div class="rounded border p-4" style="border-color: var(--ds-border); background-color: var(--ds-surface);"> |
226 | | - <Toggle bind:checked={form.auto_log_enabled} label="Automatically log completed work sessions" /> |
| 226 | + <Toggle bind:checked={form.auto_log_enabled} label={t('time.pomodoro.autoLogCompletedSessions')} /> |
227 | 227 |
|
228 | 228 | {#if form.auto_log_enabled} |
229 | 229 | <div class="mt-4 grid gap-x-4 md:grid-cols-2"> |
230 | | - <FormField label="Project" helper="Active time projects from this workspace server"> |
| 230 | + <FormField label={t('time.pomodoro.project')} helper={t('time.pomodoro.projectHelper')}> |
231 | 231 | <Select |
232 | 232 | bind:value={form.log_project_id} |
233 | 233 | options={projectOptions} |
234 | | - placeholder={projectsLoaded ? 'Select a project...' : 'Loading projects...'} |
| 234 | + placeholder={projectsLoaded ? t('time.pomodoro.selectProject') : t('time.pomodoro.loadingProjects')} |
235 | 235 | /> |
236 | 236 | </FormField> |
237 | | - <FormField label="Description" helper="Used for new worklog entries"> |
238 | | - <Input bind:value={form.log_description} placeholder="Pomodoro session" /> |
| 237 | + <FormField label={t('time.pomodoro.description')} helper={t('time.pomodoro.descriptionHelper')}> |
| 238 | + <Input bind:value={form.log_description} placeholder={t('time.pomodoro.sessionPlaceholder')} /> |
239 | 239 | </FormField> |
240 | 240 | </div> |
241 | 241 | {/if} |
|
255 | 255 | </div> |
256 | 256 |
|
257 | 257 | <div class="flex justify-end gap-3 border-t px-6 py-4" style="border-color: var(--ds-border);"> |
258 | | - <Button variant="default" size="small" onclick={close}>Cancel</Button> |
259 | | - <Button variant="primary" size="small" onclick={save} loading={saving} disabled={loading}>Save Settings</Button> |
| 258 | + <Button variant="default" size="small" onclick={close}>{t('time.pomodoro.cancel')}</Button> |
| 259 | + <Button variant="primary" size="small" onclick={save} loading={saving} disabled={loading}>{t('time.pomodoro.saveSettings')}</Button> |
260 | 260 | </div> |
261 | 261 | </div> |
262 | 262 | </ModalBackdrop> |
0 commit comments