You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing
Validate locale JSON structure and translation macros
🧪 Tests🕐 10-20 Minutes
AI Description
• Validates every locale file is a JSON object containing string translations and structured
metadata.
• Rejects unsupported translation macros and plural option names across the locale corpus.
The following are alternative approaches to this PR:
1. Reuse the production localization parser
➕ Keeps validation aligned with runtime parsing behavior
➕ Avoids regex grammar drift as macro syntax evolves
➖ Couples corpus tests to runtime localization internals
➖ May require additional setup and less targeted failure reporting
2. Validate with a JSON schema
➕ Provides a declarative contract for metadata and translation values
➕ Can be reused by editors or CI tooling
➖ Does not validate embedded macro syntax without custom extensions
➖ Adds schema maintenance and validation dependencies
Recommendation: The focused Vitest approach is appropriate for lightweight regression prevention and clear file/key failures. If the production localization parser exposes a stable validation API, prefer it over the custom macro regex so accepted syntax has a single source of truth.
• Adds Vitest coverage that parses every locale JSON file and verifies its top-level object shape, metadata object, and string translation values. It also reports unsupported macros and invalid plural option names with file and translation-key context.
1. Italian macro remains unfixed✓ Resolved📎 Requirement gap≡ Correctness
Description
The new validation records Italian's plurale macro as unsupported and then requires an empty
failure list, so this test fails while the translation that freezes Italian-configured pads remains
in the corpus. Replace plurale/uno/altro with the supported plural/one/other syntax so
the test passes and the runtime loop is removed.
+ if (!allowedMacros.has(macroName)) failures.push(`${rel}:${key}:${macroName}`);+ if (macroName !== 'plural') continue;
Evidence
Rule 1 requires Italian-selected pads to remain responsive. The added validator permits only
plural and pushes the still-present Italian plurale macro into failures; src/locales/it.json
retains that unsupported macro, while runtime localization registers only plural and the affected
string is consumed by the pad user list.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The new locale validation detects the existing Italian `plurale` macro and fails, but the PR does not correct the translation responsible for the Italian pad freeze.
## Issue Context
The runtime supports `plural` with CLDR option names. Update Italian's `pad.userlist.onlineCount` from `plurale(count) uno: ... altro: ...` to `plural(count) one: ... other: ...`, preserving the Italian display text.
## Fix Focus Areas
- src/locales/it.json[398-398]
- src/tests/backend-new/specs/locale-files.test.ts[26-39]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The validation loop only checks strings that fully match macroRe, so malformed macro candidates
are silently skipped; existing Hungarian and Unicode locale entries pass this test even though the
runtime cannot expand them and displays the raw {[...]} markup. This prevents the test from
enforcing its stated guarantee that the locale corpus contains no unsupported macros.
+ while ((match = macroRe.exec(value)) !== null) {
Evidence
The Hungarian corpus has a comma after plural(num), while other locales contain non-ASCII macro
syntax; none can match the new ASCII-only full macro regex, so line 26 never validates them. The
runtime also processes only regex matches and otherwise returns the original string, proving these
entries reach the UI as literal macro markup.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The locale validator only inspects complete `macroRe` matches, allowing malformed or runtime-unsupported `{[...]}` expressions to pass unnoticed.
## Issue Context
The runtime uses similarly restrictive syntax and leaves unmatched macro text in the rendered translation. Scan for every macro candidate, validate that the entire candidate conforms to supported syntax, and report malformed candidates; update currently invalid locale entries so the strengthened test passes.
## Fix Focus Areas
- src/tests/backend-new/specs/locale-files.test.ts[13-39]
- src/locales/hu.json[161-161]
- src/locales/diq.json[162-162]
- src/locales/shn.json[109-109]
- src/locales/my.json[152-152]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Tip of the day
💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more'
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
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.
This test will check for translation errors in the future and should prevent #8163