feat(i18n): expand locale coverage from 8 to 20 languages#64
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR expands locale support for the KeePass Browser Bridge extension by adding 12 new Changesi18n Expansion Phase 1
Estimated code review effort: 2 (Simple) | ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
scripts/validate-locales.mjs (1)
10-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winValidator only checks key parity, not message structure.
The validator confirms that locale keys match English keys but doesn't verify that each entry contains a non-empty
messageproperty. A malformed entry like"appName": {}or"appName": { "foo": "bar" }would pass validation silently, potentially causingchrome.i18n.getMessage()to return empty strings at runtime.Consider enhancing the validator to check that each value is an object with a non-empty
messagestring property.♻️ Proposed enhancement to validate message structure
function getKeys(obj) { return Object.keys(obj).sort(); } +function validateMessages(obj, locale) { + const errors = []; + for (const [key, value] of Object.entries(obj)) { + if (typeof value !== "object" || value === null) { + errors.push(`${key}: expected an object`); + } else if (typeof value.message !== "string" || value.message.length === 0) { + errors.push(`${key}: missing or empty "message" property`); + } + } + return errors; +} +Then inside the loop, after loading
data:const keys = getKeys(data); + const structErrors = validateMessages(data, locale); + if (structErrors.length > 0) { + console.error(`Locale ${locale} has invalid entries:\n ${structErrors.join("\n ")}`); + hasError = true; + } const missing = englishKeys.filter((k) => !keys.includes(k));Also applies to: 46-57
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/validate-locales.mjs` around lines 10 - 17, The locale validator currently only compares key sets and can miss malformed entries that lack a valid message payload. Update the validation logic in validate-locales.mjs, especially around loadJson and the loop that compares locale data, to also assert each locale value is an object with a non-empty message string property. Make sure the existing parity check still runs, but extend it so entries like empty objects or objects with unrelated fields fail validation instead of passing silently.tests/unit/locales.test.mjs (1)
6-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider using
import.meta.urlfor path resolution andstdio: "inherit"for error visibility.
process.cwd()assumes the test is always run from the project root. If the working directory differs, the test fails with a confusing file-not-found error. Usingimport.meta.urlmakes the path resolution independent of the working directory. Additionally,stdio: "inherit"would display the validator's error output inline on failure, making debugging easier.♻️ Proposed improvements
import { describe, test, expect } from "vitest"; import { execSync } from "node:child_process"; -import path from "node:path"; -import process from "node:process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; -const scriptPath = path.resolve(process.cwd(), "scripts", "validate-locales.mjs"); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const scriptPath = path.resolve(__dirname, "..", "..", "scripts", "validate-locales.mjs"); describe("locale validation", () => { test("all locale files are valid and consistent", () => { expect(() => - execSync(`node "${scriptPath}"`, { stdio: "pipe" }), + execSync(`node "${scriptPath}"`, { stdio: "inherit" }), ).not.toThrow(); }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/locales.test.mjs` around lines 6 - 12, The locale validation test is resolving the validator script from process.cwd(), which makes it dependent on the current working directory and hides useful failures. Update the path construction in locales.test.mjs to resolve the script relative to the test module using import.meta.url, and change the execSync call in the "all locale files are valid and consistent" test to use stdio: "inherit" so validator errors are shown directly when the test fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/validate-locales.mjs`:
- Around line 10-17: The locale validator currently only compares key sets and
can miss malformed entries that lack a valid message payload. Update the
validation logic in validate-locales.mjs, especially around loadJson and the
loop that compares locale data, to also assert each locale value is an object
with a non-empty message string property. Make sure the existing parity check
still runs, but extend it so entries like empty objects or objects with
unrelated fields fail validation instead of passing silently.
In `@tests/unit/locales.test.mjs`:
- Around line 6-12: The locale validation test is resolving the validator script
from process.cwd(), which makes it dependent on the current working directory
and hides useful failures. Update the path construction in locales.test.mjs to
resolve the script relative to the test module using import.meta.url, and change
the execSync call in the "all locale files are valid and consistent" test to use
stdio: "inherit" so validator errors are shown directly when the test fails.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 63de00e0-6f32-4d94-849e-e65d7eecab86
📒 Files selected for processing (16)
docs/superpowers/plans/2026-07-08-i18n-expansion-phase1.mddocs/superpowers/specs/2026-07-08-i18n-expansion-design.mdextension/_locales/ar/messages.jsonextension/_locales/cs/messages.jsonextension/_locales/id/messages.jsonextension/_locales/it/messages.jsonextension/_locales/nl/messages.jsonextension/_locales/pl/messages.jsonextension/_locales/pt_BR/messages.jsonextension/_locales/ru/messages.jsonextension/_locales/sv/messages.jsonextension/_locales/th/messages.jsonextension/_locales/tr/messages.jsonextension/_locales/uk/messages.jsonscripts/validate-locales.mjstests/unit/locales.test.mjs
Co-Authored-By: Kimchi <noreply@kimchi.dev>
Co-Authored-By: Kimchi <noreply@kimchi.dev>
Description
Expand KeePass Browser Bridge locale coverage from 8 to 20 languages (Phase 1), matching Kee.
Changes
scripts/validate-locales.mjsto validate all_locales/<lang>/messages.jsonfiles against English.tests/unit/locales.test.mjsto run the validator in the Vitest suite.pt_BR,ru,it,pl,nl,tr,ar,th,id,sv,cs,uk.chrome.i18n/browser.i18nwrapper unchanged.Motivation
Kee supports ~20 locales while KBB only had 8. This change closes the i18n gap with Kee and lays the validator foundation for Phase 2 (45 locales to match KeePassXC-Browser).
Testing
npm testpasses (1025 tests, 78 files)npm run lintpasses (0 errors, 0 warnings)npx vitest run tests/unit/locales.test.mjspassesBrowser / Plugin Impact
Security & Compatibility
Summary by CodeRabbit
New Features
Bug Fixes