Move form drag translations to morfo

active-uix
dev 5 months ago
parent fbea8f5a64
commit a6654b30ff

@ -32,9 +32,11 @@ import { carouselMorfo } from '$uix/morfo/components/carousel';
import { clipboardMorfo } from '$uix/morfo/components/clipboard'; import { clipboardMorfo } from '$uix/morfo/components/clipboard';
import { comboboxMorfo } from '$uix/morfo/components/combobox'; import { comboboxMorfo } from '$uix/morfo/components/combobox';
import { commandMorfo } from '$uix/morfo/components/command'; import { commandMorfo } from '$uix/morfo/components/command';
import { dragDropMorfo } from '$uix/morfo/components/drag-drop';
import { drawerMorfo } from '$uix/morfo/components/drawer'; import { drawerMorfo } from '$uix/morfo/components/drawer';
import { feedMorfo } from '$uix/morfo/components/feed'; import { feedMorfo } from '$uix/morfo/components/feed';
import { fileUploadMorfo } from '$uix/morfo/components/file-upload'; import { fileUploadMorfo } from '$uix/morfo/components/file-upload';
import { formMorfo } from '$uix/morfo/components/form';
import { gridListMorfo } from '$uix/morfo/components/grid-list'; import { gridListMorfo } from '$uix/morfo/components/grid-list';
import { listboxMorfo } from '$uix/morfo/components/listbox'; import { listboxMorfo } from '$uix/morfo/components/listbox';
import { meterMorfo } from '$uix/morfo/components/meter'; import { meterMorfo } from '$uix/morfo/components/meter';
@ -271,6 +273,16 @@ describe('createActiveUix (standalone)', () => {
expect(uix.langs.t('components.carousel.indicator', { index: 2 })).toBe( expect(uix.langs.t('components.carousel.indicator', { index: 2 })).toBe(
'Ir a la diapositiva 2' 'Ir a la diapositiva 2'
); );
registerMorfo(dragDropMorfo);
registerMorfo(formMorfo);
expect(uix.langs.t('components.drag-drop.drag-over', { target: 'Lista' })).toBe(
'Sobre zona de destino Lista'
);
expect(uix.langs.t('components.drag-drop.droppable')).toBe('zona de destino');
expect(uix.langs.t('components.form.error-summary-single')).toBe(
'1 error del formulario necesita tu atención'
);
expect(uix.langs.t('common.buttons.submit')).toBe('Enviar');
} finally { } finally {
uix.dispose(); uix.dispose();
_resetMorfoRegistryForTesting(); _resetMorfoRegistryForTesting();

@ -181,43 +181,4 @@ export const componentLangs = {
'format-select': { es: 'Formato de color', en: 'Color format' }, 'format-select': { es: 'Formato de color', en: 'Color format' },
}, },
'drag-drop': {
'drag-started': {
es: 'Arrastrando {{item}}',
en: 'Started dragging {{item}}',
},
'drag-over': {
es: 'Sobre zona de destino {{target}}',
en: 'Over drop zone {{target}}',
},
dropped: {
es: 'Soltado {{item}} sobre {{target}}',
en: 'Dropped {{item}} on {{target}}',
},
cancelled: { es: 'Arrastre cancelado', en: 'Drag cancelled' },
'no-targets': {
es: 'Sin zonas de destino disponibles',
en: 'No drop targets available',
},
'draggable-role': { es: 'arrastrable', en: 'draggable' },
'droppable-role': { es: 'zona de destino', en: 'drop zone' },
'droppable-active': {
es: 'zona de destino activa',
en: 'active drop zone',
},
},
form: {
submit: { es: 'Enviar', en: 'Submit' },
reset: { es: 'Restablecer', en: 'Reset' },
'error-summary-title': {
es: '{{count}} errores del formulario necesitan tu atención',
en: '{{count}} form errors need your attention'
},
'error-summary-single': {
es: '1 error del formulario necesita tu atención',
en: '1 form error needs your attention'
},
},
} satisfies LangNode; } satisfies LangNode;

@ -5,6 +5,33 @@ export const dragDropMorfo = {
name: 'DragDrop', name: 'DragDrop',
kebab: 'drag-drop', kebab: 'drag-drop',
scope: ['soma'], scope: ['soma'],
translations: {
'drag-started': {
es: 'Arrastrando {{item}}',
en: 'Started dragging {{item}}'
},
'drag-over': {
es: 'Sobre zona de destino {{target}}',
en: 'Over drop zone {{target}}'
},
dropped: {
es: 'Soltado {{item}} sobre {{target}}',
en: 'Dropped {{item}} on {{target}}'
},
cancelled: { es: 'Arrastre cancelado', en: 'Drag cancelled' },
'no-targets': {
es: 'Sin zonas de destino disponibles',
en: 'No drop targets available'
},
draggable: { es: 'arrastrable', en: 'Draggable' },
droppable: { es: 'zona de destino', en: 'Drop zone' },
'draggable-role': { es: 'arrastrable', en: 'draggable' },
'droppable-role': { es: 'zona de destino', en: 'drop zone' },
'droppable-active': {
es: 'zona de destino activa',
en: 'active drop zone'
}
},
parts: [ parts: [
{ {
name: 'Provider', name: 'Provider',

@ -5,6 +5,16 @@ export const formMorfo = {
name: 'Form', name: 'Form',
kebab: 'form', kebab: 'form',
scope: ['soma'], scope: ['soma'],
translations: {
'error-summary-title': {
es: '{{count}} errores del formulario necesitan tu atención',
en: '{{count}} form errors need your attention'
},
'error-summary-single': {
es: '1 error del formulario necesita tu atención',
en: '1 form error needs your attention'
}
},
parts: [ parts: [
{ {
name: 'Provider', name: 'Provider',

@ -84,7 +84,7 @@ Snippet props: `{ over, accepting }`.
| Droppable | `aria-dropeffect` | `'move'` while accepting, `'none'` otherwise | | Droppable | `aria-dropeffect` | `'move'` while accepting, `'none'` otherwise |
| Droppable | `tabindex` | `0` during drag if accepting; `-1` otherwise | | Droppable | `tabindex` | `0` during drag if accepting; `-1` otherwise |
Each drag step is announced via the `Announce` global API. Component-owned announcement strings should live in the drag-drop morfo `langs` catalog; legacy imperative constants may still appear in [langs.ts](./langs.ts) during migration. Disable with `announceEnabled={false}` on the Provider when wiring your own. Each drag step is announced via the `Announce` global API. Component-owned announcement strings live in the drag-drop `morfo.translations` catalog. Disable with `announceEnabled={false}` on the Provider when wiring your own.
## Data Attributes ## Data Attributes

@ -1,7 +1,7 @@
/** Idlangref constants for Form. */ /** Idlangref constants for Form. */
export const FORM_LANGS = { export const FORM_LANGS = {
SUBMIT: '#?components.form.submit|Submit', SUBMIT: '#?common.buttons.submit|Submit',
RESET: '#?components.form.reset|Reset', RESET: '#?common.buttons.reset|Reset',
ERROR_SUMMARY_TITLE: ERROR_SUMMARY_TITLE:
'#?components.form.error-summary-title|{{count}} form errors need your attention', '#?components.form.error-summary-title|{{count}} form errors need your attention',
ERROR_SUMMARY_SINGLE: '#?components.form.error-summary-single|1 form error needs your attention' ERROR_SUMMARY_SINGLE: '#?components.form.error-summary-single|1 form error needs your attention'

Loading…
Cancel
Save

Powered by TurnKey Linux.