locale-format-validator
Overview
Locale-specific formatting is a common bug source:
- US user sees
5/4/2026 and reads "May 4." Spanish user sees the
same string and reads "April 5."
- German user sees
1,234.56 and may interpret as 1.23456 (the
comma is a thousands separator, the period a decimal in DE).
- Japanese user sees a price in dollars instead of yen.
This skill verifies the app uses the right format per locale.
When to use
- The product displays dates, numbers, currencies, or times.
- A bug report says "the date is in the wrong format."
- Pre-release: scheduled locale-format check.
How to use
- Identify the formatting library the app uses (Step 1); prefer Intl APIs that delegate to CLDR.
- Fix the expected date, number, and currency strings per target locale from CLDR (Steps 2-4, Step 8).
- Author tests asserting the rendered date / number / currency per locale (Step 5).
- Add timezone assertions so timestamps render in the user's timezone (Step 6).
- Run the tests across the full locale matrix in CI (Step 7).
- Trace any failure back to CLDR conventions, not hand-coded assumptions.
Step 1 - Identify the formatting library
| Stack |
Library |
| JS / browser |
Intl.DateTimeFormat / Intl.NumberFormat (built-in) |
| React |
react-intl (FormatJS) <FormattedDate> |
| Python |
babel.dates / babel.numbers |
| Java |
DateTimeFormatter / NumberFormat with Locale |
| Ruby on Rails |
I18n.l(date, format: :long) / number_to_currency |
| .NET |
CultureInfo + ToString("d", culture) |
The Intl APIs (browser-native) are recommended - they delegate to
the underlying ICU library for canonical CLDR-based formatting.
Step 2 - Date format expectations per locale
| Locale |
Short date |
Medium |
Long |
| en-US |
5/4/2026 |
May 4, 2026 |
May 4, 2026 |
| en-GB |
04/05/2026 |
4 May 2026 |
4 May 2026 |
| de-DE |
04.05.2026 |
04.05.2026 |
4. Mai 2026 |
| fr-FR |
04/05/2026 |
4 mai 2026 |
4 mai 2026 |
| ja-JP |
2026/05/04 |
2026/05/04 |
2026年5月4日 |
| zh-CN |
2026/5/4 |
2026年5月4日 |
2026年5月4日 |
US and DE date formats look superficially similar (differ only in
separator) but are unambiguously interpreted only in their locale.
Step 3 - Number format expectations
| Locale |
1234.56 |
1234567 |
| en-US |
1,234.56 |
1,234,567 |
| en-GB |
1,234.56 |
1,234,567 |
| de-DE |
1.234,56 |
1.234.567 |
| fr-FR |
1 234,56 |
1 234 567 |
| ar-SA |
١٬٢٣٤٫٥٦ |
١٬٢٣٤٬٥٦٧ |
| hi-IN |
1,234.56 |
12,34,567 |
The Indian grouping (lakh = 100,000 displayed as 1,00,000) is a
common bug source for apps using only Western thousands grouping.
Step 4 - Currency expectations
| Locale |
$1234.56 USD |
€1234.56 EUR |
¥1234 JPY |
| en-US |
$1,234.56 |
€1,234.56 |
¥1,234 |
| de-DE |
1.234,56 $ |
1.234,56 € |
1.234 ¥ |
| fr-FR |
1 234,56 $ |
1 234,56 € |
1 234 ¥ |
| ja-JP |
$1,234.56 |
€1,234.56 |
¥1,234 |
Notes:
- Euro symbol position varies (€-DE vs DE-€ in some renderings).
- JPY has no decimals.
- Currency symbol may precede or follow per locale.
Step 5 - Author tests
import { test, expect } from '@playwright/test';
test('date format per locale', async ({ page }) => {
// en-US
await page.goto('/orders/123?lng=en-US');
await expect(page.getByTestId('order-date')).toHaveText('5/4/2026');
// de-DE
await page.goto('/orders/123?lng=de-DE');
await expect(page.getByTestId('order-date')).toHaveText('04.05.2026');
// ja-JP
await page.goto('/orders/123?lng=ja-JP');
await expect(page.getByTestId('order-date')).toHaveText('2026/05/04');
});
test('currency format per locale', async ({ page }) => {
await page.goto('/orders/123?lng=de-DE');
await expect(page.getByTestId('order-total')).toHaveText('1.234,56 €');
await page.goto('/orders/123?lng=ja-JP¤cy=JPY');
await expect(page.getByTestId('order-total')).toHaveText('¥1,235'); // no decimals
});
test('number format per locale', async ({ page }) => {
await page.goto('/dashboard?lng=hi-IN&users=1234567');
await expect(page.getByTestId('user-count')).toHaveText('12,34,567'); // Indian grouping
});
Step 6 - Time + timezone
A separate concern: timestamps must show in the user's timezone:
test('order time displays in user timezone', async ({ page }) => {
await page.goto('/orders/123?lng=en-US&tz=America/New_York');
await expect(page.getByTestId('order-time')).toContainText('EST');
await page.goto('/orders/123?lng=ja-JP&tz=Asia/Tokyo');
await expect(page.getByTestId('order-time')).toContainText('JST');
});
Step 7 - Locale matrix in CI
- name: Locale-format tests
run: |
for locale in en-US en-GB de-DE fr-FR ja-JP zh-CN ar-SA hi-IN; do
LOCALE=$locale npx playwright test e2e/locale-formats/
done
Or via Playwright projects:
// playwright.config.ts
projects: [
{ name: 'en-US', use: { locale: 'en-US' } },
{ name: 'de-DE', use: { locale: 'de-DE' } },
// ...
],
Step 8 - CLDR as source of truth
The Unicode Common Locale Data Repository (CLDR) is the canonical
source for locale data. Modern Intl libraries delegate to ICU
which delegates to CLDR.
For verification, consult the CLDR data at cldr.unicode.org/.
The format conventions in this skill come from CLDR; the actual
expected strings should be derived from CLDR per locale, not
hand-coded.
Worked example
A de-DE user reports the order total renders as $1,234.56 - US grouping with a
leading dollar sign. The expected de-DE rendering (Step 4) is 1.234,56 €.
Author a Playwright test (Step 5): goto('/orders/123?lng=de-DE') and assert
order-total reads 1.234,56 €; add a ja-JP case asserting ¥1,235 (no
decimals) and a hi-IN case asserting 12,34,567 (Indian lakh grouping). Run
the matrix in CI (Step 7). The de-DE case fails because the app hand-coded a
universal 1,234.56 grouping. Replacing the format call with Intl.NumberFormat
(Step 1) makes all three locales pass.
Anti-patterns
| Anti-pattern |
Why it fails |
Fix |
| Hand-coded format strings |
Drift from canonical CLDR; locale assumptions break. |
Use Intl APIs / Intl.DateTimeFormat. |
| Universal "1,234.56" thousands grouping |
Wrong for de-DE, fr-FR, hi-IN, etc. |
Per-locale via Intl. |
| US-only date format |
"5/4/2026" ambiguous internationally. |
ISO 8601 (2026-05-04) for storage; locale-specific for display. |
| JPY with decimals |
JPY has no decimal subdivision. |
Per-currency precision; Intl handles automatically. |
| Timezone-naive timestamps |
"Order placed at 14:00" - but in whose timezone? |
Always include TZ; convert to user's TZ for display (Step 6). |
Limitations
- Bicultural users. A Hindi user with English UI prefers
Indian grouping; user-preference UI overrides locale auto-detection.
- CLDR updates. New CLDR releases sometimes change formatting;
pin a CLDR version for stable test expectations.
- Server-vs-client formatting. Inconsistent if both render
formats with different libraries; pick one.
- Intl API gaps. Some niche locales / formats are
underrepresented in browser Intl; libraries like FormatJS fill
some gaps.
References
- W3C i18n at
w3.org/International/.
- CLDR at
cldr.unicode.org/.
i18n-string-coverage,
pseudo-localization-runner,
rtl-rendering-tester -
sibling skills for the broader l10n test surface.
1---2name: locale-format-validator3description: "Use when a product shows dates, numbers, currencies, times or durations to users in several locales and needs proof each locale formats them correctly (5/4/2026 vs 04.05.2026, 1,234.56 vs 1.234,56, $ vs EUR placement)."4metadata:5 source: https://skillmd.com/skills/testland/locale-format-validator6---78# locale-format-validator910## Overview1112Locale-specific formatting is a common bug source:1314- US user sees `5/4/2026` and reads "May 4." Spanish user sees the15 same string and reads "April 5."16- German user sees `1,234.56` and may interpret as 1.23456 (the17 comma is a thousands separator, the period a decimal in DE).18- Japanese user sees a price in dollars instead of yen.1920This skill verifies the app uses the right format per locale.2122## When to use2324- The product displays dates, numbers, currencies, or times.25- A bug report says "the date is in the wrong format."26- Pre-release: scheduled locale-format check.2728## How to use29301. Identify the formatting library the app uses (Step 1); prefer Intl APIs that delegate to CLDR.312. Fix the expected date, number, and currency strings per target locale from CLDR (Steps 2-4, Step 8).323. Author tests asserting the rendered date / number / currency per locale (Step 5).334. Add timezone assertions so timestamps render in the user's timezone (Step 6).345. Run the tests across the full locale matrix in CI (Step 7).356. Trace any failure back to CLDR conventions, not hand-coded assumptions.3637## Step 1 - Identify the formatting library3839| Stack | Library |40|----------------|--------------------------------------------------------|41| JS / browser | `Intl.DateTimeFormat` / `Intl.NumberFormat` (built-in) |42| React | `react-intl` (FormatJS) `<FormattedDate>` |43| Python | `babel.dates` / `babel.numbers` |44| Java | `DateTimeFormatter` / `NumberFormat` with Locale |45| Ruby on Rails | `I18n.l(date, format: :long)` / `number_to_currency` |46| .NET | `CultureInfo` + `ToString("d", culture)` |4748The Intl APIs (browser-native) are recommended - they delegate to49the underlying ICU library for canonical CLDR-based formatting.5051## Step 2 - Date format expectations per locale5253| Locale | Short date | Medium | Long |54|---------|------------|------------|------------------------------|55| en-US | 5/4/2026 | May 4, 2026 | May 4, 2026 |56| en-GB | 04/05/2026 | 4 May 2026 | 4 May 2026 |57| de-DE | 04.05.2026 | 04.05.2026 | 4. Mai 2026 |58| fr-FR | 04/05/2026 | 4 mai 2026 | 4 mai 2026 |59| ja-JP | 2026/05/04 | 2026/05/04 | 2026年5月4日 |60| zh-CN | 2026/5/4 | 2026年5月4日 | 2026年5月4日 |6162US and DE date formats look superficially similar (differ only in63separator) but are unambiguously interpreted only in their locale.6465## Step 3 - Number format expectations6667| Locale | 1234.56 | 1234567 |68|---------|------------------|----------------|69| en-US | 1,234.56 | 1,234,567 |70| en-GB | 1,234.56 | 1,234,567 |71| de-DE | 1.234,56 | 1.234.567 |72| fr-FR | 1 234,56 | 1 234 567 | (NB: thin space, U+202F)73| ar-SA | ١٬٢٣٤٫٥٦ | ١٬٢٣٤٬٥٦٧ | (Arabic-Indic digits)74| hi-IN | 1,234.56 | 12,34,567 | (Indian grouping: lakh, crore)7576The Indian grouping (lakh = 100,000 displayed as `1,00,000`) is a77common bug source for apps using only Western thousands grouping.7879## Step 4 - Currency expectations8081| Locale | $1234.56 USD | €1234.56 EUR | ¥1234 JPY |82|---------|----------------|----------------|--------------|83| en-US | $1,234.56 | €1,234.56 | ¥1,234 |84| de-DE | 1.234,56 $ | 1.234,56 € | 1.234 ¥ |85| fr-FR | 1 234,56 $ | 1 234,56 € | 1 234 ¥ |86| ja-JP | $1,234.56 | €1,234.56 | ¥1,234 |8788Notes:89- Euro symbol position varies (€-DE vs DE-€ in some renderings).90- JPY has no decimals.91- Currency symbol may precede or follow per locale.9293## Step 5 - Author tests9495```typescript96import { test, expect } from '@playwright/test';9798test('date format per locale', async ({ page }) => {99 // en-US100 await page.goto('/orders/123?lng=en-US');101 await expect(page.getByTestId('order-date')).toHaveText('5/4/2026');102103 // de-DE104 await page.goto('/orders/123?lng=de-DE');105 await expect(page.getByTestId('order-date')).toHaveText('04.05.2026');106107 // ja-JP108 await page.goto('/orders/123?lng=ja-JP');109 await expect(page.getByTestId('order-date')).toHaveText('2026/05/04');110});111112test('currency format per locale', async ({ page }) => {113 await page.goto('/orders/123?lng=de-DE');114 await expect(page.getByTestId('order-total')).toHaveText('1.234,56 €');115116 await page.goto('/orders/123?lng=ja-JP¤cy=JPY');117 await expect(page.getByTestId('order-total')).toHaveText('¥1,235'); // no decimals118});119120test('number format per locale', async ({ page }) => {121 await page.goto('/dashboard?lng=hi-IN&users=1234567');122 await expect(page.getByTestId('user-count')).toHaveText('12,34,567'); // Indian grouping123});124```125126## Step 6 - Time + timezone127128A separate concern: timestamps must show in the user's timezone:129130```typescript131test('order time displays in user timezone', async ({ page }) => {132 await page.goto('/orders/123?lng=en-US&tz=America/New_York');133 await expect(page.getByTestId('order-time')).toContainText('EST');134135 await page.goto('/orders/123?lng=ja-JP&tz=Asia/Tokyo');136 await expect(page.getByTestId('order-time')).toContainText('JST');137});138```139140## Step 7 - Locale matrix in CI141142```yaml143- name: Locale-format tests144 run: |145 for locale in en-US en-GB de-DE fr-FR ja-JP zh-CN ar-SA hi-IN; do146 LOCALE=$locale npx playwright test e2e/locale-formats/147 done148```149150Or via Playwright projects:151152```typescript153// playwright.config.ts154projects: [155 { name: 'en-US', use: { locale: 'en-US' } },156 { name: 'de-DE', use: { locale: 'de-DE' } },157 // ...158],159```160161## Step 8 - CLDR as source of truth162163The Unicode Common Locale Data Repository (CLDR) is the canonical164source for locale data. Modern Intl libraries delegate to ICU165which delegates to CLDR.166167For verification, consult the CLDR data at `cldr.unicode.org/`.168The format conventions in this skill come from CLDR; the actual169expected strings should be derived from CLDR per locale, not170hand-coded.171172## Worked example173174A de-DE user reports the order total renders as `$1,234.56` - US grouping with a175leading dollar sign. The expected de-DE rendering (Step 4) is `1.234,56 €`.176177Author a Playwright test (Step 5): `goto('/orders/123?lng=de-DE')` and assert178`order-total` reads `1.234,56 €`; add a `ja-JP` case asserting `¥1,235` (no179decimals) and a `hi-IN` case asserting `12,34,567` (Indian lakh grouping). Run180the matrix in CI (Step 7). The de-DE case fails because the app hand-coded a181universal `1,234.56` grouping. Replacing the format call with `Intl.NumberFormat`182(Step 1) makes all three locales pass.183184## Anti-patterns185186| Anti-pattern | Why it fails | Fix |187|-----------------------------------------------------------------------|---------------------------------------------------------------------------|-----|188| Hand-coded format strings | Drift from canonical CLDR; locale assumptions break. | Use Intl APIs / `Intl.DateTimeFormat`. |189| Universal "1,234.56" thousands grouping | Wrong for de-DE, fr-FR, hi-IN, etc. | Per-locale via Intl. |190| US-only date format | "5/4/2026" ambiguous internationally. | ISO 8601 (`2026-05-04`) for storage; locale-specific for display. |191| JPY with decimals | JPY has no decimal subdivision. | Per-currency precision; Intl handles automatically. |192| Timezone-naive timestamps | "Order placed at 14:00" - but in whose timezone? | Always include TZ; convert to user's TZ for display (Step 6). |193194## Limitations195196- **Bicultural users.** A Hindi user with English UI prefers197 Indian grouping; user-preference UI overrides locale auto-detection.198- **CLDR updates.** New CLDR releases sometimes change formatting;199 pin a CLDR version for stable test expectations.200- **Server-vs-client formatting.** Inconsistent if both render201 formats with different libraries; pick one.202- **Intl API gaps.** Some niche locales / formats are203 underrepresented in browser Intl; libraries like FormatJS fill204 some gaps.205206## References207208- W3C i18n at `w3.org/International/`.209- CLDR at `cldr.unicode.org/`.210- `i18n-string-coverage`,211 `pseudo-localization-runner`,212 `rtl-rendering-tester` - 213 sibling skills for the broader l10n test surface.