Files
bonaminandClaude Opus 5.5 f8d91e7fae feat(waiter): English-first texts, part c: shift, log, chat, offline, notifications; language switch; guard (platform-v2 step 4.5c)
- Shift overview, order log, chat list / thread, offline + server search +
  rediscovery screens, notifications, the refused-lines sheet and the offline queue's
  reasons become keys; times and dates through useFormat() in the venue's clock.
- User menu: the other language(s) (data-testid menu-language-<lng>), saved to the
  person's profile (PATCH /api/auth/me) and the bootstrap reloaded (D-12).
- tests/no-greek.test.mjs: no Greek letter in waiter_pwa/src (the one Greek word the
  app recognises in staff messages is a \u escape).
- e2e: the test venue is English: waiter / browser / android use the English texts;
  waiter.mjs +3 (English by default, switch to Greek at once and saved, after reload);
  android bundle checks print what they saw when they fail.
- Pack README: the waiter texts rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 04:31:48 +02:00

32 lines
1.3 KiB
JavaScript

// Plan step 4.5: the waiter app's texts live in @xenia/i18n (namespace `waiter`, English first,
// Greek as a translation). No Greek letter may appear in the app's source: a new text is a key
// in packages/i18n/locales/{en,el}/waiter.json. (A Greek word the code must recognise, e.g. in
// a server message, is written with \u escapes.)
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { readdirSync, readFileSync, statSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src')
const GREEK = /[Ͱ-Ͽἀ-῿]/
function walk(dir, out = []) {
for (const name of readdirSync(dir)) {
const p = path.join(dir, name)
if (statSync(p).isDirectory()) walk(p, out)
else if (/\.(jsx?|mjs|css|html)$/.test(name)) out.push(p)
}
return out
}
test('no Greek text in the waiter app source (texts are i18n keys)', () => {
const hits = []
for (const file of walk(SRC)) {
readFileSync(file, 'utf8').split('\n').forEach((line, i) => {
if (GREEK.test(line)) hits.push(`${path.relative(SRC, file)}:${i + 1}: ${line.trim().slice(0, 80)}`)
})
}
assert.deepEqual(hits, [], `Greek text found — make it a key in the waiter namespace:\n${hits.join('\n')}`)
})