Repository navigation
feat(i18n): add missing countries to catalog - #1590
Conversation
Add all 114 missing ISO 3166-1 countries and territories from libphonenumber-js (including SY) to main/countries.ts with verified locale, ISO 4217 currency, and IANA timezone defaults, add newly exposed Cyrillic and Belarusian currency ASCII fallbacks, and enforce full catalog invariants in country-profile tests. Fixes #1585
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@greptile review |
[Medium impact] The PR appears safe to merge.
|
…alidation (Linux)` failed in `node scripts/ci/check-changed-format.cjs` because `tests/currency-print-fallback.test.ts` failed `oxfmt --check` (exceeding the 100-character `printWidth` in `.oxfmtrc.json` at line 9's import from `../shared/print/thermal-capabilities` and line 69's `assertEqualOrThrow` call). 2. `Required Checks Gate` failed solely because `Lint & Build Validation (Linux)` (`linux-baseline`) reported `failure` (`e2e-playwright` succeeded and `windows-uninstaller` was skipped). 3. Because `scripts/ci/check-changed-format.cjs` stops on the first failing package (`root`) before checking `frontend`, I also audited the 4 changed `frontend/src/lib/printer/` files against `frontend/.oxfmtrc.json` (`printWidth: 100`) and found a pre-existing 133-character signature on `normalizeThermalText` in `frontend/src/lib/printer/unicode.ts` (line 16) that would fail `oxfmt --check` once the root check passed. Changes made (formatting-only line wrapping to <= 100 chars matching `.oxfmtrc.json` / `frontend/.oxfmtrc.json`): - `tests/currency-print-fallback.test.ts`: wrapped the `../shared/print/thermal-capabilities` import and the `Tajikistani somoni price line` `assertEqualOrThrow` call across lines with trailing commas. - `frontend/src/lib/printer/unicode.ts`: wrapped the `normalizeThermalText` parameter list across lines with a trailing comma. Verification: - `git diff --check` passed (exit 0). - `node scripts/ci/validate-test-script-coverage.cjs` and `node tests/test-script-coverage.test.cjs` passed (300 reachable, 8 explicitly excluded; 366 run by default suite). - Could not run `oxfmt`, `oxlint`, or `ts-node` locally because `node_modules` and `frontend/node_modules` are not installed in this worktree and those binaries are not on `PATH`
Intent
Check what other countries are missing from FloCafe's country selection catalog alongside Syria (
SY) and add all missing valid countries and territories so users in every supported region can select their country, default timezone, currency, locale, and phone dial code cleanly.Fixes #1585
What Changed
main/countries.ts, expanding the catalog to 245 country profiles across 153 currencies (100% oflibphonenumber-jsregions) and updatingREADME.mdto match.SLEandXCGtoSUPPLEMENTAL_ISO_CURRENCY_CODESinshared/currencies.ts, added 23 entries toNON_TWO_DECIMAL_COUNTRY_CURRENCIESinfrontend/src/lib/cart-price.ts, and updatedshared/print/currency.ts,shared/print/thermal-capabilities.ts,main/printers/formatting-helpers.ts, andfrontend/src/lib/printer/withсом./грн./ÍkrASCII fallbacks, letter-bounded token stripping (stripCurrencyTokens), and shared-glyph disambiguation (resolveAsciiCurrencyFallbackfor¥,£, and₩).tests/country-profile.test.tsto verify locale, currency, decimal, timezone, E.164 dial code, display name, andlibphonenumber-jscoverage invariants for every catalog entry, and extendedtests/currency-print-fallback.test.tsfor Cyrillic token boundaries and shared-symbol thermal fallbacks.Risk Assessment
✅ Low: The change cleanly expands the country catalog to 245 entries with valid locales, currencies, timezones, and dial codes, adds supplemental ICU currency codes (SLE, XCG) and word-bounded ASCII thermal fallbacks, and updates cart-price decimal mappings and README documentation.
Testing
Built the TypeScript backend and static Next.js frontend, passed all six targeted country/currency/phone/print test suites, and drove four live end-to-end scenarios (with screenshots and API transcripts saved to the evidence directory) covering setup search/selection, Store Details switching and persistence, +963 customer dial code and SYP POS/Orders/delivery-slip formatting, SL/SLE initialization, and adversarial invalid-input rejections before removing all transient build, dependency, and temp artifacts.
Evidence: Live API transcript: SY setup, order/bill/payment, delivery slip, adversarial settings, and 9-country switching
Evidence: Live API transcript: adversarial setup rejections and Sierra Leone (SL/SLE) setup
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:currencynpm run test:country-localizationnpm run test:phonenpm run test:print-paritynpm run test:receipt-column-oraclenpm run test:country-provenancenpm run build && npm run build:frontendLive Playwright browser walkthrough on isolated dev-server.js (PORT=3101): /setup (Syria SY, XCG/Curaçao CW), /settings?tab=store (CW -> SY switch, +963 phone normalization, reload persistence), /customers (+963 dial code customer creation)Live Playwright browser + Express API end-to-end verification on isolated dev-server.js (PORT=3151): SY/SYP setup, POS menu, order/bill/payment, delivery-slip-payment formatting, adversarial settings checks, and 9-country PUT /api/settings/business switchingLive Express API adversarial setup & SL/SLE verification on isolated dev-server.js (PORT=3161)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.