|
1 | 1 | <script lang="ts"> |
2 | 2 | import { categories, saveCategoryAction, deleteCategoryAction, reorderCategories } from '../lib/stores/vault' |
| 3 | + import { t, locale } from '../lib/i18n' |
3 | 4 | import type { Category } from '../lib/types' |
| 5 | + $locale // reactive subscription |
4 | 6 |
|
5 | 7 | let { |
6 | 8 | compact = false, |
|
143 | 145 | color: var(--vault-on-bg-muted); |
144 | 146 | font-family: var(--font-display); |
145 | 147 | letter-spacing: 0.12em; |
146 | | -">Categorías</p> |
| 148 | +">{t('cat.title')}</p> |
147 | 149 |
|
148 | 150 | <div class="rounded-2xl sm:rounded-3xl p-4 sm:p-5 pt-5 sm:pt-6 mb-4 sm:mb-5 relative overflow-hidden" style=" |
149 | 151 | background: var(--vault-section-bg-alt); |
|
165 | 167 | border: 1px solid var(--vault-border); |
166 | 168 | line-height: 1; |
167 | 169 | " |
168 | | - aria-label="Emoji de categoría" |
| 170 | + aria-label={t('cat.emoji_label')} |
169 | 171 | /> |
170 | 172 |
|
171 | 173 | <input |
172 | 174 | type="text" |
173 | 175 | bind:value={newName} |
174 | | - placeholder="Nueva categoría" |
| 176 | + placeholder={t('cat.name_placeholder')} |
175 | 177 | class="h-10 sm:h-11 px-3 rounded-xl text-sm outline-none transition-all" |
176 | 178 | style=" |
177 | 179 | background: var(--vault-surface); |
|
187 | 189 | <label class="relative w-10 sm:w-[42px] h-10 sm:h-11 rounded-xl overflow-hidden cursor-pointer shrink-0" style=" |
188 | 190 | border: 2px solid var(--vault-thumb-border); |
189 | 191 | background: {newColor}; |
190 | | - " title="Elegir color"> |
| 192 | + " title={t('cat.choose_color')}> |
191 | 193 | <input |
192 | 194 | type="color" |
193 | 195 | bind:value={newColor} |
|
273 | 275 | const el = e.currentTarget as HTMLElement |
274 | 276 | el.style.transform = 'translateY(0) scale(1)' |
275 | 277 | }} |
276 | | - >{saving ? 'Guardando...' : '+ Agregar categoría'}</button> |
| 278 | + >{saving ? t('common.saving') : t('cat.add_btn')}</button> |
277 | 279 | </div> |
278 | 280 |
|
279 | 281 | {#if $categories.length > 0} |
|
361 | 363 |
|
362 | 364 | {#if confirmDeleteId === cat.id} |
363 | 365 | <div class="flex items-center gap-1.5"> |
364 | | - <span class="text-xs" style="color: var(--vault-on-bg-muted)">¿Borrar?</span> |
| 366 | + <span class="text-xs" style="color: var(--vault-on-bg-muted)">{t('common.delete_confirm_short')}</span> |
365 | 367 | <button |
366 | 368 | onclick={() => handleDelete(cat.id)} |
367 | 369 | class="px-2 py-0.5 rounded-lg text-xs font-semibold text-white" |
368 | 370 | style="background: rgba(239,68,68,0.75)" |
369 | | - >Sí</button> |
| 371 | + >{t('common.yes')}</button> |
370 | 372 | <button |
371 | 373 | onclick={() => confirmDeleteId = null} |
372 | 374 | class="px-2 py-0.5 rounded-lg text-xs" |
373 | 375 | style="background: var(--vault-card-hover-bg); color: var(--vault-on-bg-muted)" |
374 | | - >No</button> |
| 376 | + >{t('common.no')}</button> |
375 | 377 | </div> |
376 | 378 | {:else} |
377 | 379 | <div class="flex items-center gap-1"> |
|
381 | 383 | style="color: var(--vault-on-bg-muted)" |
382 | 384 | onmouseenter={(e) => (e.currentTarget as HTMLElement).style.background = 'var(--vault-card-hover-bg)'} |
383 | 385 | onmouseleave={(e) => (e.currentTarget as HTMLElement).style.background = 'transparent'} |
384 | | - aria-label="Editar" |
| 386 | + aria-label={t('common.edit')} |
385 | 387 | > |
386 | 388 | <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
387 | 389 | <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/> |
|
394 | 396 | style="color: rgba(239,68,68,0.6)" |
395 | 397 | onmouseenter={(e) => (e.currentTarget as HTMLElement).style.background = 'rgba(239,68,68,0.1)'} |
396 | 398 | onmouseleave={(e) => (e.currentTarget as HTMLElement).style.background = 'transparent'} |
397 | | - aria-label="Eliminar" |
| 399 | + aria-label={t('common.delete')} |
398 | 400 | > |
399 | 401 | <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
400 | 402 | <polyline points="3 6 5 6 21 6"/> |
|
411 | 413 | </div> |
412 | 414 | {:else} |
413 | 415 | <div class="flex flex-col items-center justify-center py-8 gap-2" style="opacity: 0.45"> |
414 | | - <p class="text-sm" style="font-family: var(--font-display); color: var(--vault-on-bg-muted)">Sin categorías todavía</p> |
| 416 | + <p class="text-sm" style="font-family: var(--font-display); color: var(--vault-on-bg-muted)">{t('cat.no_categories')}</p> |
415 | 417 | </div> |
416 | 418 | {/if} |
417 | 419 |
|
|
0 commit comments