Skip to content

Commit 2007c1a

Browse files
committed
feat: adding i18n
1 parent 81cc6d9 commit 2007c1a

7 files changed

Lines changed: 388 additions & 60 deletions

File tree

src/components/CategoryManager.svelte

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script lang="ts">
22
import { categories, saveCategoryAction, deleteCategoryAction, reorderCategories } from '../lib/stores/vault'
3+
import { t, locale } from '../lib/i18n'
34
import type { Category } from '../lib/types'
5+
$locale // reactive subscription
46
57
let {
68
compact = false,
@@ -143,7 +145,7 @@
143145
color: var(--vault-on-bg-muted);
144146
font-family: var(--font-display);
145147
letter-spacing: 0.12em;
146-
">Categorías</p>
148+
">{t('cat.title')}</p>
147149

148150
<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="
149151
background: var(--vault-section-bg-alt);
@@ -165,13 +167,13 @@
165167
border: 1px solid var(--vault-border);
166168
line-height: 1;
167169
"
168-
aria-label="Emoji de categoría"
170+
aria-label={t('cat.emoji_label')}
169171
/>
170172

171173
<input
172174
type="text"
173175
bind:value={newName}
174-
placeholder="Nueva categoría"
176+
placeholder={t('cat.name_placeholder')}
175177
class="h-10 sm:h-11 px-3 rounded-xl text-sm outline-none transition-all"
176178
style="
177179
background: var(--vault-surface);
@@ -187,7 +189,7 @@
187189
<label class="relative w-10 sm:w-[42px] h-10 sm:h-11 rounded-xl overflow-hidden cursor-pointer shrink-0" style="
188190
border: 2px solid var(--vault-thumb-border);
189191
background: {newColor};
190-
" title="Elegir color">
192+
" title={t('cat.choose_color')}>
191193
<input
192194
type="color"
193195
bind:value={newColor}
@@ -273,7 +275,7 @@
273275
const el = e.currentTarget as HTMLElement
274276
el.style.transform = 'translateY(0) scale(1)'
275277
}}
276-
>{saving ? 'Guardando...' : '+ Agregar categoría'}</button>
278+
>{saving ? t('common.saving') : t('cat.add_btn')}</button>
277279
</div>
278280

279281
{#if $categories.length > 0}
@@ -361,17 +363,17 @@
361363

362364
{#if confirmDeleteId === cat.id}
363365
<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>
365367
<button
366368
onclick={() => handleDelete(cat.id)}
367369
class="px-2 py-0.5 rounded-lg text-xs font-semibold text-white"
368370
style="background: rgba(239,68,68,0.75)"
369-
></button>
371+
>{t('common.yes')}</button>
370372
<button
371373
onclick={() => confirmDeleteId = null}
372374
class="px-2 py-0.5 rounded-lg text-xs"
373375
style="background: var(--vault-card-hover-bg); color: var(--vault-on-bg-muted)"
374-
>No</button>
376+
>{t('common.no')}</button>
375377
</div>
376378
{:else}
377379
<div class="flex items-center gap-1">
@@ -381,7 +383,7 @@
381383
style="color: var(--vault-on-bg-muted)"
382384
onmouseenter={(e) => (e.currentTarget as HTMLElement).style.background = 'var(--vault-card-hover-bg)'}
383385
onmouseleave={(e) => (e.currentTarget as HTMLElement).style.background = 'transparent'}
384-
aria-label="Editar"
386+
aria-label={t('common.edit')}
385387
>
386388
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
387389
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
@@ -394,7 +396,7 @@
394396
style="color: rgba(239,68,68,0.6)"
395397
onmouseenter={(e) => (e.currentTarget as HTMLElement).style.background = 'rgba(239,68,68,0.1)'}
396398
onmouseleave={(e) => (e.currentTarget as HTMLElement).style.background = 'transparent'}
397-
aria-label="Eliminar"
399+
aria-label={t('common.delete')}
398400
>
399401
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
400402
<polyline points="3 6 5 6 21 6"/>
@@ -411,7 +413,7 @@
411413
</div>
412414
{:else}
413415
<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>
415417
</div>
416418
{/if}
417419

src/components/EmptyState.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<script lang="ts">
2+
import { t, locale } from '../lib/i18n'
3+
$locale // reactive subscription
4+
</script>
15
<!--
26
PBL: El SVG custom comunica "craftsmanship".
37
El candado abierto con destellos refuerza la metáfora de la app.
@@ -53,11 +57,10 @@
5357

5458
<!-- Texto -->
5559
<h2 class="text-xl font-bold mb-2 text-center" style="font-family: var(--font-display); color: var(--vault-on-bg)">
56-
Tu bóveda está vacía
60+
{t('empty.title')}
5761
</h2>
5862
<p class="text-sm text-center max-w-xs leading-relaxed" style="color: var(--vault-on-bg-muted)">
59-
Pulsa <strong style="color: var(--vault-primary)">+ Añadir</strong> para guardar
60-
tu primer post de Threads de forma privada y local
63+
Pulsa <strong style="color: var(--vault-primary)">{t('empty.add')}</strong> {t('empty.subtitle')}
6164
</p>
6265

6366
<!-- Indicador decorativo -->

0 commit comments

Comments
 (0)