Repository navigation
feat: add Punjabi (pa) locale support - #1489
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoAdd Punjabi locale support across FloCafe
AI Description
Diagram
High-Level Assessment
Files changed (35)
|
Code Review by Qodo
1. Cashiers see a garbled table prompt
|
…/flocafe-i18n-punjabi`): 1. **Core Test Suite (Shard 3/4) (`npm run test:cash-closures` -> `tests/reports-whatsapp.test.ts`):** - **Invariant:** Every locale-inventory assertion must match the canonical set of 25 supported locale bundles after adding Punjabi (`pa.json`). - **Root Cause & Fix:** `tests/reports-whatsapp.test.ts` still asserted `localeFiles.length === 24` at line 287 (and noted 24 languages in line 853). Updated `tests/reports-whatsapp.test.ts` to `25`. 2. **Playwright E2E (Shard 3/4) (`frontend/e2e/server-app-ordering.spec.ts`):** - **Invariant:** In the shared E2E server (`tests/e2e-server.cjs`), where all specs in a shard execute against one backend instance from a single loopback IP (`127.0.0.1`), per-IP read rate limits must not throttle legitimate test page loads and order reads across consecutive specs. - **Root Cause & Fix:** In Shard 3/4, `selected-guest-checkout.spec.ts` (21 tests) and `server-app-ordering.spec.ts` (9 tests) exhausted the 120 req/min `orderReadRateLimit` in `main/routes/orders.ts`, causing `GET /api/orders` at line 608 of `server-app-ordering.spec.ts` to return HTTP 429 (`"Too many requests, please try again later."`) and causing the retry to time out while the 60s window remained active. Made `orderReadRateLimit` in `main/routes/orders.ts` configurable via `FLO_ORDER_READ_RATE_LIMIT_MAX` (defaulting to `120` in production, matching `FLO_SETTINGS_READ_RATE_LIMIT_MAX` in `main/routes/settings.ts`), set `FLO_ORDER_READ_RATE_LIMIT_MAX = '100000'` in `tests/e2e-server.cjs`, and moved `openServerApp(page, serverToken)` before the 5-viewport resize loop in `frontend/e2e/server-app-ordering.spec.ts` to avoid 4 redundant full-app reloads. 3. **Aggregator Checks (`End-to-End Playwright Tests`, `Required Checks Gate`):** - Failed solely as downstream aggregators of the two shard failures above. 4. **Verification:** - `npm run test:cash-closures` (passed: `tests/cash-closures.test.ts` 370/370 and `tests/reports-whatsapp.test.ts` including all 25 locales) - `node tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.ts` (passed) - `npm run i18n:check` (passed) - `npm run lint` and `npm run build` (passed) - `npx oxfmt --check` on all touched files and `git diff --check` (passed)
…/flocafe-i18n-punjabi`): 1. **Core Test Suite (Shard 3/4) (`npm run test:cash-closures` -> `tests/reports-whatsapp.test.ts`):** - **Invariant:** Every locale-inventory assertion must match the canonical set of 25 supported locale bundles after adding Punjabi (`pa.json`). - **Root Cause & Fix:** `tests/reports-whatsapp.test.ts` still asserted `localeFiles.length === 24` at line 287 (and noted 24 languages in line 853). Updated `tests/reports-whatsapp.test.ts` to `25`. 2. **Playwright E2E (Shard 3/4) (`frontend/e2e/server-app-ordering.spec.ts`):** - **Invariant:** In the shared E2E server (`tests/e2e-server.cjs`), where all specs in a shard execute against one backend instance from a single loopback IP (`127.0.0.1`), per-IP read rate limits must not throttle legitimate test page loads and order reads across consecutive specs. - **Root Cause & Fix:** In Shard 3/4, `selected-guest-checkout.spec.ts` (21 tests) and `server-app-ordering.spec.ts` (9 tests) exhausted the 120 req/min `orderReadRateLimit` in `main/routes/orders.ts`, causing `GET /api/orders` at line 608 of `server-app-ordering.spec.ts` to return HTTP 429 (`"Too many requests, please try again later."`) and causing the retry to time out while the 60s window remained active. Made `orderReadRateLimit` in `main/routes/orders.ts` configurable via `FLO_ORDER_READ_RATE_LIMIT_MAX` (defaulting to `120` in production, matching `FLO_SETTINGS_READ_RATE_LIMIT_MAX` in `main/routes/settings.ts`), set `FLO_ORDER_READ_RATE_LIMIT_MAX = '100000'` in `tests/e2e-server.cjs`, and moved `openServerApp(page, serverToken)` before the 5-viewport resize loop in `frontend/e2e/server-app-ordering.spec.ts` to avoid 4 redundant full-app reloads. 3. **Aggregator Checks (`End-to-End Playwright Tests`, `Required Checks Gate`):** - Failed solely as downstream aggregators of the two shard failures above. 4. **Verification:** - `npm run test:cash-closures` (passed: `tests/cash-closures.test.ts` 370/370 and `tests/reports-whatsapp.test.ts` including all 25 locales) - `node tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.ts` (passed) - `npm run i18n:check` (passed) - `npm run lint` and `npm run build` (passed) - `npx oxfmt --check` on all touched files and `git diff --check` (passed)
73f88f5 to
d2a845f
Compare
…/flocafe-i18n-punjabi`): 1. **Core Test Suite (Shard 3/4) (`npm run test:cash-closures` -> `tests/reports-whatsapp.test.ts`):** - **Invariant:** Every locale-inventory assertion must match the canonical set of 25 supported locale bundles after adding Punjabi (`pa.json`). - **Root Cause & Fix:** `tests/reports-whatsapp.test.ts` still asserted `localeFiles.length === 24` at line 287 (and noted 24 languages in line 853). Updated `tests/reports-whatsapp.test.ts` to `25`. 2. **Playwright E2E (Shard 3/4) (`frontend/e2e/server-app-ordering.spec.ts`):** - **Invariant:** In the shared E2E server (`tests/e2e-server.cjs`), where all specs in a shard execute against one backend instance from a single loopback IP (`127.0.0.1`), per-IP read rate limits must not throttle legitimate test page loads and order reads across consecutive specs. - **Root Cause & Fix:** In Shard 3/4, `selected-guest-checkout.spec.ts` (21 tests) and `server-app-ordering.spec.ts` (9 tests) exhausted the 120 req/min `orderReadRateLimit` in `main/routes/orders.ts`, causing `GET /api/orders` at line 608 of `server-app-ordering.spec.ts` to return HTTP 429 (`"Too many requests, please try again later."`) and causing the retry to time out while the 60s window remained active. Made `orderReadRateLimit` in `main/routes/orders.ts` configurable via `FLO_ORDER_READ_RATE_LIMIT_MAX` (defaulting to `120` in production, matching `FLO_SETTINGS_READ_RATE_LIMIT_MAX` in `main/routes/settings.ts`), set `FLO_ORDER_READ_RATE_LIMIT_MAX = '100000'` in `tests/e2e-server.cjs`, and moved `openServerApp(page, serverToken)` before the 5-viewport resize loop in `frontend/e2e/server-app-ordering.spec.ts` to avoid 4 redundant full-app reloads. 3. **Aggregator Checks (`End-to-End Playwright Tests`, `Required Checks Gate`):** - Failed solely as downstream aggregators of the two shard failures above. 4. **Verification:** - `npm run test:cash-closures` (passed: `tests/cash-closures.test.ts` 370/370 and `tests/reports-whatsapp.test.ts` including all 25 locales) - `node tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.ts` (passed) - `npm run i18n:check` (passed) - `npm run lint` and `npm run build` (passed) - `npx oxfmt --check` on all touched files and `git diff --check` (passed)
d2a845f to
630214f
Compare
…/flocafe-i18n-punjabi`): 1. **Core Test Suite (Shard 3/4) (`npm run test:cash-closures` -> `tests/reports-whatsapp.test.ts`):** - **Invariant:** Every locale-inventory assertion must match the canonical set of 25 supported locale bundles after adding Punjabi (`pa.json`). - **Root Cause & Fix:** `tests/reports-whatsapp.test.ts` still asserted `localeFiles.length === 24` at line 287 (and noted 24 languages in line 853). Updated `tests/reports-whatsapp.test.ts` to `25`. 2. **Playwright E2E (Shard 3/4) (`frontend/e2e/server-app-ordering.spec.ts`):** - **Invariant:** In the shared E2E server (`tests/e2e-server.cjs`), where all specs in a shard execute against one backend instance from a single loopback IP (`127.0.0.1`), per-IP read rate limits must not throttle legitimate test page loads and order reads across consecutive specs. - **Root Cause & Fix:** In Shard 3/4, `selected-guest-checkout.spec.ts` (21 tests) and `server-app-ordering.spec.ts` (9 tests) exhausted the 120 req/min `orderReadRateLimit` in `main/routes/orders.ts`, causing `GET /api/orders` at line 608 of `server-app-ordering.spec.ts` to return HTTP 429 (`"Too many requests, please try again later."`) and causing the retry to time out while the 60s window remained active. Made `orderReadRateLimit` in `main/routes/orders.ts` configurable via `FLO_ORDER_READ_RATE_LIMIT_MAX` (defaulting to `120` in production, matching `FLO_SETTINGS_READ_RATE_LIMIT_MAX` in `main/routes/settings.ts`), set `FLO_ORDER_READ_RATE_LIMIT_MAX = '100000'` in `tests/e2e-server.cjs`, and moved `openServerApp(page, serverToken)` before the 5-viewport resize loop in `frontend/e2e/server-app-ordering.spec.ts` to avoid 4 redundant full-app reloads. 3. **Aggregator Checks (`End-to-End Playwright Tests`, `Required Checks Gate`):** - Failed solely as downstream aggregators of the two shard failures above. 4. **Verification:** - `npm run test:cash-closures` (passed: `tests/cash-closures.test.ts` 370/370 and `tests/reports-whatsapp.test.ts` including all 25 locales) - `node tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.ts` (passed) - `npm run i18n:check` (passed) - `npm run lint` and `npm run build` (passed) - `npx oxfmt --check` on all touched files and `git diff --check` (passed)
630214f to
9f3f03e
Compare
Add complete Gurmukhi Punjabi (pa / pa-IN) translations across all 35 namespaces (3,477 keys), register pa in the language registry, add startup/shutdown status messages, localize express and demo setup seed data, add Gurmukhi print/report font fallbacks and virama grapheme cluster handling, regenerate main-process print labels, and extend the i18n and print test suites and documentation. Fixes #1476
…/flocafe-i18n-punjabi`): 1. **Core Test Suite (Shard 3/4) (`npm run test:cash-closures` -> `tests/reports-whatsapp.test.ts`):** - **Invariant:** Every locale-inventory assertion must match the canonical set of 25 supported locale bundles after adding Punjabi (`pa.json`). - **Root Cause & Fix:** `tests/reports-whatsapp.test.ts` still asserted `localeFiles.length === 24` at line 287 (and noted 24 languages in line 853). Updated `tests/reports-whatsapp.test.ts` to `25`. 2. **Playwright E2E (Shard 3/4) (`frontend/e2e/server-app-ordering.spec.ts`):** - **Invariant:** In the shared E2E server (`tests/e2e-server.cjs`), where all specs in a shard execute against one backend instance from a single loopback IP (`127.0.0.1`), per-IP read rate limits must not throttle legitimate test page loads and order reads across consecutive specs. - **Root Cause & Fix:** In Shard 3/4, `selected-guest-checkout.spec.ts` (21 tests) and `server-app-ordering.spec.ts` (9 tests) exhausted the 120 req/min `orderReadRateLimit` in `main/routes/orders.ts`, causing `GET /api/orders` at line 608 of `server-app-ordering.spec.ts` to return HTTP 429 (`"Too many requests, please try again later."`) and causing the retry to time out while the 60s window remained active. Made `orderReadRateLimit` in `main/routes/orders.ts` configurable via `FLO_ORDER_READ_RATE_LIMIT_MAX` (defaulting to `120` in production, matching `FLO_SETTINGS_READ_RATE_LIMIT_MAX` in `main/routes/settings.ts`), set `FLO_ORDER_READ_RATE_LIMIT_MAX = '100000'` in `tests/e2e-server.cjs`, and moved `openServerApp(page, serverToken)` before the 5-viewport resize loop in `frontend/e2e/server-app-ordering.spec.ts` to avoid 4 redundant full-app reloads. 3. **Aggregator Checks (`End-to-End Playwright Tests`, `Required Checks Gate`):** - Failed solely as downstream aggregators of the two shard failures above. 4. **Verification:** - `npm run test:cash-closures` (passed: `tests/cash-closures.test.ts` 370/370 and `tests/reports-whatsapp.test.ts` including all 25 locales) - `node tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.ts` (passed) - `npm run i18n:check` (passed) - `npm run lint` and `npm run build` (passed) - `npx oxfmt --check` on all touched files and `git diff --check` (passed)
9f3f03e to
0a40b0c
Compare
Intent
Implement full Punjabi (
pa,pa-IN,ਪੰਜਾਬੀ) language support across the entire FloCafe application, including the main POS app, KDS, Server App, Customer Display, Setup, Settings, thermal print/KOT labels, WhatsApp plain-text reports, and sample seed data.Fixes #1476
What Changed
pa,pa-IN,ਪੰਜਾਬੀ) localization across the POS, KDS, Server App, Customer Display, Setup, and Settings viafrontend/src/lib/i18n/languages.ts,frontend/src/lib/i18n/messages/pa.json, generated thermal print/KOT labels (main/print/print-labels.generated.ts), startup/shutdown status messages (main/status-messages.ts), and localized sample/express seed data (main/setup/seed-data.ts).Noto Sans Gurmukhi,Raavi,Kohinoor Gurmukhi,Gurmukhi Sangam MN), and updatedshared/print/width.tsandshared/print/raster-canvas.tsto keep Indic virama conjunct clusters (including GurmukhiU+0A4D) together during grapheme segmentation and line wrapping.FLO_ORDER_READ_RATE_LIMIT_MAXsupport inmain/routes/orders.ts(wired intests/e2e-server.cjs) and updated unit, print, RTL/locale, WhatsApp report, and E2E test suites and documentation for the 25 supported languages.Risk Assessment
✅ Low: The Punjabi (pa / pa-IN) locale addition, Gurmukhi font fallbacks, Indic virama conjunct segmentation in both width.ts and raster-canvas.ts, seed data, and E2E rate-limit configuration are well-bounded and consistent with existing locale implementations.
Testing
Built the backend and static frontend and ran targeted verification across translation integrity (
npm run i18n:check,npm run docs:check), thermal/browser printing (test:print-labels,test:print-kernel,test:browser-receipts,test:raster,test:receipt-column-width,test:receipt-column-oracle), locale decoupling and RTL/LTR layout guards (test:decoupled-ui-locale,test:i18n-audit-remediations,test:rtl-*), database demo seeding (test:phase7-setup-i18n), WhatsApp reports and exports (test:cash-closures,test:daily-sales-export,test:daily-invoices-export), Electron status messages (test:status-messages), and live Chromium Playwright E2E specs (phase7-setup-print-i18n.spec.tsandserver-app-ordering.spec.ts), confirming all 12 visual and JSON evidence artifacts in the evidence directory.pa-IN, LTR) with localized navigation, cart controls, and order actionspa-IN) UI labels and order status headerspa-IN) Gurmukhi labels and font fallbackspa)Evidence: Seeded Punjabi Demo Catalog JSON (`main/setup/seed-data.ts`)
Evidence: WhatsApp Z-Report, Gurmukhi Width/Raster Conjuncts, and Status Messages JSON
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
shared/print/raster-canvas.ts:71-paintRasterRequest's self-containedgraphemeshelper (shared/print/raster-canvas.ts:70-72) returnsArray.from(segmenter.segment(value), (part) => part.segment)directly without merging Indic virama (U+094D,U+09CD,U+0A4D) + Indic consonant pairs. In Node 22 / Chromium (Unicode 15.1),Intl.Segmenterdoes not treat Gurmukhi viramaU+0A4D(੍) as anInCB=Linker, so it splits Gurmukhi virama conjuncts into separate segments (for example'ਪ੍ਰਾਪਤ'->['ਪ੍', 'ਰਾ', 'ਪ', 'ਤ']and'ਹਰਪ੍ਰੀਤ'->['ਹ', 'ਰ', 'ਪ੍', 'ਰੀ', 'ਤ']). Commit22386bf5added a post-pass inshared/print/width.ts:126-148(graphemeSegments) to merge adjacent segments when the previous segment ends with an Indic virama and the next starts with an Indic consonant, but left the siblinggraphemeshelper inshared/print/raster-canvas.ts:70-72unpatched (used bywrapatshared/print/raster-canvas.ts:73-87and called at lines 168, 208, and 221). Whenwrapwraps a Gurmukhi thermal raster line containing a virama conjunct (such asਹਰਪ੍ਰੀਤ ਸਿੰਘ,ਪ੍ਰਾਪਤ ਨਕਦ, orਮੁੜ-ਪ੍ਰਿੰਟ) and the pixel width boundary lands after'ਪ੍',wrapsplits the conjunct across two lines ('…ਪ੍'on line 1 with a visible halant and'ਰੀ…'on line 2), violating the conjunct-grapheme invariant indocs/reference/translation-terminology.md:30-32. Apply the same self-contained Indic virama + consonant merge insidegraphemesinshared/print/raster-canvas.ts:70-72.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ No issues found.
✅ No issues found.
🔧 **Test** - 1 issue found → no changes applied (2) ✅
🔧 No changes applied.
1 warning still open:
🔧 No changes applied.
✅ Re-checked - no issues remain.
pa/ਪੰਜਾਬੀ) in the Setup Wizard and initializes a demo store (POST /api/auth/setup/initialize), seeding Gurmukhi categories, menu items, and E.164 customer recordspa-IN, LTR) with Gurmukhi navigation, cart controls, and print-test labels:3002), standalone Server App (:3003), and Customer Display (/customer-display) in Punjabi without mobile viewport overflowlang="pa-IN" dir="ltr") with Gurmukhi font stack and intact Gurmukhi virama conjunct clusters (ਪ੍ਰ,ਹਰਪ੍ਰੀਤ…ਕ੍!,ਕ੍ ਖ)…npm run i18n:checknpx ts-node --transpile-only -P tests/tsconfig.json tests/translations.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/print-labels.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/print-kernel.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/browser-receipts.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/phase3-print-regressions.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/phase7-setup-i18n.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/decoupled-ui-locale.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/i18n-audit-remediations.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/reports-whatsapp.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/rtl-dashboard-pos-common.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/rtl-kds-server-whatsapp.test.tsnpx ts-node --transpile-only -P tests/tsconfig.json tests/rtl-setup-auth-settings.test.tscd frontend && npx playwright test e2e/phase7-setup-print-i18n.spec.ts -g "print-test visible labels use the selected UI locale"cd frontend && npx playwright test e2e/server-app-ordering.spec.ts -g "sends the order note|fits mobile viewports without horizontal overflow"✅ No issues found.
npm run i18n:checknode tests/run-electron-node-test.cjs tests/phase7-setup-i18n.test.tsnode tests/run-electron-node-test.cjs tests/reports-whatsapp.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/print-kernel.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/print-labels.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/browser-receipts.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/phase3-print-regressions.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/decoupled-ui-locale.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/i18n-audit-remediations.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/rtl-setup-auth-settings.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/rtl-dashboard-pos-common.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/rtl-kds-server-whatsapp.test.ts./node_modules/.bin/ts-node --transpile-only -P tests/tsconfig.json tests/status-messages.test.ts./node_modules/.bin/electron --no-sandbox tests/raster-renderer-electron.test.cjsnode tests/run-electron-node-test.cjs tests/daily-sales-export.test.tsnode tests/run-electron-node-test.cjs tests/daily-invoices-export.test.tsnode tests/run-electron-node-test.cjs tests/order-write-rate-limits.test.tscd frontend && npx playwright test e2e/phase7-setup-print-i18n.spec.ts --config=playwright.config.ts --project=chromium✅ No issues found.
pa-IN, LTR) with localized navigation, cart controls, and order actionspa-IN) UI labels and order status headerspa-IN) Gurmukhi labels and font fallbackspa)npm run i18n:checknpm run docs:checknpm run test:translationsnpm run test:print-labelsnpm run test:print-kernelnpm run test:browser-receiptsnpm run test:decoupled-ui-localenpm run test:i18n-audit-remediationsnpm run test:phase7-setup-i18nnpm run test:rtl-setup-auth-settingsnpm run test:rtl-dashboard-pos-commonnpm run test:rtl-kds-server-whatsappnpm run test:status-messagesnpm run test:rasternpm run test:receipt-column-widthnpm run test:receipt-column-oraclenpm run test:daily-sales-exportnpm run test:daily-invoices-exportnpm run test:cash-closurescd frontend && npx playwright test phase7-setup-print-i18n.spec.ts server-app-ordering.spec.ts --config=playwright.config.ts --project=chromium✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.
✅ No issues found.
✅ No issues found.