test: add languages testing for web app - #380
Merged
Merged
Conversation
…esting # Conflicts: # apps/web/src/i18n/locales/ru/shared.json
Contributor
There was a problem hiding this comment.
ℹ️ 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.tsmirrors the exactimport.meta.glob("./locales/*/*.json")pattern and path regexconfig.tsuses, asserting each supported language's namespace files and key paths matchen, with CLDR plural-suffix (_zero/_one/_two/_few/_many/_other) normalization. - Missing
aiAgents.subActivetranslations — adds the{{count}}-interpolatedsubActivecopy to the 8 non-Englishshared.jsonfiles, 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
subActiveines,pt-BR(andfr'sconfigurés) uses a single plural form, so a count of 1 renders as "1 configurados". Adding_one/_othervariants is the idiomatic fix for those languages, and the test's plural-suffix stripping already tolerates them.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
apps/web/src/i18n/locales.test.ts, a Vitest test that checks every locale undersrc/i18n/locales(en, vi, ko, zh-CN, ja, es, fr, ru, pt-BR) has the same namespace files and the same nested key structure asen, so a translation can never silently fall back due to a missing key._few/_manyin addition to_one/_other) so real language differences don't trip a false positive.web-pr-ci.ymlalready runsbun run teston every PR touchingapps/web/**, so this test now runs automatically.home.stats.aiAgents.subActiveexisted only inen/shared.jsonand 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 lintbun run build