From 8d685ad2efbdc106b66bd1a78f4f1b85dd75b25e Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 15 May 2026 10:12:00 +0200 Subject: [PATCH] Move compact input translations to morfo --- src/uix/active-uix/active-uix.svelte.test.ts | 11 +++++++- src/uix/langs.ts | 26 ------------------- src/uix/morfo/components/grid-list.ts | 6 ++++- src/uix/morfo/components/pin-input.ts | 3 +++ src/uix/morfo/components/rating-group.ts | 3 +++ src/uix/soma/components/grid-list/langs.ts | 3 +-- src/uix/soma/components/number-field/langs.ts | 3 +-- src/uix/soma/components/pin-input/langs.ts | 3 +-- src/uix/soma/components/rating-group/langs.ts | 3 +-- 9 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/uix/active-uix/active-uix.svelte.test.ts b/src/uix/active-uix/active-uix.svelte.test.ts index ad2198513..7e0d98855 100644 --- a/src/uix/active-uix/active-uix.svelte.test.ts +++ b/src/uix/active-uix/active-uix.svelte.test.ts @@ -30,10 +30,13 @@ import { comboboxMorfo } from '$uix/morfo/components/combobox'; import { commandMorfo } from '$uix/morfo/components/command'; import { drawerMorfo } from '$uix/morfo/components/drawer'; import { feedMorfo } from '$uix/morfo/components/feed'; +import { gridListMorfo } from '$uix/morfo/components/grid-list'; import { listboxMorfo } from '$uix/morfo/components/listbox'; import { meterMorfo } from '$uix/morfo/components/meter'; import { navigationMenuMorfo } from '$uix/morfo/components/navigation-menu'; +import { pinInputMorfo } from '$uix/morfo/components/pin-input'; import { progressMorfo } from '$uix/morfo/components/progress'; +import { ratingGroupMorfo } from '$uix/morfo/components/rating-group'; import { scrollAreaMorfo } from '$uix/morfo/components/scroll-area'; import { searchFieldMorfo } from '$uix/morfo/components/search-field'; import { splitterMorfo } from '$uix/morfo/components/splitter'; @@ -133,7 +136,6 @@ describe('createActiveUix (standalone)', () => { expect(out.length).toBeGreaterThan(0); expect(uix.langs.t('components.calendar.prev-month')).toBe('Mes anterior'); expect(uix.langs.t('components.range-calendar.range-start')).toBe('inicio del rango'); - expect(uix.langs.t('components.rating-group.value-text', { value: 3, max: 5 })).toBe('3 de 5'); } finally { uix.dispose(); } @@ -227,6 +229,13 @@ describe('createActiveUix (standalone)', () => { expect(uix.langs.t('components.scroll-area.scrollbar-horizontal')).toBe( 'Barra de desplazamiento horizontal' ); + registerMorfo(gridListMorfo); + registerMorfo(pinInputMorfo); + registerMorfo(ratingGroupMorfo); + expect(uix.langs.t('components.grid-list.label')).toBe('Lista en cuadrícula'); + expect(uix.langs.t('components.grid-list.select-row')).toBe('Seleccionar fila'); + expect(uix.langs.t('components.pin-input.input')).toBe('Código de verificación'); + expect(uix.langs.t('components.rating-group.label')).toBe('Valoración'); } finally { uix.dispose(); _resetMorfoRegistryForTesting(); diff --git a/src/uix/langs.ts b/src/uix/langs.ts index f2da7cf58..83beb312e 100644 --- a/src/uix/langs.ts +++ b/src/uix/langs.ts @@ -68,12 +68,6 @@ export const componentLangs = { copied: { es: 'Copiado', en: 'Copied' }, }, - 'grid-list': { - label: { es: 'Lista en cuadrícula', en: 'Grid list' }, - 'select-row': { es: 'Seleccionar fila', en: 'Select row' }, - 'select-all': { es: 'Seleccionar todo', en: 'Select all' }, - }, - carousel: { label: { es: 'Carrusel', en: 'Carousel' }, prev: { es: 'Diapositiva anterior', en: 'Previous slide' }, @@ -263,22 +257,6 @@ export const componentLangs = { page: { es: 'Página {{value}}', en: 'Page {{value}}' }, }, - 'pin-input': { - input: { es: 'Código de verificación', en: 'Verification code' }, - cell: { - es: 'Carácter {{index}} de {{length}}', - en: 'Character {{index}} of {{length}}' - }, - }, - - 'rating-group': { - label: { es: 'Valoración', en: 'Rating' }, - 'value-text': { - es: '{{value}} de {{max}}', - en: '{{value}} out of {{max}}' - }, - }, - table: { label: { es: 'Tabla de datos', en: 'Data table' }, 'sort-asc': { es: 'Ordenado ascendente', en: 'Sorted ascending' }, @@ -292,10 +270,6 @@ export const componentLangs = { 'row-detail-collapse': { es: 'Ocultar detalles', en: 'Hide details' }, }, - 'number-field': { - role: { es: 'Campo numérico', en: 'Number field' }, - }, - 'tag-group': { label: { es: 'Etiquetas', en: 'Tags' }, remove: { es: 'Eliminar {{tag}}', en: 'Remove {{tag}}' }, diff --git a/src/uix/morfo/components/grid-list.ts b/src/uix/morfo/components/grid-list.ts index 2bd4e7a1c..648b78034 100644 --- a/src/uix/morfo/components/grid-list.ts +++ b/src/uix/morfo/components/grid-list.ts @@ -6,6 +6,10 @@ export const gridListMorfo = { kebab: 'grid-list', scope: ['soma'], apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/grid/', + translations: { + label: { es: 'Lista en cuadrícula', en: 'Grid list' }, + 'select-row': { es: 'Seleccionar fila', en: 'Select row' } + }, parts: [ { name: 'Provider', @@ -26,7 +30,7 @@ export const gridListMorfo = { aria: [ { attr: 'aria-label', - value: v.translationRef('#?components.grid-list.label|List'), + value: v.translationRef('#?components.grid-list.label|Grid list'), severity: 'recommended' }, { diff --git a/src/uix/morfo/components/pin-input.ts b/src/uix/morfo/components/pin-input.ts index 14e0e4c4d..b2a743a70 100644 --- a/src/uix/morfo/components/pin-input.ts +++ b/src/uix/morfo/components/pin-input.ts @@ -5,6 +5,9 @@ export const pinInputMorfo = { name: 'PinInput', kebab: 'pin-input', scope: ['soma'], + translations: { + input: { es: 'Código de verificación', en: 'Verification code' } + }, parts: [ { name: 'Provider', diff --git a/src/uix/morfo/components/rating-group.ts b/src/uix/morfo/components/rating-group.ts index d2be934bc..12af0ebe3 100644 --- a/src/uix/morfo/components/rating-group.ts +++ b/src/uix/morfo/components/rating-group.ts @@ -5,6 +5,9 @@ export const ratingGroupMorfo = { name: 'RatingGroup', kebab: 'rating-group', scope: ['soma'], + translations: { + label: { es: 'Valoración', en: 'Rating' } + }, parts: [ { name: 'Provider', diff --git a/src/uix/soma/components/grid-list/langs.ts b/src/uix/soma/components/grid-list/langs.ts index 4b484459f..d8c67a816 100644 --- a/src/uix/soma/components/grid-list/langs.ts +++ b/src/uix/soma/components/grid-list/langs.ts @@ -1,5 +1,4 @@ export const GRID_LIST_LANGS = { LABEL: '#?components.grid-list.label|Grid list', - SELECT_ROW: '#?components.grid-list.select-row|Select row', - SELECT_ALL: '#?components.grid-list.select-all|Select all' + SELECT_ROW: '#?components.grid-list.select-row|Select row' } as const; diff --git a/src/uix/soma/components/number-field/langs.ts b/src/uix/soma/components/number-field/langs.ts index 438785427..ab04e544f 100644 --- a/src/uix/soma/components/number-field/langs.ts +++ b/src/uix/soma/components/number-field/langs.ts @@ -1,6 +1,5 @@ /** Idlangref constants for the NumberField component. */ export const NUMBER_FIELD_LANGS = { INCREMENT: '#?common.buttons.increment|Increment', - DECREMENT: '#?common.buttons.decrement|Decrement', - ROLE: '#?components.number-field.role|Number field', + DECREMENT: '#?common.buttons.decrement|Decrement' } as const; diff --git a/src/uix/soma/components/pin-input/langs.ts b/src/uix/soma/components/pin-input/langs.ts index 3e05dd97f..2f17aaa54 100644 --- a/src/uix/soma/components/pin-input/langs.ts +++ b/src/uix/soma/components/pin-input/langs.ts @@ -1,5 +1,4 @@ /** Idlangref constants for the PinInput component. */ export const PIN_INPUT_LANGS = { - INPUT: '#?components.pin-input.input|Verification code', - CELL: '#?components.pin-input.cell|Character {{index}} of {{length}}', + INPUT: '#?components.pin-input.input|Verification code' } as const; diff --git a/src/uix/soma/components/rating-group/langs.ts b/src/uix/soma/components/rating-group/langs.ts index 27c7d4727..ba3088a9d 100644 --- a/src/uix/soma/components/rating-group/langs.ts +++ b/src/uix/soma/components/rating-group/langs.ts @@ -1,5 +1,4 @@ /** Idlangref constants for the RatingGroup component. */ export const RATING_GROUP_LANGS = { - LABEL: '#?components.rating-group.label|Rating', - VALUE_TEXT: '#?components.rating-group.value-text|{{value}} out of {{max}}', + LABEL: '#?components.rating-group.label|Rating' } as const;