feat(waiter): English-first texts, part b: table detail, ordering, options, payment (platform-v2 step 4.5b)
- Table detail (actions, item actions, split, price, discount, pay / revert / close, move / merge / transfer, guests, flags, assign, print), the order drawer (tabs, options, quick notes, price change, summary), add items (cart, totals, deals, search), the order summary and the summary before sending, the product picker. - Money everywhere here in the language's format (`money()` in waiter i18n.js for helpers shared by several components, useFormat() elsewhere). - The default quick notes are keys (the venue's own quick notes still win). - Variables named `t` (tables, tabs, timers) renamed so they don't shadow t(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -1,9 +1,18 @@
|
||||
// The waiter app's translations instance (plan step 4.1); its texts are keys in the `waiter`
|
||||
// namespace of @xenia/i18n (step 4.5). Components use useTranslation('waiter'); code outside
|
||||
// components (services, stores, native glue) uses tw('key').
|
||||
import { createI18n } from '@xenia/i18n'
|
||||
import { createFormatters, createI18n } from '@xenia/i18n'
|
||||
|
||||
export const i18n = createI18n({ defaultNS: 'common' })
|
||||
|
||||
/** Translate a waiter key outside a component (the current language). */
|
||||
export const tw = (key, options) => i18n.t(key, { ns: 'waiter', ...options })
|
||||
|
||||
// Money outside a component's useFormat() (helpers shared by several components): the current
|
||||
// language's format, the venue currency (€). Inside components prefer useFormat().formatMoney.
|
||||
const formatters = new Map()
|
||||
export function money(value) {
|
||||
const lng = i18n.language
|
||||
if (!formatters.has(lng)) formatters.set(lng, createFormatters({ language: lng }))
|
||||
return formatters.get(lng).formatMoney(Number(value) || 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user