Skip to content

test: add languages testing for web app - #380

Merged
pikann merged 2 commits into
masterfrom
test/add-language-testing
Aug 9, 2026
Merged

test: add languages testing for web app#380
pikann merged 2 commits into
masterfrom
test/add-language-testing

Conversation

@pikann

@pikann pikann commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add apps/web/src/i18n/locales.test.ts, a Vitest test that checks every locale under src/i18n/locales (en, vi, ko, zh-CN, ja, es, fr, ru, pt-BR) has the same namespace files and the same nested key structure as en, so a translation can never silently fall back due to a missing key.
  • The test correctly ignores i18next's CLDR plural-suffix variance (e.g. Russian legitimately has _few/_many in addition to _one/_other) so real language differences don't trip a false positive.
  • No CI workflow changes needed — web-pr-ci.yml already runs bun run test on every PR touching apps/web/**, so this test now runs automatically.
  • Fixes a real gap the new test caught: home.stats.aiAgents.subActive existed only in en/shared.json and was missing from all 8 other locales, so non-English users silently saw the English string. Added the missing translation to each locale.

Test plan

  • bun run test — full web suite green (locale test included)
  • bun run lint
  • bun run build

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Solid, tight structural test — I verified locally that it actually fails when a key drifts. Two minor, deferrable suggestions below.

Reviewed changes

  • Locale key-parity test — new apps/web/src/i18n/locales.test.ts mirrors the exact import.meta.glob("./locales/*/*.json") pattern and path regex config.ts uses, asserting each supported language's namespace files and key paths match en, with CLDR plural-suffix (_zero/_one/_two/_few/_many/_other) normalization.
  • Missing aiAgents.subActive translations — adds the {{count}}-interpolated subActive copy to the 8 non-English shared.json files, fixing the home stats card (apps/web/src/routes/_authenticated/home/index.tsx:570) falling back to English for those locales.

ℹ️ Placeholder parity isn't asserted

The test pins key paths, but not the interpolation tokens inside the string values. A locale that drops or renames {{count}} still passes the path comparison while the UI renders a literal {{count}} configurados. Since collectKeyPaths already walks every leaf, comparing the {{...}} token set per leaf against the en equivalent would close that gap for near-free.

Technical details
# Placeholder parity

## Affected sites
- apps/web/src/i18n/locales.test.ts:70-74 — per-namespace key comparison covers paths only, not `{{...}}` tokens

## Required outcome
- A locale whose string leaf holds a different `{{...}}` token set than the `en` leaf fails the test.

## Suggested approach (optional)
- In the leaf comparison, also extract and compare `{{...}}` tokens (e.g. `value.match(/\{\{([^}]+)\}\}/g)`) per key path.

ℹ️ Nitpicks

  • subActive in es, pt-BR (and fr's configurés) uses a single plural form, so a count of 1 renders as "1 configurados". Adding _one/_other variants is the idiomatic fix for those languages, and the test's plural-suffix stripping already tolerates them.

Pullfrog  | Fix it ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pikann
pikann merged commit a06268a into master Aug 9, 2026
1 of 2 checks passed
@pikann
pikann deleted the test/add-language-testing branch August 9, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant