feat(waiter): English-first texts, part a: shell, sign-in, tables, settings, venues (platform-v2 step 4.5a)

- @xenia/i18n: new `waiter` namespace (en + el); the waiter's Greek texts become keys
  with English written fresh (Greek kept as the translation).
- App gates, side drawer / nav bars / notifications, user menu, login, table list and
  cards, settings, venues + pairing errors, install dialog, lock screen, update banners,
  QR scanner, favourites setup.
- Money and times through useFormat() (venue time, the language's number format):
  table cards, quick table view, user menu, notifications.
- waiter i18n.js: tw() for code outside components (pairing errors).
- The table-list's FavoritesSetupPage `.map(t => …)` renamed so it doesn't shadow t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 03:50:33 +02:00
co-authored by Claude Opus 5.5
parent 8e0a786bbc
commit 37155c0457
20 changed files with 1229 additions and 375 deletions
+10 -17
View File
@@ -14,6 +14,7 @@ import { deliveryMode, saveVenue } from '../config/server'
import { syncTrustedKeys, tlsBaseUrl } from './tls'
import { SUPPORTED_API_VERSIONS } from './apiVersion'
import { tw } from '../i18n'
export { SUPPORTED_API_VERSIONS }
@@ -27,16 +28,16 @@ export class PairingError extends Error {}
*/
export function parseServerInput(raw) {
const text = String(raw || '').trim()
if (!text) throw new PairingError('Συμπληρώστε τη διεύθυνση του server.')
if (!text) throw new PairingError(tw('pairing.empty'))
const withScheme = /^https?:\/\//i.test(text) ? text : `http://${text}`
let url
try {
url = new URL(withScheme)
} catch {
throw new PairingError('Μη έγκυρη διεύθυνση. Παράδειγμα: 192.168.1.50')
throw new PairingError(tw('pairing.invalid'))
}
if (!url.hostname) throw new PairingError('Μη έγκυρη διεύθυνση. Παράδειγμα: 192.168.1.50')
if (!url.hostname) throw new PairingError(tw('pairing.invalid'))
return {
baseUrl: url.origin,
@@ -53,15 +54,13 @@ export async function probeServer(baseUrl) {
try {
res = await fetch(`${baseUrl}/api/system/identity`, { signal: controller.signal })
} catch {
throw new PairingError(
'Δεν βρέθηκε server σε αυτή τη διεύθυνση. Ελέγξτε ότι το κινητό είναι στο ίδιο WiFi με το κατάστημα.'
)
throw new PairingError(tw('pairing.noServer'))
} finally {
clearTimeout(timer)
}
if (res.status === 403) {
throw new PairingError('Ο server αρνήθηκε τη σύνδεση. Το κινητό πρέπει να είναι στο WiFi του καταστήματος.')
throw new PairingError(tw('pairing.refused'))
}
let identity = null
try {
@@ -70,12 +69,10 @@ export async function probeServer(baseUrl) {
// not JSON → not a Xenia server
}
if (!res.ok || identity?.app !== 'xenia-pos') {
throw new PairingError('Η διεύθυνση δεν ανήκει σε server Xenia.')
throw new PairingError(tw('pairing.notXenia'))
}
if (!SUPPORTED_API_VERSIONS.includes(identity.api_version)) {
throw new PairingError(
`Ο server (έκδοση ${identity.version}) δεν είναι συμβατός με αυτή την εφαρμογή. Ενημερώστε την εφαρμογή ή τον server.`
)
throw new PairingError(tw('pairing.incompatible', { version: identity.version }))
}
return identity
}
@@ -94,16 +91,12 @@ export async function pairWith(raw) {
const identity = await probeServer(baseUrl)
if (expectedSiteId && identity.site_id && identity.site_id !== expectedSiteId) {
throw new PairingError(
'Σε αυτή τη διεύθυνση απαντά διαφορετικό κατάστημα από αυτό του QR. Ζητήστε νέο QR από τον διαχειριστή.'
)
throw new PairingError(tw('pairing.otherVenue'))
}
const spki = identity.tls?.spki_sha256 || null
if (expectedKey && spki !== expectedKey) {
// The QR carries the real server's key: anything else is a different machine
throw new PairingError(
'Το κλειδί ασφαλείας του server δεν ταιριάζει με το QR. Ζητήστε νέο QR από τον διαχειριστή.'
)
throw new PairingError(tw('pairing.wrongKey'))
}
const venue = {