- Alembic 0042: a `translations` column on every choice (groups, quick options, extras, ingredients, preference sets and choices; sub-choices and shared sub-sets in their JSON); the texts typed so far become the text in their language (Greek letters → el, else the venue's); the product's old quick map moves onto the quick options. API, catalogue bundle and the cloud's quick option names carry them; names are checked before anything is replaced. - Editor: a language picker beside the close button (Default = the venue's language, plus every menu language) drives every name and description, left and right; an empty language shows what is used instead as its placeholder. The shown name is the venue language's, else any (never mixed). - Choices: one name field; the shared controls at one height (heart red when on, several / compact… chips coloured when on, delete red on hover); "+ Preference" at the right end of the tab strip; preference groups made inside a preference. - Categories: the shared dropdown to add one; the category dialog per language. - The service item switch is gone: "New service item" opens its own small dialog. - UI: Dialog headerEnd; a toned toggle keeps its colour while pressed. - Tests: backend (choice names, migration 0042), access, editor logic, e2e. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
// Menu texts per language (owner 2026-11-21): "Default" is the venue's language; what is shown is
|
|
// the venue language's text, else the first language that has one, else the stored text.
|
|
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { DEFAULT_LANGUAGE, shownText, slotOf } from '../src/menuLanguages.js'
|
|
|
|
test('"Default" edits the venue language', () => {
|
|
assert.equal(slotOf(DEFAULT_LANGUAGE, 'el'), 'el')
|
|
assert.equal(slotOf(DEFAULT_LANGUAGE, 'en'), 'en')
|
|
assert.equal(slotOf('en', 'el'), 'en')
|
|
assert.equal(slotOf(DEFAULT_LANGUAGE, 'xx'), 'el') // an unknown venue language: the first menu language
|
|
})
|
|
|
|
test('shown: the venue language, else any, never mixed', () => {
|
|
assert.equal(shownText({ el: 'Πίτα', en: 'Pie' }, 'el'), 'Πίτα')
|
|
assert.equal(shownText({ el: 'Πίτα', en: 'Pie' }, 'en'), 'Pie')
|
|
assert.equal(shownText({ el: 'Πίτα' }, 'en'), 'Πίτα') // the venue went English: the only text there is
|
|
assert.equal(shownText({ el: ' ' }, 'en', 'Old'), 'Old') // nothing in any language: what was stored
|
|
assert.equal(shownText({}, 'en'), '')
|
|
})
|