Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(web): i18n foundation (next-intl + English fallback + catalog gates) (#3129)

InitCool7bf4bf5ed229
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 60bc1b66e..9b746274f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -235,6 +235,25 @@ jobs:
- name: Test ui
run: npm run test --workspace @repowise-dev/ui
+ # ICU compile gate: a malformed plural or stray brace in any catalog
+ # fails the build here instead of throwing on the page that renders it.
+ - name: Check message catalogs compile (ICU)
+ run: npm run i18n:icu --workspace packages/web
+
+ # Usage gate: a key a `t("...")` call asks for that `en.json` does not
+ # define renders the raw key path (or throws MISSING_MESSAGE), and key
+ # parity cannot see it — it compares key sets, not call sites. Structural
+ # error, so it fails the build.
+ - name: Check every used message key resolves
+ run: npm run i18n:usage --workspace packages/web
+
+ # Catalog freshness only warns: English is the source of truth, so a key
+ # a locale has not reached yet still renders English at runtime. The step
+ # must not fail the build (the script itself exits 0 either way).
+ - name: Report catalog key gaps (warn only)
+ run: npm run i18n:check --workspace packages/web
+ continue-on-error: true
+
- name: Type check claude-mod
run: npm run type-check --workspace @repowise-dev/claude-mod
diff --git a/package-lock.json b/package-lock.json
index 28cee4844..7018db2de 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -681,6 +681,31 @@
"node": ">=18"
}
},
+ "node_modules/@eloqnt/config": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@eloqnt/config/-/config-0.1.0.tgz",
+ "integrity": "sha512-SLR6ZSHxu6XdZtmOz3xRmC3gsY/sCzqtLMD1gxbW2I3XXPBbupwL5RZbkLU/NcZm74AKZrIUPfz3CtEJfxUKqQ==",
+ "license": "MIT"
+ },
+ "node_modules/@eloqnt/format-json": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@eloqnt/format-json/-/format-json-0.1.0.tgz",
+ "integrity": "sha512-4Pkb+HyzgWNJXoU48aJhUyNZSjZvMGooPCNG1ZFmBm55xTiNNPQCNXH66Ob6sXS6RvbWZrRpCf+Uo/Jz9K9g+A==",
+ "license": "MIT",
+ "dependencies": {
+ "@eloqnt/config": "^0.1.0"
+ }
+ },
+ "node_modules/@eloqnt/format-po": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@eloqnt/format-po/-/format-po-0.1.0.tgz",
+ "integrity": "sha512-odgtuICWs67GdkNqY51/d2vaIukuOdlGalKASUGkI5c4cyWOmv/WIVyk5gZyn3xr614RzwWp57s9WB40lRLlBw==",
+ "license": "MIT",
+ "dependencies": {
+ "@eloqnt/config": "^0.1.0",
+ "po-parser": "^2.2.0"
+ }
+ },
"node_modules/@emnapi/core": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
@@ -1410,6 +1435,36 @@
"integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==",
"license": "MIT"
},
+ "node_modules/@formatjs/fast-memoize": {
+ "version": "3.1.7",
+ "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-3.1.7.tgz",
+ "integrity": "sha512-zXfhLpvA6T7+efdt9JLbBwZ00tT7NsBMDVnDu8rpHeNNv8KfRZAMo2gkG0k9lK/Nzc//3kJ9pImsfuJxk3KhUA==",
+ "license": "MIT"
+ },
+ "node_modules/@formatjs/icu-messageformat-parser": {
+ "version": "3.5.20",
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-3.5.20.tgz",
+ "integrity": "sha512-DUzCb2iskGDKvLU7P+nz/rjpmN59luoTRbWHFFNYNnZTxWCKvwPI94rNll99TGZaI6XoTbDF0QGegk21GFrQZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@formatjs/icu-skeleton-parser": "2.1.12"
+ }
+ },
+ "node_modules/@formatjs/icu-skeleton-parser": {
+ "version": "2.1.12",
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-2.1.12.tgz",
+ "integrity": "sha512-ca7tZMLpfHX3sUD7hP6gE/qr6Iq89EDd3ZLeRhbsB7r0UD55DGJq+tmFLzrGrnx5StahUevQmQQVtbDRHsfDHA==",
+ "license": "MIT"
+ },
+ "node_modules/@formatjs/intl-localematcher": {
+ "version": "0.8.14",
+ "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.8.14.tgz",
+ "integrity": "sha512-8O7V38QmbB11+ryJ3KM/znrzXtiqgpXzqNoqDsndHZZ5/zDKTTL+cf5F0mzXkQEwhx8IlWnqYvEovf2S5EwLTw==",
+ "license": "MIT",
+ "dependencies": {
+ "@formatjs/fast-memoize": "3.1.7"
+ }
+ },
"node_modules/@humanfs/core": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
@@ -2390,6 +2445,316 @@
"node": ">=12.4.0"
}
},
+ "node_modules/@parcel/watcher": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.6.0.tgz",
+ "integrity": "sha512-7FNeNl8NCE7aINx7WXiKQrPYZWC/hvrTsmk6zmxbI7LTXE7hVek/n8AfVgpe2y82zl3w0HvCHN0bVKMBoJcC0w==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "detect-libc": "^2.0.3",
+ "is-glob": "^4.0.3",
+ "node-addon-api": "^7.0.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "@parcel/watcher-android-arm64": "2.6.0",
+ "@parcel/watcher-darwin-arm64": "2.6.0",
+ "@parcel/watcher-darwin-x64": "2.6.0",
+ "@parcel/watcher-freebsd-x64": "2.6.0",
+ "@parcel/watcher-linux-arm-glibc": "2.6.0",
+ "@parcel/watcher-linux-arm-musl": "2.6.0",
+ "@parcel/watcher-linux-arm64-glibc": "2.6.0",
+ "@parcel/watcher-linux-arm64-musl": "2.6.0",
+ "@parcel/watcher-linux-x64-glibc": "2.6.0",
+ "@parcel/watcher-linux-x64-musl": "2.6.0",
+ "@parcel/watcher-win32-arm64": "2.6.0",
+ "@parcel/watcher-win32-x64": "2.6.0"
+ }
+ },
+ "node_modules/@parcel/watcher-android-arm64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.6.0.tgz",
+ "integrity": "sha512-trgpLSCKRC/huFjXX/Smh+0sWe4+YtKfktIToiMl59ghz7z+qkH6kMvNnUbLyRs9N11t8l4svSCs1+5B3rOAhA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-darwin-arm64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.6.0.tgz",
+ "integrity": "sha512-Y3QV0gl7Q1zbfueunkWIERICbEojQFCgpyG7YqOGNFLsckXyI1xu9mAIUpKY9QBYzBtSkN8dBPwd3yiAO9ovMw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-darwin-x64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.6.0.tgz",
+ "integrity": "sha512-Ohv6OpzhUfKYD7Beb8kDvG0jbIxORCYY1JRdZnaBtnjjkJxgD7ZVL0nw2sCYd0yTMKTvz3nnTnOF3cDifK+kvw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-freebsd-x64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.6.0.tgz",
+ "integrity": "sha512-5HmXvDgs8VK+74jF9y9/2FE3/OnlcKmc56tjmSrEuZjpSZOGL+fvAu+HKJBdPs9uwoP2hE6TlSUpXZ/C5jUFmQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm-glibc": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.6.0.tgz",
+ "integrity": "sha512-Ps/hui3A+vMbjdqlqAowK2ZL8+BO8dBjxeWXj6npTBs3jx4wWmbPpaLuqwrQrSqIVMCnpWo238bJ1U37GhQOYg==",
+ "cpu": [
+ "arm"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm-musl": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.6.0.tgz",
+ "integrity": "sha512-9c6AUHgHoG+IY88MRIHupztQiQnrbqHYQjkM2btA+Bf/wQnQMuiD0Wfk1EVv3TlNT3x41uU71rn6E4xh/+zvkw==",
+ "cpu": [
+ "arm"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm64-glibc": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.6.0.tgz",
+ "integrity": "sha512-yHRqS2owEXe6Hic9z6Mh1ECsCd+ODVOGvZDyciqRd21+v+o+DnXMOrw50DSpIG2sb8GPEaPPmfeCAWKPJdq46g==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-arm64-musl": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.6.0.tgz",
+ "integrity": "sha512-WhB2e/V7rqdHHWZusBSPuy5Ei8S6lSz6FE5TKKQz5h3a0O+C+mhY7vxU9b/stqvMb8beLnPY82ZrFTLKs+SrKA==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-x64-glibc": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.6.0.tgz",
+ "integrity": "sha512-ulGE6x6Oz6iAwg75T8YQSoguBWasniIbX+QWpaYPcCnDOpdWX3k+4xbEYPZVLxOuoJI+svJJPD3sEj8G7lrQ3A==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-linux-x64-musl": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.6.0.tgz",
+ "integrity": "sha512-tkBYKt7YQrjIJWYDnto2YgO8MRkjlMTSNoRHzsXinBqbLdeOM3L32wPZJvIZxqaLMfSlS/4sUjH/6STVP/XDLw==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-win32-arm64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.6.0.tgz",
+ "integrity": "sha512-gIZAP23jaHjGWasY/TY6yL7NHFClf0Ga7FN+iINvk+KN94rhm94lYZhFsbYFNcA04/onvGD9kKmiJLJB2HbNwQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher-win32-x64": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.6.0.tgz",
+ "integrity": "sha512-cA+/pXV2YkfxlIcXOQ5fSWqAzzPyD78/x5qbK/I0vUkrlYHA8TIz+MXjAbGouguKVSI4bOmkTSJ1/poVSsgt+A==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/@parcel/watcher/node_modules/node-addon-api": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
+ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
+ "license": "MIT"
+ },
+ "node_modules/@parcel/watcher/node_modules/picomatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@@ -3699,6 +4064,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@schummar/icu-type-parser": {
+ "version": "1.21.5",
+ "resolved": "https://registry.npmjs.org/@schummar/icu-type-parser/-/icu-type-parser-1.21.5.tgz",
+ "integrity": "sha512-bXHSaW5jRTmke9Vd0h5P7BtWZG9Znqb8gSDxZnxaGSJnGwPLDPfS+3g0BKzeWqzgZPsIVZkM7m2tbo18cm5HBw==",
+ "license": "MIT"
+ },
"node_modules/@secretlint/config-creator": {
"version": "10.2.2",
"resolved": "https://registry.npmjs.org/@secretlint/config-creator/-/config-creator-10.2.2.tgz",
@@ -4007,6 +4378,222 @@
"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
"license": "MIT"
},
+ "node_modules/@swc/core-darwin-arm64": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.16.2.tgz",
+ "integrity": "sha512-i/j0HNbnn79qnTVPicvay92Nark8fW8NQqn1e2mGERjUXNpBV0+SwQxlRpk2zBhn6laJ8PDI6Kn1nHZhnz3LCA==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-darwin-x64": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.16.2.tgz",
+ "integrity": "sha512-HrwqHyEyHVXO3qTk8EkNK7/b6sOZSEoNh+pot6RdE5x0LbNqfo8LtJUvi3UTXr+5ja/o5HbJdW80eCXo+NjbiA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-arm-gnueabihf": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.16.2.tgz",
+ "integrity": "sha512-MdXi83Z/gGp1LIrg+h7HKxiul/z/Bty/ZJSvYAFqDl9zteC1XLSAZdScquKtXPp50rdyXqritTDCqQBhwVfZKA==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-arm64-gnu": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.16.2.tgz",
+ "integrity": "sha512-/jcTmK6Ktz3owM3YtiKvjofV6p3VpHnYzTIrOGwDIOsDigRAAVuZ8east33wYO/7UTdKYFlyHNnJNT0WJqOA3Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-arm64-musl": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.16.2.tgz",
+ "integrity": "sha512-4gFarKaFnlJTSlJYKmMhV4u+3YE4uYfiydpBoYjmgQhCf9lAieOq+WilZaK9vVSHeqLuQpTEiGULZqAdsRX5Dw==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-ppc64-gnu": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.16.2.tgz",
+ "integrity": "sha512-syqSLGd6KlZ1PciNzs6bIUlhOuFztZufebOHaERjc4N4SqNZxyqYd4I+jj/EfOYnpe0kNjccn9HJLN1p5dz3+w==",
+ "cpu": [
+ "ppc64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-s390x-gnu": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.16.2.tgz",
+ "integrity": "sha512-ZBBLK+ewGyXLzWeMS7wbKtWBdnif6etn7xvPY/iOfbdsjX/+bgkp1pQt2lWF2wlu2hXYZuhJ/tHZE/QR8/apzg==",
+ "cpu": [
+ "s390x"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-x64-gnu": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.16.2.tgz",
+ "integrity": "sha512-LyHJgxCA4Tje0ysBMbEb0tt/ie8kgUKoFE3JAKFhpevmTmhYEoC0H9s47WuDsqiFckF1ITUguZIXJG6K5e0dvg==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-linux-x64-musl": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.16.2.tgz",
+ "integrity": "sha512-PghXJlVM1cgtLfNUR1vxFo1z+PDRAe8cWAJlZZ7spmeiN7BospGXg/MHUg7oNSgwSX7Zo//YKv9P5yD9apsFJQ==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-win32-arm64-msvc": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.16.2.tgz",
+ "integrity": "sha512-StTOSefYBxemvNYYUI3UmO1a8y+hSPjjfHogC2TEHL+Z1PlEBim/XtLas5rS04jAzT9RrNmbtX911SZ42H9jSQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-win32-ia32-msvc": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.16.2.tgz",
+ "integrity": "sha512-fycER209DYIzsibpTMC+chND05OfOjgztWL9U8OE6/uUlsOUZH3eh98isBLEnOymYUhlJLEt5++W1+KL/FOh5Q==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/core-win32-x64-msvc": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.16.2.tgz",
+ "integrity": "sha512-cSd1z6ivSrJPVr+moVwOHWjeKy6TpO4/Shwcv5KCrKYXCccxwh4pRy1C3fDioNx2PF1jPZWHKZjtXt+Be9VbaQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0 AND MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@swc/counter": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
+ "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
+ "license": "Apache-2.0"
+ },
"node_modules/@swc/helpers": {
"version": "0.5.15",
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
@@ -4016,6 +4603,15 @@
"tslib": "^2.8.0"
}
},
+ "node_modules/@swc/types": {
+ "version": "0.1.28",
+ "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.28.tgz",
+ "integrity": "sha512-V6Mnml8v09QALx6K0elJ7o9K/MkVDtW3t6L+7Ou/JcWtb3xwId2AH4FeOceySd2JaO87IMw4+6vSZxLm34LPbw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@swc/counter": "^0.1.3"
+ }
+ },
"node_modules/@tailwindcss/node": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz",
@@ -7353,6 +7949,19 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/content-type": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
+ "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
"node_modules/convert-source-map": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
@@ -8259,7 +8868,6 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
- "devOptional": true,
"license": "Apache-2.0",
"engines": {
"node": ">=8"
@@ -10507,6 +11115,21 @@
"node": ">=0.10.0"
}
},
+ "node_modules/icu-minify": {
+ "version": "4.14.6",
+ "resolved": "https://registry.npmjs.org/icu-minify/-/icu-minify-4.14.6.tgz",
+ "integrity": "sha512-NlyqnxOx8UptHjxu+XcaAM0FbnnYRPlv0n8JsOSIykaw2qALrXkC0ODAjdnF9DLlt1O5HNjM3q7cPC3/4WQb4g==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/amannn"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@formatjs/icu-messageformat-parser": "^3.4.0"
+ }
+ },
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@@ -10673,6 +11296,31 @@
"node": ">=12"
}
},
+ "node_modules/intl-messageformat": {
+ "version": "11.2.15",
+ "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-11.2.15.tgz",
+ "integrity": "sha512-W4VNytsXyWgW5lvVchmsb9xgA5rSKqoflu3/IQ9UCtB0z4R+Bx9MoEkwFT/+30RCl/KzUoH0QGGe9lppF5SuvQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@formatjs/fast-memoize": "3.1.7",
+ "@formatjs/icu-messageformat-parser": "3.5.18"
+ }
+ },
+ "node_modules/intl-messageformat/node_modules/@formatjs/icu-messageformat-parser": {
+ "version": "3.5.18",
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-3.5.18.tgz",
+ "integrity": "sha512-wX1efcL8d7K5QapOTRsP/OLTA/kpwe4LwqWyNxDNg5iRs8i9jJbCyxB5P8jc4KOW5oiLzz2DJr+BRY5xMV9+bA==",
+ "license": "MIT",
+ "dependencies": {
+ "@formatjs/icu-skeleton-parser": "2.1.11"
+ }
+ },
+ "node_modules/intl-messageformat/node_modules/@formatjs/icu-skeleton-parser": {
+ "version": "2.1.11",
+ "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-2.1.11.tgz",
+ "integrity": "sha512-j8cUmOJzVgkHuS0QiQ6ga76UIoLOFSAMWhs7aZJztH3aAdCOAE6vpC8KVvFB4cU10ON0y2/5oOVmPJ43s2lTwA==",
+ "license": "MIT"
+ },
"node_modules/is-alphabetical": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
@@ -10914,7 +11562,6 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
- "dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@@ -10970,7 +11617,6 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
- "dev": true,
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
@@ -13707,6 +14353,22 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/negotiator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz",
+ "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==",
+ "license": "MIT",
+ "dependencies": {
+ "content-type": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
"node_modules/next": {
"version": "15.5.27",
"resolved": "https://registry.npmjs.org/next/-/next-15.5.27.tgz",
@@ -13759,6 +14421,80 @@
}
}
},
+ "node_modules/next-intl": {
+ "version": "4.14.6",
+ "resolved": "https://registry.npmjs.org/next-intl/-/next-intl-4.14.6.tgz",
+ "integrity": "sha512-YRsXs/zqfz1cw/Lw7phGwvRwG6jzjtFuRdWrQj13vwWKwNSj8y1FXD40KYmLnnANnWqcuWhc1RIL1s47c2sM0Q==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/amannn"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@eloqnt/config": "^0.1.0",
+ "@eloqnt/format-json": "^0.1.0",
+ "@eloqnt/format-po": "^0.1.0",
+ "@formatjs/intl-localematcher": "^0.8.1",
+ "@parcel/watcher": "^2.4.1",
+ "@swc/core": "~1.16.0",
+ "icu-minify": "^4.14.6",
+ "negotiator": "^1.0.0",
+ "next-intl-swc-plugin-extractor": "4.14.6",
+ "use-intl": "^4.14.6"
+ },
+ "peerDependencies": {
+ "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/next-intl-swc-plugin-extractor": {
+ "version": "4.14.6",
+ "resolved": "https://registry.npmjs.org/next-intl-swc-plugin-extractor/-/next-intl-swc-plugin-extractor-4.14.6.tgz",
+ "integrity": "sha512-0xchoaNMF8dZTZaXz5fYsxjiU0/YnyTSewNdicrxYJn3922QwSswApYQQGMOmKiZjE55aK2sGjUg7P1HPDgqZg==",
+ "license": "MIT"
+ },
+ "node_modules/next-intl/node_modules/@swc/core": {
+ "version": "1.16.2",
+ "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.16.2.tgz",
+ "integrity": "sha512-95I4kiSMeveI/Mhi+tE4fiWcWLUMfzfKrk0jtr8LRMqHgOgq+xHS+zExkDqoO4b5OeeuXHMWVdD5MeP3X6sULw==",
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@swc/counter": "^0.1.3",
+ "@swc/types": "^0.1.28"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/swc"
+ },
+ "optionalDependencies": {
+ "@swc/core-darwin-arm64": "1.16.2",
+ "@swc/core-darwin-x64": "1.16.2",
+ "@swc/core-linux-arm-gnueabihf": "1.16.2",
+ "@swc/core-linux-arm64-gnu": "1.16.2",
+ "@swc/core-linux-arm64-musl": "1.16.2",
+ "@swc/core-linux-ppc64-gnu": "1.16.2",
+ "@swc/core-linux-s390x-gnu": "1.16.2",
+ "@swc/core-linux-x64-gnu": "1.16.2",
+ "@swc/core-linux-x64-musl": "1.16.2",
+ "@swc/core-win32-arm64-msvc": "1.16.2",
+ "@swc/core-win32-ia32-msvc": "1.16.2",
+ "@swc/core-win32-x64-msvc": "1.16.2"
+ },
+ "peerDependencies": {
+ "@swc/helpers": ">=0.5.17"
+ },
+ "peerDependenciesMeta": {
+ "@swc/helpers": {
+ "optional": true
+ }
+ }
+ },
"node_modules/next-mdx-remote": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/next-mdx-remote/-/next-mdx-remote-6.0.0.tgz",
@@ -14642,6 +15378,12 @@
"node": ">=4"
}
},
+ "node_modules/po-parser": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/po-parser/-/po-parser-2.2.0.tgz",
+ "integrity": "sha512-NdTrKgh0oO7+y+RFX8KKhOB438x/j94UGXEFzl/7pHH0JjWSn42iJ9tgmPksIO6n1JKDHmNDcejPJfKspljB9g==",
+ "license": "MIT"
+ },
"node_modules/points-on-curve": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/points-on-curve/-/points-on-curve-0.2.0.tgz",
@@ -17665,6 +18407,27 @@
}
}
},
+ "node_modules/use-intl": {
+ "version": "4.14.6",
+ "resolved": "https://registry.npmjs.org/use-intl/-/use-intl-4.14.6.tgz",
+ "integrity": "sha512-NZ2I5EPPh/SkdBE35/GTM5TWqtqZK1+R4ICZyW6OHupZHspqof61pNLAFVj1weAfuRzZjsy+0w3z2/AvO4qVIw==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/amannn"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@formatjs/fast-memoize": "^3.1.0",
+ "@schummar/icu-type-parser": "1.21.5",
+ "icu-minify": "^4.14.6",
+ "intl-messageformat": "^11.1.0"
+ },
+ "peerDependencies": {
+ "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
+ }
+ },
"node_modules/use-sidecar": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz",
@@ -18852,6 +19615,7 @@
"geist": "^1.3.0",
"lucide-react": "^0.460.0",
"next": "~15.5.24",
+ "next-intl": "^4.14.6",
"next-mdx-remote": "^6.0.0",
"next-themes": "^0.4.6",
"nuqs": "^2.2.0",
diff --git a/packages/web/I18N.md b/packages/web/I18N.md
new file mode 100644
index 000000000..f37cc4cb6
--- /dev/null
+++ b/packages/web/I18N.md
@@ -0,0 +1,177 @@
+# Web UI internationalisation
+
+The dashboard's copy comes from message catalogs, resolved server-side per
+request from a cookie. English is the source of truth; this branch sets up the
+foundation (next-intl, `en.json`, the English fallback and the catalog checks),
+and locale catalogs plus the language switcher land on top of it. Nothing about
+the URL changes — there is no `/{locale}/...` prefix — so every existing link,
+bookmark and uptime probe keeps resolving to the same page.
+
+## How the locale is chosen
+
+1. **Cookie `NEXT_LOCALE`** — read server-side on every request by
+ `src/i18n/request.ts`, which returns the messages for that locale.
+2. **`localStorage` key `repowise:locale`** — a client-side mirror the switcher
+ writes next to the cookie, restored on load when the cookie is missing
+ (cleared cookies, a different browser profile).
+3. **Fallback** — anything unknown or absent resolves to `en`
+ (`resolveLocale` in `src/i18n/config.ts` never throws).
+
+## English is the source of truth
+
+`messages/en.json` carries every key. A locale catalog may lag behind it: when a
+key is missing, `src/i18n/request.ts` layers the catalog on top of the English
+one (`withFallback` in `src/i18n/fallback.ts`), so the English string renders at
+runtime instead of the raw key or a `MISSING_MESSAGE` throw. UI copy can
+therefore change without every locale being updated in the same commit, and
+`npm run i18n:check` reports the gaps as warnings (exit 0).
+
+## Files
+
+| Path | Role |
+| --- | --- |
+| `src/i18n/config.ts` | Locale registry (`LOCALES`, `DEFAULT_LOCALE`), the cookie name, the storage key, resolver helpers, endonym labels |
+| `src/i18n/fallback.ts` | `withFallback` — layers a catalog over `en.json` so missing keys render English |
+| `src/i18n/request.ts` | next-intl request config: cookie → locale → messages; sets the fixed `UTC` time zone |
+| `src/app/layout.tsx` | `getLocale()` drives `<html lang>`; `NextIntlClientProvider` hands messages to client components |
+| `messages/en.json` | Source of truth for the key set |
+| `scripts/check-i18n-keys.mjs` | Catalog freshness report (`npm run i18n:check`) — warnings, exit 0 |
+| `scripts/find-untranslated.mjs` | Untranslated-copy detector (`npm run i18n:todo`) |
+| `scripts/check-i18n-icu.mjs` | ICU compile check for every message (`npm run i18n:icu`) |
+| `i18n-untranslated-allowlist.json` | Strings that must stay English everywhere, each with an audit note |
+
+Messages are imported statically in `request.ts` rather than read from disk at
+runtime: the build is `output: "standalone"`, and a `fs.readFile` on a computed
+path is not traced into the bundle, so the catalogs would be missing in a
+production container.
+
+## Using a string in a component
+
+Server components (async) use `getTranslations`:
+
+```tsx
+import { getTranslations } from "next-intl/server";
+
+export default async function Page() {
+ const t = await getTranslations("views.files");
+ return <PageShell title={t("title")} description={t("description")} />;
+}
+```
+
+Client components (`"use client"`) use `useTranslations`:
+
+```tsx
+"use client";
+import { useTranslations } from "next-intl";
+
+export function Panel() {
+ const t = useTranslations("views.costs");
+ return <span>{t("spendTitle")}</span>;
+}
+```
+
+Placeholders are ICU: `t("description", { repo: repo.name })` against
+`"description": "… for {repo}. …"`.
+
+## Adding a string
+
+1. Add the key to the right namespace in `messages/en.json`.
+2. Reference it with `t("key")` in the component.
+3. Run `npm run i18n:check` — it prints any catalog missing the key as a
+ warning (the string renders English until a translator adds it), and any
+ orphaned key that never renders.
+
+Namespace layout: `common.*` (buttons), `shell.*` (app frame, nav chrome,
+command palette), `nav.*` and `breadcrumb.*` (navigation labels),
+`errors.*` (error/404 surfaces), `dashboard.*` (the repositories dashboard),
+`attention.*` (dashboard attention sentences), `views.<view>.*` (per-view
+titles, descriptions, section headers).
+
+## Finding untranslated copy
+
+`npm run i18n:todo` walks every `.tsx` under `src/` and prints the user-visible
+strings that are still hard-coded, so "the UI is still English somewhere" is a
+command rather than an opinion:
+
+```bash
+npm run i18n:todo # whole of src/, grouped by file
+npm run i18n:todo -- src/components # one subtree
+npm run i18n:todo -- --json # machine-readable, for follow-up work
+npm run i18n:todo -- --strict # exit 1 while anything is untranslated
+```
+
+It reports three kinds of copy:
+
+| Kind | Example |
+| --- | --- |
+| `jsx-text` | `<span>Save changes</span>` |
+| `jsx-attribute` | `placeholder="Search"`, `aria-label="Close"`, `title=`, `alt=`, `label=`, `hint=`, `description=` |
+| `string-exit` | `toast.error("Saved")`, `confirm("Delete this repo?")`, `alert(…)`, `window.prompt(…)`, `new Error(…)` |
+
+What it ignores is not copy: `className`, `data-*`, `key`, `id`, imports and
+types, comments, test files, the contents of `<code>`, `<pre>`, `<kbd>` and
+`<samp>`, URLs, paths, file names, versions, `ENV_VAR=value` snippets and bare
+identifiers. `--min-length=<n>` raises the floor for very short strings,
+`--group-depth=<n>` changes how the summary buckets directories. `--json`
+prints the whole result (`scannedFiles`, `hitFiles`, `totalHits`,
+`allowlistedHits`, `byDirectory`, `hits`, `allowlisted`) with no timestamp, so
+two runs are diffable.
+
+The report only counts strings the allowlist does not cover. `--show-allowed`
+adds the allowlisted ones back, with the reason that excused them.
+
+### What belongs in the allowlist
+
+`i18n-untranslated-allowlist.json` holds the strings that must stay English in
+every locale. An entry is `{ "value": "GitHub", "reason": "…" }`, or a
+`{ "value": "^…$", "match": "regex", "reason": "…" }` rule. The scanner exits 2
+on an entry without a real `reason`, because the allowlist is meant to be
+auditable rather than a place to park work, and it warns about entries that
+matched nothing so the list cannot rot silently.
+
+The bar is "translating this would be wrong", not "translating this is work":
+
+- brand and product names — `repowise`, `GitHub`, `GitLab`, `MCP`, `PageRank`;
+- identifiers, paths, file names, versions, units, code snippets shown verbatim;
+- developer-only strings that never reach a user, e.g. React context guards.
+
+Everything else — sentences, labels, hints, tooltips, error copy, empty states —
+is work, and work is exactly what this list exists to expose.
+
+### In CI, or at the end of a sweep
+
+`src/` is at zero, so the gate is the whole tree:
+
+```bash
+npm run i18n:todo -- --strict
+```
+
+That exits 1 while any string in `src/` is still hard-coded, which turns
+"someone forgot a `t()`" into a failing check instead of a review comment. Keep
+the other two beside it: `npm run i18n:check` prints keys a catalog is missing
+(a warning — they render English), and `npm run i18n:icu` compiles every
+message with ICU, so a malformed plural fails here instead of throwing on the
+page that renders it.
+
+## Adding a second language
+
+1. `src/i18n/config.ts`: append the tag to `LOCALES` and add its endonym to
+ `LOCALE_LABELS`. Leave `DEFAULT_LOCALE` alone unless the new language should
+ become the fallback.
+2. Create `messages/<tag>.json` carrying the keys you have translated — you do
+ not have to cover `en.json` in one go; anything missing renders English.
+3. `src/i18n/request.ts`: import the catalog and add it to the `MESSAGES` map.
+ The fallback layering is already wired.
+4. `npm run i18n:check` — it lists any key the new catalog has not reached yet.
+5. The language switcher maps over `LOCALES`, so the new language appears in the
+ control on its own.
+
+## What is deliberately not translated
+
+Code (file contents, symbol names, diffs), AI-generated wiki prose, repository
+and branch names, and API-returned text. The UI chrome around them is
+translated; the payload is shown as written.
+
+`packages/ui` stays language-agnostic: it is a shared package, so it receives
+its copy through props/children and the `packages/web` side supplies the
+translated strings.
diff --git a/packages/web/i18n-untranslated-allowlist.json b/packages/web/i18n-untranslated-allowlist.json
new file mode 100644
index 000000000..66e55cb4f
--- /dev/null
+++ b/packages/web/i18n-untranslated-allowlist.json
@@ -0,0 +1,32 @@
+{
+ "criteria": [
+ "A string belongs here only when translating it would be wrong, not when translating it would be work.",
+ "Brand and product names that stay Latin in every locale: repowise/Repowise, GitHub, GitLab, MCP, PageRank.",
+ "Identifiers, paths, file names, versions, units and code snippets the UI shows verbatim.",
+ "Developer-facing strings that never reach a user, e.g. React context guards thrown at the console.",
+ "NOT a reason for entry: 'hard to translate', 'small', 'someone else will do it'. Every entry carries an audit note.",
+ "The scanner warns about entries that matched nothing, so stale rows surface instead of rotting in place."
+ ],
+ "entries": [
+ {
+ "value": "repowise",
+ "reason": "Product wordmark, rendered as-is in the sidebar, mobile nav and version footer."
+ },
+ {
+ "value": "GitHub",
+ "reason": "Brand name of an external service; stays Latin in every locale."
+ },
+ {
+ "value": "GitLab",
+ "reason": "Brand name of an external service; stays Latin in every locale."
+ },
+ {
+ "value": "PageRank",
+ "reason": "Algorithm name (proper noun) shown as a graph metric label."
+ },
+ {
+ "value": "useRepositoryChat must be used within RepositoryChatProvider",
+ "reason": "React context guard thrown to developers; console output stays English in every locale."
+ }
+ ]
+}
diff --git a/packages/web/messages/en.json b/packages/web/messages/en.json
new file mode 100644
index 000000000..b7e5381f4
--- /dev/null
+++ b/packages/web/messages/en.json
@@ -0,0 +1,1140 @@
+{
+ "app": {
+ "description": "Open-source codebase documentation engine"
+ },
+ "common": {
+ "search": "Search",
+ "loading": "Loading…",
+ "cancel": "Cancel",
+ "save": "Save",
+ "refresh": "Refresh",
+ "refreshing": "Refreshing…",
+ "dismiss": "Dismiss",
+ "close": "Close",
+ "back": "Back",
+ "retry": "Try again"
+ },
+ "language": {
+ "label": "Language",
+ "switched": "Language switched to {language}"
+ },
+ "shell": {
+ "skipToContent": "Skip to content",
+ "expandSidebar": "Expand sidebar",
+ "collapseSidebar": "Collapse sidebar",
+ "openNavMenu": "Open navigation menu",
+ "openSearch": "Open search",
+ "repositories": "Repositories",
+ "workspace": "Workspace",
+ "indexingNow": "Indexing",
+ "cantReachApiTitle": "Can't reach the API",
+ "cantReachApiBody": "Your repositories could not be loaded. Check that the Repowise server is running, then reload.",
+ "pillMissing": "missing",
+ "pillIndex": "index",
+ "statusDirectoryMissing": "directory missing",
+ "statusNeedsIndexing": "needs indexing",
+ "titleDirectoryMissing": "Directory missing — open Workspace to remove or fix",
+ "titleNotIndexedSynthetic": "Not indexed yet. Open Workspace to index.",
+ "titleNotIndexedRepo": "Not indexed yet. Open the repo to index.",
+ "updateAvailable": "Update available",
+ "whatsNew": "What's new",
+ "updateBanner": "repowise <b>v{latest}</b> is available",
+ "updateBannerCurrent": " (you have v{current})",
+ "updateBannerCommand": "Run <code>{command}</code> to upgrade.",
+ "ask": "Ask",
+ "commandPalette": {
+ "label": "Command palette",
+ "placeholder": "Jump to a file, search pages, navigate repos…",
+ "searching": "Searching…",
+ "navigate": "Navigate",
+ "workspace": "Workspace",
+ "workspaceOverview": "Workspace Overview",
+ "repositories": "Repositories",
+ "files": "Files",
+ "pages": "Pages",
+ "askGroup": "Ask",
+ "askWithQuery": "Ask repowise: “{query}”",
+ "askEmpty": "Ask repowise…",
+ "goTo": "Go to — {repo}",
+ "noResults": "No results found.",
+ "hintNavigate": "↑↓ navigate",
+ "hintSelect": "↵ select",
+ "hintClose": "esc close"
+ },
+ "feedback": {
+ "title": "Help us improve Repowise",
+ "description": "Found a bug or have an idea? It goes straight to the maintainers, and we read every message. It's anonymous by default — no account needed.",
+ "empty": "Please enter your feedback.",
+ "thanks": "Thanks for the feedback!",
+ "failed": "Couldn't send feedback. Please try again.",
+ "category": "Category",
+ "categoryUiUx": "UI / UX",
+ "categoryBug": "Bug",
+ "categoryFeature": "Feature request",
+ "categoryOther": "Other",
+ "messageLabel": "Your feedback",
+ "messagePlaceholder": "Tell us what's working, what's broken, or what you'd love to see...",
+ "emailLabel": "Email",
+ "emailOptional": "(optional, if you'd like a reply)",
+ "anonymous": "Submitted anonymously. We only see your email if you add one above.",
+ "sending": "Sending…",
+ "send": "Send feedback"
+ },
+ "skeleton": {
+ "loading": "Loading Repowise"
+ },
+ "reindexHint": {
+ "body": "This index was built by an older repowise. It still works, but a reindex is recommended to pick up the latest format."
+ },
+ "whatsNewModal": {
+ "title": "What's new in repowise",
+ "loading": "Loading release notes...",
+ "unavailable": "Release notes unavailable. <link>View on GitHub</link>"
+ }
+ },
+ "nav": {
+ "dashboard": "Dashboard",
+ "settings": "Settings",
+ "overview": "Overview",
+ "chat": "Chat",
+ "docs": "Docs",
+ "architecture": "Architecture",
+ "knowledgeGraph": "Knowledge Graph",
+ "codeHealth": "Code Health",
+ "refactoring": "Refactoring",
+ "files": "Files",
+ "commits": "Commits",
+ "contributors": "Contributors",
+ "decisions": "Decisions",
+ "stats": "Stats",
+ "usageAndSavings": "Usage & savings",
+ "systemMap": "System Map",
+ "conformance": "Conformance",
+ "contracts": "Contracts",
+ "coChanges": "Co-Changes",
+ "groupPeopleAndHistory": "People & History",
+ "groupSettings": "Settings"
+ },
+ "breadcrumb": {
+ "overview": "Overview",
+ "docs": "Docs",
+ "chat": "Chat",
+ "architecture": "Architecture",
+ "codeHealth": "Code Health",
+ "coverage": "Tests",
+ "refactoringTargets": "Refactoring Targets",
+ "trend": "Trend",
+ "search": "Search",
+ "graph": "Graph",
+ "symbols": "Symbols",
+ "ownership": "Ownership",
+ "hotspots": "Hotspots",
+ "deadCode": "Dead Code",
+ "blastRadius": "Blast Radius",
+ "decisions": "Decisions",
+ "commits": "Commits",
+ "owners": "Contributors",
+ "modules": "Modules",
+ "wiki": "Wiki",
+ "health": "Code Health",
+ "costs": "Usage & Savings",
+ "risk": "Risk",
+ "security": "Security",
+ "settings": "Settings",
+ "knowledgeGraph": "Knowledge Graph",
+ "zoom": "Zoom Map",
+ "files": "Files"
+ },
+ "errors": {
+ "notFoundTitle": "Page not found",
+ "notFoundBody": "The page you requested doesn't exist. It may have been moved or never existed.",
+ "backToDashboard": "Back to dashboard",
+ "errorTitle": "Something went wrong",
+ "errorFallback": "An unexpected error occurred. Please try again.",
+ "digest": "Digest",
+ "tryAgain": "Try again",
+ "repoErrorTitle": "Failed to load repository",
+ "repoErrorFallback": "Could not load repository data. The backend may be unavailable.",
+ "retry": "Retry",
+ "dashboard": "Dashboard",
+ "repoNotFoundTitle": "Page not found",
+ "repoNotFoundBody": "The page or resource you requested doesn't exist for this repository. It may have been moved or never existed."
+ },
+ "dashboard": {
+ "title": "Repositories",
+ "description": "Everything repowise has indexed from this machine.",
+ "ledeLabel": "Repositories",
+ "ledeUnit": "indexed on this machine",
+ "intro": "{files} files and {symbols} symbols are under intelligence here, with {pages} documentation pages written from them. Every figure below is measured from the index rather than estimated.",
+ "ribbon": {
+ "files": "Files",
+ "filesSub": "across {count} repositories",
+ "symbols": "Symbols",
+ "symbolsSub": "functions, classes and methods",
+ "docFreshness": "Doc freshness",
+ "docFreshnessSub": "{fresh} of {total} pages",
+ "docFreshnessNone": "no documentation generated yet",
+ "hotspots": "Hotspots",
+ "hotspotsSub": "files by churn and prior fixes",
+ "unusedExports": "Unused exports",
+ "unusedExportsSub": "open dead-code findings"
+ },
+ "indexingNow": "Indexing now",
+ "indexingNowCount": "Indexing now ({count})",
+ "indexingNowDescription": "Progress streams live; this page does not need a refresh to catch up.",
+ "repositoriesTitle": "Repositories",
+ "repositoriesDescription": "Ordered by what needs attention first — never indexed, then behind their working tree, then by health score — rather than by when they last changed.",
+ "recentActivity": "Recent activity",
+ "recentActivityDescription": "The last indexing and sync runs across every repository.",
+ "quickActions": {
+ "sync": "Sync",
+ "resync": "Full resync",
+ "deadCode": "Dead code scan",
+ "actionFailed": "{action} failed",
+ "deadCodeFinished": "Dead code scan finished",
+ "deadCodeFailed": "Dead code scan failed",
+ "syncStarted": "Sync started{name}",
+ "resyncStarted": "Full resync started{name}",
+ "deadCodeStarted": "Dead code analysis started",
+ "inFlight": "Showing progress for the in-flight job. Cancel it from the panel to start a new one."
+ }
+ },
+ "attention": {
+ "unindexedOne": "{name} has not been indexed yet.",
+ "unindexedMany": "{count} repositories have not been indexed yet.",
+ "behindOne": "{name} is behind its working tree — run repowise update in it to catch up.",
+ "behindMany": "{count} are behind their working trees — run repowise update in them to catch up.",
+ "lowestScore": "Lowest health score is {score} out of 10, in {name}.",
+ "nothingAnalysed": "None of them has been analysed yet, so there are no health scores to compare.",
+ "allCurrent": "Every index is current with its checkout. {parts}"
+ },
+ "views": {
+ "files": {
+ "title": "Files",
+ "description": "Drill the map to see how the tree is shaped and where health is thin, then filter the table to find a specific file."
+ },
+ "stats": {
+ "title": "By the Numbers",
+ "description": "The things about this codebase you can't see anywhere else: how big it got, when it started, when the work happens, and the records it holds."
+ },
+ "commits": {
+ "title": "Commits",
+ "description": "Every commit scored for change-risk against this repo's own history, so 'elevated' means elevated here rather than on some global curve.",
+ "emptyDescription": "Every commit scored for change-risk against this repo's own history.",
+ "emptyHint": "Per-commit change-risk is captured on the next full index. Run a sync and the review queue fills in behind it.",
+ "reviewQueueTitle": "Review queue",
+ "reviewQueueDescription": "Newest first by default. Priority is a tercile of this repo's own distribution, so sorting by it shows only the top third — the filters narrow the whole repository, not the page.",
+ "scoreBehaviourTitle": "How the score behaves here",
+ "scoreBehaviourDescription": "Two views of the same model: where the cuts fall, and what commit shape lands you above them.",
+ "changeRisk": "Change risk",
+ "evolutionTitle": "How the work changed shape",
+ "evolutionDescription": "Commit categories over time, read off the subject line. Fixes carry the accent because that is the series this chart exists to show."
+ },
+ "architecture": {
+ "couplingTitle": "Change coupling",
+ "tabs": {
+ "map": "Map",
+ "coupling": "Coupling",
+ "packages": "Third-party",
+ "symbols": "Symbols"
+ }
+ },
+ "codeHealth": {
+ "title": "Code health",
+ "scopeFiles": "Files",
+ "scopeCounts": "Counts",
+ "scopeAll": "All code",
+ "scopeProduction": "Production",
+ "countsEverything": "Everything",
+ "countsCodeShape": "Code shape only",
+ "refresh": "Refresh",
+ "refreshing": "Refreshing…",
+ "trendTitle": "Health trend",
+ "trendDescription": "How the scores have moved across indexed snapshots.",
+ "indexed": "Indexed {date}",
+ "notIndexed": "Not indexed yet",
+ "snapshots": "{count, plural, one {# snapshot} other {# snapshots}}",
+ "coChangeNoticeTitle": "Health scores changed in this release.",
+ "coChangeNoticeBody": "Co-change coupling is now measured relative to your repository and decays with commit history rather than calendar time, so roughly one file in ten moves a band. Scores are not comparable to snapshots taken before this release.",
+ "tabs": {
+ "triage": "Overview",
+ "performance": "Performance",
+ "findings": "Findings",
+ "coverage": "Tests",
+ "deadCode": "Dead code",
+ "docDrift": "Doc drift",
+ "security": "Security",
+ "impact": "Blast radius"
+ }
+ },
+ "knowledgeGraph": {
+ "title": "Knowledge Graph",
+ "description": "Explore your codebase like a map: scroll to zoom, drag to pan, and double-click any card to dive into its layers, folders and files, ranked by how the code actually runs.",
+ "loading": "Building the knowledge graph…",
+ "error": "Could not load the knowledge graph for this repository."
+ },
+ "refactoring": {
+ "title": "Refactoring",
+ "description": "One opportunity per file: the ordered steps the health pass wrote from your code. Open one to see the change, or hand it to a coding agent.",
+ "promptTitle": "AI refactoring prompt",
+ "promptDescription": "A ready-to-paste plan that hands your AI coding agent the ordered steps, which of them are mechanical, the evidence behind the diagnosis, and the id to query it back.",
+ "loading": "Loading refactoring opportunities",
+ "loadFailed": "Couldn't load refactoring opportunities. The repo may not be indexed yet, or the API is unreachable.",
+ "tabAll": "All",
+ "tabStructural": "Structural",
+ "sectionTitleAll": "All opportunities",
+ "sectionTitleFixFirst": "Opportunities worth doing",
+ "sectionTitleStructural": "Structural opportunities",
+ "sectionTitleFiltered": "{type} opportunities"
+ },
+ "decisions": {
+ "title": "Decisions",
+ "description": "What this codebase has settled on and what is true of the checkout you are standing in: the constraints, the tradeoffs, and the facts that catch people out.",
+ "ledeAccepted": "Accepted",
+ "ledeConfirmed": "Confirmed",
+ "ledeEmpty": "Decisions land here as the indexer mines them from pull requests, commit messages, code comments and your own sessions, and as you record them yourself — below, or with <code>repowise decision add</code>. Each one keeps the quote it was drawn from and the files it governs.",
+ "ledeNoGovernance": "Nothing here governs yet. A record governs only once somebody accepts it, naming the files it covers and why — mining it, seeing it recur, and scoring it confident all stop short of that.",
+ "ledeCandidates": "{count, plural, one {# candidate is} other {# candidates are}} waiting below, and {count, plural, one {it is} other {they are}} all still here: nothing was deleted and every id still resolves. If this page used to show confirmed decisions, those are the records now in Candidates. Accepting one takes a click and changes no code.",
+ "ledeAcceptedRecords": "{count, plural, one {# record is} other {# records are}} accepted: somebody read {count, plural, one {it} other {them}} and marked {count, plural, one {it} other {them}} as something the team stands behind, which is what makes {count, plural, one {it} other {them}} worth quoting back to an agent later.",
+ "ledeAcceptedMore": "{count, plural, one {# more is a candidate} other {# more are candidates}} the indexer mined and nobody has accepted. Until one is accepted it is a guess about your codebase rather than a rule for it, and no agent is ever given one. Open the Candidates lane below to work through them; accepting or dismissing one takes a click and changes no code.",
+ "checkoutTitle": "About this checkout",
+ "checkoutDescription": "Facts about the working tree rather than claims anybody made about it, derived at index time with no model call and no history. These are the ones that trip up a newcomer, human or agent.",
+ "reviewTitle": "Review",
+ "reviewDescription": "Split by what each record's acceptance amounts to, not by a status word. Every record is in exactly one lane and the counts add up: what governs, what nobody has reviewed, what has drifted from the code it names, what names nothing at all, and what has been retired."
+ },
+ "contributors": {
+ "title": "Contributors",
+ "description": "Who knows what, mined from full git history. Ownership follows whoever wrote the surviving lines, not whoever committed last.",
+ "profileTitle": "Contributor",
+ "profileEmptyTitle": "No profile for this contributor",
+ "profileEmptyDescription": "Nobody by this name or address appears in the indexed git history. They may have committed under a different address, or the history may not have been synced yet.",
+ "tenureSince": "Committing here since {date}",
+ "tenureLastTouched": "last touched {time}",
+ "unknownName": "unknown"
+ },
+ "costs": {
+ "title": "Usage & savings",
+ "description": "What agents avoided, what Repowise cost, and how we know.",
+ "savingsErrorTitle": "Couldn't load agent savings",
+ "spendTitle": "Repowise model spend",
+ "spendDescription": "What Repowise's own model work cost, reported beside agent savings and never subtracted from them.",
+ "spendErrorTitle": "Couldn't load model spend",
+ "savingsEmptyTitle": "No agent savings recorded yet",
+ "savingsEmptyDescription": "Route noisy commands through repowise distill, or install the rewrite hook with repowise hook rewrite install. Savings appear here on their own once an agent starts using this repository.",
+ "bySourceTitle": "Savings by source",
+ "bySourceDescription": "Which capture surface produced each part of the total.",
+ "opportunitiesTitle": "Observed opportunities",
+ "opportunitiesDescription": "Behaviour that could have been optimised and was not. Never part of the total above.",
+ "detailsTitle": "Details",
+ "detailsDescription": "The same savings, cut by day, operation, pricing model and agent.",
+ "loadingSavings": "Loading agent savings",
+ "loadingSpend": "Loading model spend…",
+ "savingsErrorBody": "The savings endpoint did not respond.",
+ "savingsErrorBodySpendUnaffected": "The savings endpoint did not respond. Model spend below is unaffected.",
+ "surfaceHeader": "Surface",
+ "surfaceCaption": "Savings by the surface that produced them",
+ "surfaceEmpty": "No savings in this window carry a surface."
+ },
+ "repoSettings": {
+ "title": "Settings",
+ "description": "Indexing, model keys and health for {repo}. Server, webhook and editor configuration are shared across repositories.",
+ "generalTitle": "General",
+ "generalDescription": "Where this repository lives and which branch is indexed.",
+ "syncTitle": "Sync and indexing",
+ "syncDescription": "Pull recent commits into the existing index, or rebuild it from scratch.",
+ "providerTitle": "AI provider",
+ "providerDescription": "A model key lets this repository's documentation be written with AI. Keys are stored with the repository and used by generation from the UI or the CLI.",
+ "captureTitle": "Decision capture",
+ "captureDescription": "What mines architectural decisions from this repository, and whether any of it may send prose to your configured model. Capture only ever produces candidates: nothing here can accept a decision on your behalf.",
+ "refactoringTitle": "Refactoring code generation",
+ "refactoringDescription": "Opt in to turning refactoring plans into reviewable diffs with your configured model.",
+ "healthTitle": "Index health",
+ "healthDescription": "Per-population drift: wiki pages against page vectors, and decision records against decision vectors. A gap means search is answering from a stale set.",
+ "deleteTitle": "Delete this repository",
+ "deleteDescription": "Removes the index and everything generated from it — pages, symbols, decisions and history. Your source files are untouched. This cannot be undone.",
+ "footer": "Server connection, webhooks, model defaults and MCP configuration are in <link>global settings</link>."
+ },
+ "globalSettings": {
+ "title": "Settings",
+ "description": "How this dashboard reaches your server, which model it defaults to, and what the MCP server offers an agent. Changes save as you make them.",
+ "footer": "Sync schedule, exclude patterns and deletion are per repository, on <link>the repository page</link>."
+ },
+ "workspace": {
+ "title": "Workspace",
+ "description": "Every repository registered in this workspace, and what connects them.",
+ "emptyTitle": "No repositories discovered yet",
+ "emptyDescription": "Run `repowise init .` in the workspace root to scan for git repositories and index them. They show up here as soon as the scan lands.",
+ "ledeLabel": "Repositories",
+ "syncWorkspace": "Sync workspace",
+ "reposTitle": "Repositories",
+ "reposDescription": "Ordered by what needs attention first — never indexed, then missing on disk, then by health score — rather than by name.",
+ "contractsTitle": "Contracts",
+ "contractsDescription": "Routes, topics and tables one repository publishes and another consumes, matched across the workspace.",
+ "coChangesTitle": "Files that change together",
+ "coChangesDescription": "Cross-repo file pairs that recent commits touched in the same session. A work-pattern signal mined from git history, not a declared dependency.",
+ "sync": "Sync",
+ "indexNow": "Index now",
+ "syncThisRepo": "Sync this repo",
+ "syncing": "Syncing…",
+ "syncNoRepos": "no repos",
+ "syncQueued": "{count} queued",
+ "syncSkipped": "{count} skipped",
+ "syncErrors": "{count} error",
+ "removeConfirm": "Remove '{name}' from .repowise-workspace.yaml?",
+ "removeFailed": "Failed to remove: {message}",
+ "removeAria": "Remove {alias} from workspace",
+ "removing": "Removing…",
+ "remove": "Remove",
+ "ledeUnit": "in this workspace",
+ "seeSystemMap": "See the system map",
+ "ledeSentence": "{files} files and {symbols} symbols are under intelligence here{pages}.",
+ "ledePagesWith": ", with {pages} documentation pages written from them",
+ "ledeRootedAt": "Everything is rooted at <root>{path}</root>.",
+ "viewAllContracts": "All contracts",
+ "viewAllCoChanges": "All co-changes",
+ "unregisteredNote": "Cross-repo figures below also cover {count, plural, one {# repository} other {# repositories}} the workspace config no longer registers ({names}). Re-run a workspace sync to bring the two back into agreement.",
+ "attention": {
+ "none": "Every registered repository is indexed and present on disk.",
+ "suffix": "{parts}. Each is marked in the list below.",
+ "needsIndex": "{count, plural, one {# repository has} other {# repositories have}} not been indexed yet ({names})",
+ "missing": "{count, plural, one {# directory is} other {# directories are}} missing on disk ({names})",
+ "docsSkipped": "documentation was skipped for {count} ({names})",
+ "andMore": "{list} and {count} more"
+ },
+ "ribbon": {
+ "files": "Files",
+ "filesSub": "across {count, plural, one {# repository} other {# repositories}}",
+ "symbols": "Symbols",
+ "symbolsSub": "functions, classes and methods",
+ "docFreshness": "Doc freshness",
+ "docFreshnessNoPages": "no documentation generated yet",
+ "docFreshnessSub": "weighted across {pages} pages",
+ "hotspots": "Hotspots",
+ "hotspotsSub": "files by churn and prior fixes",
+ "contractLinks": "Contract links",
+ "contractLinksSub": "matched provider to consumer",
+ "contractLinksNone": "no contract data yet"
+ }
+ },
+ "docsFreshness": {
+ "title": "Doc freshness",
+ "header": "Freshness across {count} pages",
+ "freshPct": "{pct}% of pages are fresh",
+ "fresh": "Fresh",
+ "stale": "Stale",
+ "outdated": "Outdated",
+ "pctOfPages": "{pct}% of pages",
+ "distribution": "Distribution"
+ },
+ "overview": {
+ "title": "Overview"
+ },
+ "modules": {
+ "breadcrumb": "Code Health",
+ "notFoundTitle": "Module not found",
+ "notFoundDescription": "The requested module path doesn't exist in this repository's index."
+ }
+ },
+ "settings": {
+ "connection": {
+ "title": "Server",
+ "description": "How this dashboard reaches your repowise server. Stored in this browser, not on the server.",
+ "urlLabel": "Server URL",
+ "urlHint": "Leave blank to use the same origin, which is what a Next.js proxy setup wants.",
+ "apiKeyLabel": "API key",
+ "apiKeyHint": "Only needed when REPOWISE_API_KEY is set on the server.",
+ "apiKeyPlaceholder": "Optional",
+ "testLabel": "Connection",
+ "testHint": "Checks that the server answers and reports what it is running.",
+ "testing": "Testing",
+ "test": "Test connection",
+ "status": "Connected · v{version} · DB {db}"
+ },
+ "webhook": {
+ "title": "Webhooks",
+ "description": "Register one of these in GitHub or GitLab and a push re-syncs the index. The URLs use this dashboard's address, so substitute a public hostname if the host cannot reach it.",
+ "githubHint": "Content type: application/json.",
+ "gitlabHint": "Push events.",
+ "signatureLabel": "Signature verification",
+ "signatureHint": "Omit both to skip verification while developing locally.",
+ "serverOnly": "Set on the server, not here."
+ },
+ "providerPanel": {
+ "keySaved": "API key saved",
+ "keySavedDescription": "Written to this repo. Test it to confirm it works.",
+ "keySaveFailed": "Couldn't save the key",
+ "keyRemoved": "API key removed",
+ "keyRemoveFailed": "Couldn't remove the key",
+ "activateFailed": "Couldn't set the active provider"
+ },
+ "display": {
+ "title": "Display",
+ "description": "What this browser shows and how it presents it. Nothing here changes the index.",
+ "weekendLabel": "Weekend days",
+ "weekendHint": "Drives the “on weekends” share on the coding-rhythm heatmap.",
+ "chatDockLabel": "Ask Repowise",
+ "chatDockHint": "The chat pill in the bottom-right of every repository page. Hiding it also hides the two controls below, and does not affect the full chat page.",
+ "chatDockAria": "Show the Ask Repowise chat pill",
+ "chatAskLabel": "Ask about this",
+ "chatAskHint": "The small chat button beside a file, symbol, finding, decision or commit. Hiding it removes those buttons; the pill and the full chat page still work.",
+ "chatAskAria": "Show the Ask about this buttons",
+ "chatSelectionLabel": "Ask about a selection",
+ "chatSelectionHint": "The control that appears when you select text in code or documentation. Hiding it removes that control; selecting text behaves normally.",
+ "chatSelectionAria": "Show the Ask about selection control",
+ "chatGatedHint": "{hint} Unavailable while Ask Repowise is hidden."
+ },
+ "mcp": {
+ "title": "Editor config",
+ "description": "Paste this into Claude Code, Cursor or Cline to let the agent query this codebase. Replace the path with the repo you want served, and index it first so there is something to answer from.",
+ "serverLabel": "MCP server",
+ "serverHint": "Goes in your editor's MCP config file."
+ },
+ "mcpTools": {
+ "title": "Tool surface",
+ "description": "Which tools the MCP server offers an agent. Saved to the repo's .repowise/config.yaml and applied the next time you start repowise mcp for it.",
+ "empty": "Index a repository and its tool surface shows up here.",
+ "repoLabel": "Repository",
+ "repoHint": "The surface is stored per repo.",
+ "workspaceOnly": "workspace only",
+ "summary": "{on} of {total} tools exposed. {mode}",
+ "summaryWorkspace": "Workspace mode, so workspace-only tools are available.",
+ "summarySingleRepo": "Single-repo mode, so workspace-only tools are unavailable here."
+ },
+ "provider": {
+ "title": "Model defaults",
+ "description": "Used when you trigger init or sync from this dashboard.",
+ "descriptionWithServer": "Used when you trigger init or sync from this dashboard. The server itself is currently configured with {provider}.",
+ "providerLabel": "Provider",
+ "providerAria": "Provider",
+ "modelLabel": "Model",
+ "modelHint": "Leave blank to use the provider's default.",
+ "embedderLabel": "Embedder",
+ "embedderHint": "What semantic search is built from. The mock embedder disables it.",
+ "embedderAria": "Embedder",
+ "embedderOffNote": "Semantic search is off. Set <code>REPOWISE_EMBEDDER=gemini</code> or <code>REPOWISE_EMBEDDER=openai</code> on the server for real retrieval.",
+ "embedderOnNote": "Set <code>{env}</code> on the server."
+ }
+ },
+ "repos": {
+ "addDialog": {
+ "toastStarted": "Repository added, indexing started",
+ "toastAdded": "Repository added",
+ "trigger": "Add Repository"
+ },
+ "delete": {
+ "button": "Delete Repository",
+ "toastDeleted": "Deleted {name} — {pages} pages removed",
+ "toastFailed": "Failed to delete: {error}",
+ "title": "Delete repository",
+ "aria": "Delete {name}",
+ "confirm": "This will permanently delete <repo>{name}</repo> and all its generated pages, symbols, and history.",
+ "deleting": "Deleting..."
+ },
+ "empty": {
+ "title": "No repositories yet",
+ "description": "Point repowise at a local git repository to build its index, docs, and health signals.",
+ "action": "Add repository",
+ "terminalHint": "Prefer the terminal? Run <code>repowise init</code> in a repo, or see the <link>setup guide</link>."
+ },
+ "firstIndex": {
+ "startFailed": "Couldn't start indexing",
+ "startHere": "Start here",
+ "title": "This repo hasn't been indexed yet",
+ "description": "One click builds the code index, health signals, and documentation. You can watch it happen live.",
+ "starting": "Starting…",
+ "action": "Index this repo"
+ },
+ "coordinator": {
+ "status": "Status",
+ "wikiPages": "Wiki Pages",
+ "wikiPagesHelp": "Generated wiki pages in SQL vs the matching page vectors in the vector store.",
+ "sqlVsVectors": "{sql} SQL / {vectors} vectors",
+ "pageDrift": "Page Drift",
+ "pageDriftHelp": "How far the wiki-page count disagrees with the page-vector count. 0% means every page is embedded; high drift usually means an interrupted index — run a sync to reconcile.",
+ "decisions": "Decisions",
+ "decisionsHelp": "Decision records in SQL vs the matching decision vectors. Decision vectors are counted separately from page vectors.",
+ "decisionDrift": "Decision Drift",
+ "decisionDriftHelp": "How far the decision-record count disagrees with the decision-vector count.",
+ "graphNodes": "Graph Nodes",
+ "noData": "No data — click Refresh to load.",
+ "checking": "Checking…",
+ "refresh": "Refresh"
+ },
+ "ops": {
+ "syncStarted": "Sync started — {name}",
+ "syncFailed": "Sync failed",
+ "resyncStarted": "Full resync started — {name}",
+ "resyncFailed": "Resync failed",
+ "title": "Operations",
+ "export": "Export",
+ "starting": "Starting…",
+ "sync": "Sync",
+ "resync": "Full Resync",
+ "resyncConfirm": "This regenerates every page for <repo>{name}</repo> from scratch. All existing pages will be overwritten.",
+ "resyncConfirmAction": "Resync Everything"
+ },
+ "settings": {
+ "toastSaved": "Repository settings saved",
+ "saveFailed": "Failed to save settings",
+ "regenQueued": "Wiki regeneration queued",
+ "regenFailed": "Failed to queue regeneration",
+ "regenTitle": "Regenerate the wiki now?",
+ "regenDescription": "The documentation style was changed to \"{style}\". Regenerate the whole wiki now to apply it? This runs LLM generation (a cost). You can also do it later from Sync.",
+ "regenConfirm": "Regenerate now",
+ "regenCancel": "Later"
+ }
+ },
+ "docs": {
+ "viewer": {
+ "topPercent": "Top {pct}%",
+ "centrality": "Centrality",
+ "notScored": "Not scored yet",
+ "degree": "Degree",
+ "degreeValue": "{inbound} in · {outbound} out",
+ "entryPoint": "Entry Point",
+ "community": "Community",
+ "calledBy": "Called by ({count})",
+ "calls": "Calls ({count})",
+ "hotspot": "Hotspot · top {pct}%",
+ "stable": "Stable",
+ "busFactorOne": "Bus factor 1",
+ "bugMagnetTitle": "Repeatedly bug-fixed, most recently {age}.",
+ "bugMagnet": "Bug magnet",
+ "owner": "Owner",
+ "commits90d": "Commits (90d)",
+ "bugFixes": "Bug fixes",
+ "bugFixesTitle": "Bug-fix commits that touched this file in the trailing defect window.",
+ "contributors": "Contributors",
+ "agentAuthored": "Agent-authored",
+ "renamedFrom": "Renamed from",
+ "historyCapped": "History capped during indexing, so older commits are not counted above.",
+ "signals": "Signals"
+ },
+ "explorer": {
+ "emptyTitle": "No documentation yet",
+ "emptyBody": "Run a generation job to create AI-powered documentation for this codebase.",
+ "hideTree": "Hide pages tree",
+ "showTree": "Show pages tree",
+ "askQuestion": "Explain \"{title}\" using the source code, and name the files it rests on.",
+ "askLabel": "Ask about {title}"
+ },
+ "bulk": {
+ "button": "Write subsystem pages",
+ "title": "Write the subsystem pages",
+ "writing": "Writing the subsystem pages"
+ },
+ "bulkConfirm": {
+ "description": "Write every subsystem page still generated from structure, with your configured model.",
+ "writePages": "Write {count, plural, one {# page} other {# pages}}",
+ "writeWithAi": "Write with AI"
+ },
+ "pageGenerate": {
+ "failed": "Couldn't start generation"
+ }
+ },
+ "zoom": {
+ "breadcrumb": {
+ "label": "Zoom location"
+ },
+ "hint": {
+ "scroll": "Scroll to zoom",
+ "drag": "Drag to pan",
+ "doubleClick": "Double-click a card to dive in",
+ "dismiss": "Dismiss hint"
+ },
+ "search": {
+ "placeholder": "Search files…",
+ "aria": "Search the system map",
+ "clear": "Clear search"
+ },
+ "export": {
+ "downloaded": "Downloaded {filename}",
+ "failed": "Couldn't build the Structurizr DSL",
+ "title": "Download this repository's architecture as Structurizr DSL",
+ "workspaceLabel": "Workspace (workspace.dsl)",
+ "workspaceHint": "Complete file with default views. Opens as-is in Structurizr.",
+ "fragmentLabel": "Model fragment (repowise-model.dsl)",
+ "fragmentHint": "Model block only, to !include from a workspace.dsl you already have.",
+ "building": "Building…"
+ },
+ "mapKey": {
+ "showingFiltered": "Showing <verbs>{list}</verbs> only. Arrow weight is how many file pairs the relation covers.",
+ "hoverHint": "Hover a card to see what it depends on. Arrow weight is how many file pairs the dependency covers.",
+ "unclaimed": "{shown} of {total} files are not on the map; they belong to no layer.",
+ "clear": "Clear",
+ "topRightDot": "Top-right dot",
+ "entryDotHelp": "Entry point, hotspot, dead code or on an execution flow. Hover for which.",
+ "footerDot": "Footer dot",
+ "healthBand": "Code health: {good} from {goodMin}, {fair} from {fairMin}, {needsWork} from {needsWorkMin}, {atRisk} below that."
+ },
+ "detail": {
+ "close": "Close details",
+ "healthOutOfTen": "Code health out of 10",
+ "healthOutOfTenSubtree": "Code health out of 10, averaged across this subtree weighted by size",
+ "files": "Files",
+ "hotspots": "Hotspots",
+ "entryPoints": "Entry points",
+ "onFlow": "On flow",
+ "dead": "Dead",
+ "relations": "Relations",
+ "capSuffix": "{cap} on the map.",
+ "language": "Language",
+ "zoomIn": "Zoom in",
+ "readModule": "Read the module page",
+ "openFile": "Open file page"
+ }
+ },
+ "architecture": {
+ "dependencies": {
+ "title": "External dependencies",
+ "description": "Declared third-party packages, joined to persisted import-graph evidence. Select a package to inspect declaration counts, versions, and importing files.",
+ "includeAuxiliary": "Include auxiliary declarations",
+ "loadFailed": "Couldn't load external dependencies",
+ "loading": "Loading external dependencies",
+ "auxiliaryExcluded": "{count} declarations from auxiliary directories excluded",
+ "showingAll": "Showing primary and auxiliary directories present in this indexed checkout"
+ },
+ "graph": {
+ "communitiesDescription": "Files that depend on each other more than on the rest of the repo, detected automatically. Circle size is how much code a group holds, and the nearer the centre, the nearer an entry point. Double-click a group to see the files inside it and what they depend on.",
+ "filesDescription": "Every file, grouped into the communities it depends on most, with a band for each strong link between communities. Hover or select a file to see exactly what it imports and what imports it."
+ }
+ },
+ "chat": {
+ "noProvider": "No chat provider is configured. Add an API key in <link>settings</link> to start asking questions.",
+ "noProviderShort": "No chat provider is configured. Add an API key in <link>settings</link>."
+ },
+ "codeHealth": {
+ "hotspots": {
+ "title": "Hotspots",
+ "description": "Ranked by change frequency and prior bug fixes, mined from full git history. The danger is not churn on its own. It is a file that changes constantly and only one person understands.",
+ "commitHistory": "Commit history",
+ "loadFailed": "Couldn't load hotspots. Run a sync to mine git history for this repo.",
+ "promptTitle": "AI stabilization prompt",
+ "promptDescription": "A ready-to-paste prompt that has your AI agent diagnose why this file churns and propose changes that make it cheaper to maintain."
+ }
+ },
+ "commits": {
+ "detail": {
+ "title": "Review this commit",
+ "promptLabel": "AI review prompt",
+ "promptTitle": "AI commit review",
+ "promptDescription": "A ready-to-paste prompt that has your AI agent review this commit's change-risk, flag what to scrutinize, and suggest reviewers."
+ }
+ },
+ "coupling": {
+ "loadFailed": "Couldn't load change coupling"
+ },
+ "coverage": {
+ "jobRunning": "A generation job is already running. Wait for it to finish.",
+ "regenStarted": "Regeneration started",
+ "regenFailed": "Couldn't start regeneration"
+ },
+ "decisions": {
+ "add": {
+ "trigger": "Record a decision",
+ "title": "Record a decision",
+ "description": "Something the team has settled on. Name the files it governs and it is recorded as confirmed, because you are the person confirming it."
+ },
+ "capture": {
+ "saveFailedWithMessage": "Couldn't save capture settings: {message}",
+ "saveFailed": "Couldn't save capture settings."
+ },
+ "review": {
+ "accepted": "Accepted. It governs the files it names.",
+ "dismissed": "Dismissed. Reindexing will not propose it again.",
+ "acceptFailed": "Couldn't accept: {message}",
+ "dismissFailed": "Couldn't dismiss: {message}",
+ "actionFailed": "The review action failed.",
+ "previous": "Previous",
+ "next": "Next"
+ }
+ },
+ "files": {
+ "health": {
+ "findingMarked": "Finding marked {status}",
+ "statusFailed": "Couldn't update finding status"
+ },
+ "explorer": {
+ "loadFailed": "Couldn't load the file index for this repository."
+ }
+ },
+ "health": {
+ "findingMarked": "Finding marked {status}",
+ "findingStatusFailed": "Couldn't update finding status"
+ },
+ "jobs": {
+ "completed": "Documentation updated{name}",
+ "pagesGenerated": "{count} pages generated",
+ "failed": "Generation failed",
+ "unknownError": "Unknown error",
+ "cancelled": "Job cancelled",
+ "cancelledDescription": "The pipeline was stopped before completion.",
+ "cancelFailed": "Couldn't cancel job",
+ "progressCount": "{completed}/{total} pages"
+ },
+ "overview": {
+ "ask": {
+ "placeholder": "How does the incremental pipeline decide what to re-index?",
+ "suggestion1": "How does authentication work?",
+ "suggestion2": "Where is the retry logic?",
+ "suggestion3": "Why is this module structured this way?",
+ "label": "Ask a question about this codebase",
+ "submit": "Ask"
+ }
+ },
+ "risk": {
+ "analysisTimeout": "Analysis is taking longer than expected. Reload to see the results.",
+ "syncStarted": "Sync started — findings refresh when it completes",
+ "syncFailed": "Couldn't start a sync",
+ "description": "Secrets, dangerous patterns, and policy hits detected while indexing. Findings refresh on every sync.",
+ "loadFailed": "Couldn't load findings",
+ "loadFailedBody": "The security endpoint returned an error. Try re-running ingestion.",
+ "allFindings": "All findings",
+ "findingsCount": "{count} findings",
+ "promptTitle": "AI fix prompt",
+ "promptDescription": "A ready-to-paste prompt that walks your AI agent through confirming and remediating this security finding."
+ },
+ "symbols": {
+ "clearFileFilter": "Clear file filter",
+ "fileOnly": "showing symbols in this file only"
+ },
+ "conformance": {
+ "title": "Conformance",
+ "description": "How the workspace is shaped, and whether it obeys the dependency rules you declared.",
+ "ledeLabel": "Architecture score",
+ "ledeUnit": "out of 10",
+ "ledeSeeSystemMap": "See the system map",
+ "ledeSentence": "A change here can reach {pct}% of the system through {links} structural links between {services} services. The score weighs that reach against the size of the mutually dependent core and any cycles; it is computed from the system graph on every request, so it does not depend on the check below having run.",
+ "ledeNoGraph": "No system graph has been built yet, so there is nothing to measure. Run a workspace sync to build one.",
+ "dsmTitle": "Dependency-structure matrix",
+ "dsmDescription": "Each filled cell means the row service depends on the column service, tinted by transport. Red cells break a declared rule; amber cells sit on a cycle. The matrix counts co-change relationships too, so its total runs above the structural-link figure above.",
+ "dsmSystemMapLink": "System map",
+ "violationsTitle": "Rule violations",
+ "violationsTitleCount": "Rule violations ({count})",
+ "violationsDescription": "Dependencies that exist in the graph but are forbidden by a rule you declared.",
+ "violationBreaks": "Breaks",
+ "cyclesTitle": "Dependency cycles ({count})",
+ "cyclesDescription": "Groups of services that depend on each other in a loop, so none of them can be changed or deployed independently.",
+ "cyclesDetectedNotListed": "{count, plural, one {# cycle detected, but not listed} other {# cycles detected, but not listed}}",
+ "noCyclesTitle": "No circular dependencies",
+ "cyclesUnlistedDescription": "The count is recomputed from the system graph, but the services in each cycle are recorded by the conformance check. Run it to see which services are involved.",
+ "noCyclesDescription": "Every dependency in the graph runs one way. Nothing has to be changed in lockstep.",
+ "cycleServices": "{count} services",
+ "ruleCheckedClean": "{rules, plural, one {# declared rule was} other {# declared rules were}} checked against that graph, and nothing breaks them.",
+ "ruleCheckedViolations": "{rules, plural, one {# declared rule was} other {# declared rules were}} checked against that graph, and {violations, plural, one {# dependency breaks them} other {# dependencies break them}}.",
+ "ruleNoneDeclared": "The check has run, but no dependency rules are declared, so it had nothing to enforce. Add a <c>conformance:</c> block to <f>.repowise-workspace.yaml</f> to describe which services may depend on which.",
+ "ruleNeverRan": "The conformance check has not run on this workspace yet, so nothing below is a verdict — an empty violations list here means unmeasured, not clean. Run <c>repowise workspace check</c> to evaluate it.",
+ "emptyNoRulesBrokenTitle": "No rules are broken",
+ "emptyNoRulesBrokenDescription": "Every dependency in the graph is allowed by the rules you declared.",
+ "emptyNoRulesDeclaredTitle": "No rules declared",
+ "emptyNoRulesDeclaredDescription": "Nothing has been forbidden yet, so nothing can be violated. Declare which services may depend on which under `conformance:` in .repowise-workspace.yaml, then run `repowise workspace check` to gate CI on it.",
+ "emptyNotCheckedTitle": "Not checked yet",
+ "emptyNotCheckedDescription": "The conformance analyser has not run on this workspace, so no rules have been evaluated. This is not a clean bill of health — run `repowise workspace check` to produce one.",
+ "emptyUnavailableTitle": "Conformance report unavailable",
+ "emptyUnavailableDescription": "The report could not be read. Run a workspace sync to rebuild it.",
+ "ribbon": {
+ "services": "Services",
+ "servicesSub": "repositories and their sub-packages",
+ "structuralLinks": "Structural links",
+ "structuralLinksSub": "contracts and imports, not co-changes",
+ "propagationCost": "Propagation cost",
+ "propagationCostSub": "of the system a change can reach",
+ "coreSize": "Core size",
+ "coreSizeSubPct": "{pct}% of all services",
+ "coreSizeSub": "mutually dependent centre",
+ "cycles": "Cycles",
+ "cyclesSub": "circular service dependencies"
+ },
+ "aiPrompt": {
+ "label": "Fix violations with AI",
+ "title": "AI conformance fix",
+ "description": "A ready-to-paste prompt that has your AI agent resolve these architecture rule violations by removing the disallowed dependencies."
+ }
+ },
+ "contracts": {
+ "links": {
+ "title": "Matched links",
+ "loadFailed": "The matched links could not be loaded. Reload to try again.",
+ "loading": "Loading matched links...",
+ "allExact": "All {count} are exact matches.",
+ "filteredHead": "{count, plural, one {# link matches} other {# links match}} the type, repository and search.",
+ "defaultHead": "Every provider joined to the consumer that calls it, strongest first.",
+ "description": "{head} {basis} Open a row for the provider and every caller."
+ },
+ "breaking": {
+ "title": "Breaking changes",
+ "description": "Provider contracts that changed in the most recent workspace update, and the consumers linked to them. Breaking first, then warnings."
+ },
+ "title": "Contracts",
+ "description": "Routes, tables and exports one repository publishes and another consumes.",
+ "ledeUnknown": "Unknown",
+ "ledeUnit": "provider to consumer",
+ "ledeLinkLine1": "Each link is a call site resolved to the route, table or export that serves it, in another repository or service.",
+ "ledeLinkLine2": "It is a match on the path or name, not proof both sides share a schema. Calls that matched nothing and providers nothing calls are under {attention}.",
+ "ledeNoDiagnostics": "Extraction diagnostics are not available, so the totals cannot be shown. Run a workspace sync to rebuild them.",
+ "attention": {
+ "title": "Needs attention"
+ },
+ "list": {
+ "title": "All detected contracts",
+ "description": "All {total, plural, one {# contract} other {# contracts}} detected across the workspace, {pageSize} to a page. One contract can be declared in several places, so a name may repeat.",
+ "filtered": "{total, plural, one {# contract matches these filters.} other {# contracts match these filters.}}",
+ "filteredOf": "{total, plural, one {# contract} other {# contracts}} of {workspaceTotal} match these filters.",
+ "loadFailed": "The contract list could not be loaded. The API may be restarting; reload in a moment.",
+ "pagePastEnd": "Page {page} is past the end of this list, which has {total, plural, one {# contract} other {# contracts}}. <first>Go to the first page</first>.",
+ "noMatch": "No contracts match these filters. Clear the search or a filter to widen the list.",
+ "noneDetected": "No contracts detected. They are found during a workspace sync, by reading the routes each repository serves and the calls the others make."
+ },
+ "footer": {
+ "note": "Contracts are matched on path. Two routes that share a path are one contract here, so a repository can appear against a contract it declares for its own use. <link>See how they connect</link>."
+ },
+ "ribbon": {
+ "providers": "Providers",
+ "providersSub": "routes, tables and exports published",
+ "consumers": "Consumers",
+ "consumersSub": "call sites resolved to a contract",
+ "unmatched": "Unmatched consumers",
+ "orphans": "Providers with no caller",
+ "orphansSub": "in this workspace; not the same as unused",
+ "httpResolved": "HTTP calls resolved",
+ "httpUnresolved": "{count} located but not resolvable",
+ "httpSub": "of the client calls extraction located"
+ },
+ "reasons": {
+ "no_provider": "no provider found",
+ "unlinked": "unlinked",
+ "internal_only": "internal to one service",
+ "external_host": "external host",
+ "unknown": "no reason recorded",
+ "everyMatched": "every consumer matched a provider"
+ },
+ "filters": {
+ "allTypes": "All",
+ "typeAria": "Contract type",
+ "searchLabel": "Search contracts",
+ "searchPlaceholder": "Search path, table, file, symbol or service",
+ "repoLabel": "Repository",
+ "allRepos": "All repositories",
+ "roleLabel": "Role",
+ "roleAll": "Providers and consumers",
+ "roleProviders": "Providers",
+ "roleConsumers": "Consumers",
+ "linkedLabel": "Link",
+ "linkedAll": "Linked or not",
+ "linkedYes": "On a matched link",
+ "linkedNo": "On no link",
+ "updating": "Updating..."
+ },
+ "pager": {
+ "label": "contracts"
+ },
+ "detail": {
+ "back": "Contracts",
+ "typeContract": "contract",
+ "roleProvider": "Provider",
+ "roleConsumer": "Consumer",
+ "declaredHere": "Declared here",
+ "calledHere": "Called here",
+ "declaredHereDescription": "Where this contract is declared, and how confident extraction is that this is the declaration.",
+ "calledHereDescription": "The call site, and how confident extraction is that it names this contract.",
+ "fact": {
+ "repository": "Repository",
+ "file": "File",
+ "service": "Service",
+ "symbol": "Symbol",
+ "confidence": "Confidence",
+ "contractId": "Contract id",
+ "detail": "Detail"
+ },
+ "symbolNone": "None recorded",
+ "howFound": "How it was found",
+ "howFoundDescription": "What the extractor recorded about this contract. The layer is the part worth reading: an index contract came from the parsed symbol table, a regex one from a text dialect, which is where recall is least certain.",
+ "extractorNone": "The extractor recorded none.",
+ "noCallerFound": "No caller found",
+ "callers": "Callers",
+ "servedBy": "Served by",
+ "servedByDescription": "This call resolves to the code that serves it. A match joins a call site to a declaration; it does not mean the two were written against a shared schema.",
+ "caption": {
+ "providersServing": "Providers serving this call",
+ "callSites": "Call sites resolving here"
+ },
+ "col": {
+ "match": "Match"
+ },
+ "reasonTitle": {
+ "no_provider": "No provider found",
+ "unlinked": "No link formed",
+ "internal_only": "Not a cross-repo link",
+ "external_host": "Outside this workspace",
+ "unknown": "No provider found"
+ },
+ "prose": {
+ "unlinkedProviderWithService": "Nothing in this workspace resolves to this contract. It may be called from outside the workspace, or by code extraction cannot follow, and a call from inside {repo}/{service} is excluded by construction. Neither reading makes it dead code.",
+ "unlinkedProvider": "Nothing in this workspace resolves to this contract. It may be called from outside the workspace, or by code extraction cannot follow, and a call from elsewhere in {repo} that also sits outside any service is excluded by construction. Neither reading makes it dead code.",
+ "linkedFromOne": "{calls, plural, one {# call site resolves} other {# call sites resolve}} to this contract, from a different service inside {repo}.",
+ "linkedAllFromOne": "{calls, plural, one {# call site resolves} other {# call sites resolve}} to this contract, all from a different service inside {repo}.",
+ "linkedAcross": "{calls, plural, one {# call site resolves} other {# call sites resolve}} to this contract across {repos, plural, one {# repository} other {# repositories}}.",
+ "unmatchedExternalHost": "This call goes to {host}, which is not a service in this workspace. Calls to a literal external host are left out of matching on purpose, so there is nothing to link. If {host} is one of your own services, add its repository to the workspace.",
+ "unmatchedExternalHostGeneric": "This call goes to a third-party host, which is not a service in this workspace. Calls to a literal external host are left out of matching on purpose, so there is nothing to link. If that host is one of your own services, add its repository to the workspace.",
+ "unmatchedInternalOnly": "The only declarations matching this call live in the same repository and the same service as the call itself, so it never crosses a boundary. Intra-service calls are left out of the link set on purpose: a link is a claim that two services depend on each other.",
+ "unmatchedNoProvider": "Nothing in this workspace declares {contract}. Check for a typo in the path, an endpoint that was renamed or removed, a service outside these repositories, or a route declared in a form extraction does not recognise.",
+ "unmatchedUnlinked": "A declaration with this id exists in another service, but no link was formed between the two. That is rare, and it points at a gap in the matcher rather than at the code.",
+ "unmatchedDefault": "This call matched no declaration, and no reason was recorded for it. Reasons come from the system graph, so a workspace that has not built one reports the count without the explanation."
+ },
+ "shape": "Shape",
+ "shapeEmptyFields": "The reader produced a shape with no fields in it.",
+ "schema": {
+ "recovered": "Recovered by the {source} reader.",
+ "withResponse": "{head} Fields are what the declaration names, not what any one caller passes.",
+ "signature": "{head} It reads a declaration's parameters and stops there, so there is no return shape below; a response would have to come from an OpenAPI or proto declaration.",
+ "noReturn": "{head} It recovered no return shape for this contract.",
+ "dataTable": "A table contract carries no field shape. It is matched on the table name, and nothing on that path reads a column list, so this section is empty for every table contract rather than for this one in particular.",
+ "noReader": "No reader recovered a shape for this contract. A shape comes off a typed declaration, so an untyped signature, a route declared through a decorator alone, or a file the index never parsed all arrive here without one."
+ },
+ "field": {
+ "request": "Request",
+ "response": "Response",
+ "field": "Field",
+ "type": "Type",
+ "required": "Required"
+ },
+ "line": "line {line}"
+ }
+ },
+ "coChanges": {
+ "title": "Co-changes",
+ "description": "Files in different repositories that recent commits touched together.",
+ "emptyTitle": "No cross-repo co-changes found",
+ "emptyDescription": "Co-changes are mined from each repository's git history during a workspace sync. Pairs appear once commits close together in time touch files in two repositories.",
+ "ledeLabel": "File pairs",
+ "ledeUnitFound": "found",
+ "ledeUnitOfFound": "of {total} found",
+ "ledeSentence": "Files in two repositories that the same author keeps changing in the same work sessions: a pattern read from git history, not a declared dependency.",
+ "ribbon": {
+ "repoPairs": "Repository pairs",
+ "repoPairsSub": "with shared work sessions",
+ "strongest": "Strongest pair",
+ "strongestSub": "by its strongest file pair",
+ "peakStrength": "Peak strength",
+ "peakStrengthSub": "the single strongest file pair",
+ "sessionsPerPair": "Sessions per pair",
+ "sessionsPerPairSub": "shared work sessions per file pair",
+ "sessionsRange": "{min} to {max}",
+ "mostRecent": "Most recent",
+ "mostRecentSub": "last shared session"
+ },
+ "pairs": {
+ "title": "Repository pairs",
+ "descriptionRanked": "Ranked by their strongest file pair.",
+ "descriptionCapped": "Ranked by their strongest file pair. File pairs stop at {cap} per repository pair because the miner keeps no more."
+ },
+ "files": {
+ "titleAll": "Files that change together",
+ "titleScoped": "Files in {repo1} and {repo2}",
+ "filterLabel": "Filter by file path",
+ "searchPlaceholder": "What changes with this file? Type a path",
+ "clearPair": "Show all repository pairs",
+ "emptyTitle": "No file pairs match",
+ "emptyDescription": "No listed pair touches a path containing \"{query}\". Only the {count} strongest pairs are listed, so a weaker partner may exist that is not shown."
+ },
+ "scope": {
+ "filteredInPair": "{rows} of {scope} pairs in {repo1} and {repo2} touch a path matching \"{query}\", strongest first.",
+ "filtered": "{rows} of {scope} pairs touch a path matching \"{query}\", strongest first.",
+ "selected": "{rows} file pairs in {repo1} and {repo2}, strongest first.",
+ "all": "{rows} of {total} pairs, strongest first.",
+ "capped": " {rule}, so {dropped} weaker pairs across the workspace are not listed.",
+ "rulePerPair": "the miner keeps the strongest {cap} for each repository pair",
+ "ruleTotal": "the miner keeps the strongest {cap} across the workspace",
+ "ruleTotalWithPerPair": "the miner keeps the strongest {cap} across the workspace, and at most {perPair} for any one repository pair",
+ "ruleUnknown": "the miner keeps only the strongest"
+ },
+ "reason": {
+ "repoNotIndexed": "Repository not indexed, so no history",
+ "historyFailed": "History failed to load",
+ "noGitHistory": "No git history indexed for this file",
+ "linksFailed": "Contract links failed to load, so this pair was not checked."
+ },
+ "prompt": {
+ "title": "AI co-change prompt",
+ "descriptionRepo": "A ready-to-paste prompt that has your agent group this repository pair's co-changing files by the concept they share and decide which lockstep a contract, shared type or generated client should replace.",
+ "descriptionFile": "A ready-to-paste prompt that has your agent find why these two files change together and whether a contract, shared type or generated client should replace the manual lockstep."
+ }
+ },
+ "systemMap": {
+ "title": "System map",
+ "description": "Services and the typed relationships between them, rebuilt from code and git history on every workspace update.",
+ "section": {
+ "title": "Services and relationships",
+ "description": "Each box is a service; each line is a contract, import or co-change between two of them. Pick a lens to ask the map one question at a time."
+ },
+ "lede": {
+ "label": "Architecture score",
+ "labelHint": "A 1 to 10 roll-up of propagation cost, the size of the cyclic core, dependency cycles and rule violations, over structural edges only. Higher means less coupled.",
+ "unit": "out of 10",
+ "counts": "{services, plural, one {# service} other {# services}} in {repos, plural, one {# repository} other {# repositories}}, joined by {relationships, plural, one {# relationship} other {# relationships}}: {structural} structural (a contract or import in code) and {behavioral} co-change (files that change in the same commits, not a call).",
+ "cycleMore": "{count, plural, one {# more cycle is} other {# more cycles are}} listed under Needs attention.",
+ "cycleOne": "It is listed under Needs attention with a prompt to break it.",
+ "noCycles": "No dependency cycles: every service can change without a loop back to itself.",
+ "reachAndScore": "On average a service reaches {pct}% of the others through dependencies, and {core}. Those two figures drive the score.",
+ "coreForms": "{count, plural, one {# service forms} other {# services form}} the cyclic core",
+ "noCore": "there is no cyclic core",
+ "cycleDepend": "{names} depend on each other",
+ "cycleTail": ", a dependency cycle: none of them can change a contract, build or deploy alone."
+ },
+ "lens": {
+ "none": {
+ "label": "None",
+ "hint": "The map as extracted, no lens"
+ },
+ "blast": {
+ "label": "Blast radius",
+ "hint": "What depends on one service, directly or through others",
+ "disabled": "No relationships to trace yet."
+ },
+ "breaking": {
+ "label": "Breaking changes",
+ "disabledFailed": "Could not load the breaking-change report.",
+ "disabledLoading": "Loading the breaking-change report.",
+ "disabledNotRun": "Breaking-change detection has not run. Run a workspace update.",
+ "disabledNone": "No provider contract changed incompatibly in the most recent update."
+ },
+ "conformance": {
+ "label": "Conformance",
+ "hint": "Rule violations and dependency cycles",
+ "disabledFailed": "Could not load the conformance report.",
+ "disabledLoading": "Loading the conformance report.",
+ "disabledNotRun": "Conformance has not been checked. Run a workspace update.",
+ "disabledNone": "No rule violations or dependency cycles."
+ },
+ "core": {
+ "label": "Core",
+ "hint": "The largest group of services that all depend on each other, and every service's role",
+ "disabledFailed": "Could not load the architecture metrics.",
+ "disabledLoading": "Loading architecture metrics.",
+ "disabledNone": "No services to classify."
+ }
+ },
+ "ribbon": {
+ "services": "Services",
+ "servicesSub": "in {count, plural, one {# repository} other {# repositories}}",
+ "relationships": "Relationships",
+ "relationshipsSub": "{structural} structural, {behavioral} co-change",
+ "propagationCost": "Propagation cost",
+ "propagationCostSub": "of other services the average one reaches",
+ "propagationCostHint": "The share of other services the average service can reach through structural dependencies. 0% is fully decoupled, 100% is everything reaching everything.",
+ "contractLinks": "Contract links",
+ "contractLinksSub": "from {providers} providers, {consumers} consumers",
+ "contractLinksHint": "Consumer calls matched to the provider that serves them, across services.",
+ "unmatched": "Unmatched consumers",
+ "unmatchedSub": "calls with no provider in the workspace",
+ "unmatchedHint": "Consumer contracts that matched no provider: missing, a third-party host, or inside the same service."
+ }
+ },
+ "loading": {
+ "repo": "Loading",
+ "architecture": "Loading architecture",
+ "commits": "Loading commits",
+ "coverage": "Loading coverage",
+ "knowledgeGraph": "Loading knowledge graph"
+ }
+}
diff --git a/packages/web/next.config.ts b/packages/web/next.config.ts
index c0c3cda4b..d48f2704b 100644
--- a/packages/web/next.config.ts
+++ b/packages/web/next.config.ts
@@ -1,5 +1,11 @@
import path from "path";
import type { NextConfig } from "next";
+import createNextIntlPlugin from "next-intl/plugin";
+
+// i18n. The request config resolves the locale from the `NEXT_LOCALE` cookie
+// on every request; there is deliberately no `/{locale}/...` prefix routing, so
+// existing links, bookmarks and uptime probes keep resolving unchanged.
+const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
const nextConfig: NextConfig = {
output: "standalone",
@@ -28,4 +34,4 @@ const nextConfig: NextConfig = {
},
};
-export default nextConfig;
+export default withNextIntl(nextConfig);
diff --git a/packages/web/package.json b/packages/web/package.json
index 44b1be0e1..25ab43c2d 100644
--- a/packages/web/package.json
+++ b/packages/web/package.json
@@ -9,6 +9,10 @@
"start": "next start --port 3000",
"lint": "next lint",
"type-check": "tsc --noEmit",
+ "i18n:check": "node scripts/check-i18n-keys.mjs",
+ "i18n:icu": "node scripts/check-i18n-icu.mjs",
+ "i18n:usage": "node scripts/check-i18n-usage.mjs",
+ "i18n:todo": "node scripts/find-untranslated.mjs",
"test": "vitest run"
},
"dependencies": {
@@ -22,6 +26,7 @@
"geist": "^1.3.0",
"lucide-react": "^0.460.0",
"next": "~15.5.24",
+ "next-intl": "^4.14.6",
"next-mdx-remote": "^6.0.0",
"next-themes": "^0.4.6",
"nuqs": "^2.2.0",
diff --git a/packages/web/scripts/check-i18n-icu.mjs b/packages/web/scripts/check-i18n-icu.mjs
new file mode 100644
index 000000000..c43d21ad3
--- /dev/null
+++ b/packages/web/scripts/check-i18n-icu.mjs
@@ -0,0 +1,74 @@
+#!/usr/bin/env node
+/**
+ * ICU static check for the Web UI message catalogs.
+ *
+ * next-intl parses messages with ICU MessageFormat at render time, so a
+ * malformed plural or a stray brace only shows up as a runtime throw on the
+ * page that renders it. This script compiles every leaf message in
+ * messages/*.json up front, and prints the exact key when one fails.
+ *
+ * Usage: node scripts/check-i18n-icu.mjs
+ * Exit: 0 when every message compiles, 1 with the offending keys otherwise.
+ */
+
+import { readFileSync, readdirSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import path from "node:path";
+import { createRequire } from "node:module";
+
+const require = createRequire(import.meta.url);
+let IntlMessageFormat;
+try {
+ ({ default: IntlMessageFormat } = require("intl-messageformat"));
+} catch {
+ ({ IntlMessageFormat } = require("@formatjs/intl-messageformat"));
+}
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const messagesDir = path.resolve(here, "../messages");
+
+/** Locales ICU has to know about for `{n, plural}` to compile. */
+const LOCALE_FOR = { en: "en", "zh-CN": "zh-CN" };
+
+function flatten(value, prefix = "", out = []) {
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
+ out.push([prefix, value]);
+ return out;
+ }
+ for (const [key, child] of Object.entries(value)) {
+ flatten(child, prefix ? `${prefix}.${key}` : key, out);
+ }
+ return out;
+}
+
+let failed = false;
+
+for (const file of readdirSync(messagesDir).filter((f) => f.endsWith(".json")).sort()) {
+ const locale = LOCALE_FOR[file.replace(/\.json$/, "")] ?? "en";
+ const parsed = JSON.parse(readFileSync(path.join(messagesDir, file), "utf8"));
+ let checked = 0;
+ const errors = [];
+
+ for (const [key, value] of flatten(parsed)) {
+ if (typeof value !== "string") continue;
+ checked += 1;
+ try {
+ new IntlMessageFormat(value, locale);
+ } catch (error) {
+ errors.push(`${key}: ${error.message}`);
+ }
+ }
+
+ if (errors.length === 0) {
+ console.log(`✔ ${file}: ${checked} messages compile`);
+ continue;
+ }
+ failed = true;
+ console.error(`✖ ${file}: ${errors.length} message(s) fail to compile`);
+ for (const error of errors) console.error(` ${error}`);
+}
+
+if (failed) {
+ console.error("\nMalformed ICU in the message catalogs.");
+ process.exit(1);
+}
diff --git a/packages/web/scripts/check-i18n-keys.mjs b/packages/web/scripts/check-i18n-keys.mjs
new file mode 100644
index 000000000..feb05fd22
--- /dev/null
+++ b/packages/web/scripts/check-i18n-keys.mjs
@@ -0,0 +1,88 @@
+#!/usr/bin/env node
+/**
+ * Catalog freshness report for the Web UI message catalogs.
+ *
+ * English (`messages/en.json`) is the source of truth. A locale catalog may
+ * lag behind it: a key the translator has not reached yet still renders the
+ * English string at runtime (see `src/i18n/request.ts`), so a gap is a
+ * warning, not a failure. This script prints those gaps so they are visible
+ * instead of silent, and still exits 0 — UI copy can change without every
+ * locale being updated in the same commit.
+ *
+ * Orphaned keys (a locale carries a key `en.json` does not) are always
+ * reported: they are dead weight or a typo, and would never render.
+ *
+ * Usage: node scripts/check-i18n-keys.mjs
+ * Exit: 0 always (warnings on stderr), 1 only when a catalog is not valid
+ * JSON or `en.json` itself is missing.
+ */
+
+import { readFileSync, readdirSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import path from "node:path";
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const messagesDir = path.resolve(here, "../messages");
+const baseFile = "en.json";
+
+/** Flatten nested message objects into dotted key paths (leaves only). */
+function flatten(value, prefix = "") {
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
+ return [prefix];
+ }
+ return Object.entries(value).flatMap(([key, child]) =>
+ flatten(child, prefix ? `${prefix}.${key}` : key),
+ );
+}
+
+function load(file) {
+ const raw = readFileSync(path.join(messagesDir, file), "utf8");
+ let parsed;
+ try {
+ parsed = JSON.parse(raw);
+ } catch (error) {
+ console.error(`✖ ${file} is not valid JSON: ${error.message}`);
+ process.exit(1);
+ }
+ return new Set(flatten(parsed));
+}
+
+const base = load(baseFile);
+const locales = readdirSync(messagesDir)
+ .filter((f) => f.endsWith(".json") && f !== baseFile)
+ .sort();
+
+if (locales.length === 0) {
+ console.log(`✔ ${baseFile}: ${base.size} keys (no locale catalogs to compare).`);
+ process.exit(0);
+}
+
+let warned = false;
+
+for (const file of locales) {
+ const keys = load(file);
+ const missing = [...base].filter((k) => !keys.has(k)).sort();
+ const orphaned = [...keys].filter((k) => !base.has(k)).sort();
+
+ if (missing.length === 0 && orphaned.length === 0) {
+ console.log(`✔ ${file}: ${keys.size} keys, identical to ${baseFile}`);
+ continue;
+ }
+
+ warned = true;
+ console.warn(`⚠ ${file}: ${missing.length} missing, ${orphaned.length} orphaned`);
+ for (const key of missing) {
+ console.warn(` missing ${key} (falls back to ${baseFile})`);
+ }
+ for (const key of orphaned) {
+ console.warn(` orphaned ${key} (never renders — remove or add to ${baseFile})`);
+ }
+}
+
+if (warned) {
+ console.warn(
+ `\ni18n catalogs differ from ${baseFile} — warnings only; missing keys render English.`,
+ );
+} else {
+ console.log(`\n${baseFile} and ${locales.length} locale(s) agree: ${base.size} keys.`);
+}
diff --git a/packages/web/scripts/check-i18n-usage.mjs b/packages/web/scripts/check-i18n-usage.mjs
new file mode 100644
index 000000000..ea153a318
--- /dev/null
+++ b/packages/web/scripts/check-i18n-usage.mjs
@@ -0,0 +1,134 @@
+#!/usr/bin/env node
+/**
+ * Usage check for the Web UI message catalogs — the gate that would have caught
+ * the `MISSING_MESSAGE` storm this branch shipped before it was fixed.
+ *
+ * Background (2026-09-24, task t_cabc4827): 487 of the 881 keys had been added
+ * as *flat* names inside a namespace —
+ *
+ * "shell": { "feedback.title": "Help us improve Repowise" }
+ *
+ * next-intl resolves `useTranslations("shell") + t("feedback.title")` as the
+ * nested path shell.feedback.title, so those keys never resolved: the server
+ * logged `MISSING_MESSAGE: shell.feedback.title (en)` and the raw key path was
+ * rendered as visible text. Key parity (i18n:check) and the untranslated-string
+ * scanner (i18n:todo) both pass on such a catalog — parity compares key sets,
+ * the scanner reads source code — so neither could see it. This script closes
+ * that hole:
+ *
+ * 1. structure — no key *name* may contain a dot; keys must nest.
+ * 2. resolution — every literal key passed to a `t("...")` / `t.rich("...")`
+ * call in a file must resolve under one of the namespaces that file
+ * declares via useTranslations()/getTranslations().
+ *
+ * Usage: node scripts/check-i18n-usage.mjs
+ * Exit: 0 when the catalogs are well formed and every checked call resolves.
+ */
+import { readFileSync, readdirSync, statSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import path from "node:path";
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const webRoot = path.resolve(here, "..");
+const srcRoot = path.join(webRoot, "src");
+
+/** Flatten nested message objects into dotted key paths (leaves only). */
+function flatten(value, prefix = "") {
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
+ return [prefix];
+ }
+ return Object.entries(value).flatMap(([key, child]) =>
+ flatten(child, prefix ? `${prefix}.${key}` : key),
+ );
+}
+
+/** Key *names* that contain a dot — the shape that breaks next-intl lookup. */
+function dottedNames(value, prefix = "") {
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
+ return [];
+ }
+ return Object.entries(value).flatMap(([key, child]) => {
+ const here = prefix ? `${prefix}.${key}` : key;
+ const own = key.includes(".") ? [here] : [];
+ return own.concat(dottedNames(child, here));
+ });
+}
+
+function walk(dir) {
+ return readdirSync(dir).flatMap((entry) => {
+ const full = path.join(dir, entry);
+ return statSync(full).isDirectory()
+ ? walk(full)
+ : /\.(ts|tsx)$/.test(entry)
+ ? [full]
+ : [];
+ });
+}
+
+const catalog = JSON.parse(
+ readFileSync(path.join(webRoot, "messages", "en.json"), "utf8"),
+);
+const keys = new Set(flatten(catalog));
+
+let failed = false;
+
+const dotted = dottedNames(catalog);
+if (dotted.length > 0) {
+ failed = true;
+ console.error(
+ `✖ messages/en.json: ${dotted.length} key name(s) contain a dot ` +
+ `(next-intl resolves dots as path separators, so these never resolve):`,
+ );
+ for (const k of dotted.slice(0, 20)) console.error(` ${k}`);
+ if (dotted.length > 20) console.error(` … and ${dotted.length - 20} more`);
+}
+
+const DECL =
+ /(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:await\s+)?(?:useTranslations|getTranslations)\(\s*"([^"]+)"\s*\)/g;
+
+let filesChecked = 0;
+let callsChecked = 0;
+const problems = [];
+
+for (const file of walk(srcRoot)) {
+ if (/\.(test|spec)\.tsx?$/.test(file)) continue;
+ const source = readFileSync(file, "utf8");
+ const spaces = [...source.matchAll(DECL)].map((m) => m[2]);
+ if (spaces.length === 0) continue; // keys arrive via props/children — skipped
+ filesChecked += 1;
+
+ const rel = path.relative(webRoot, file);
+ const CALL = /([A-Za-z_$][\w$]*)(?:\.(?:rich|markup|raw))?\(\s*"([^"]+)"/g;
+ const declared = new Set([...source.matchAll(DECL)].map((m) => m[1]));
+ for (const m of source.matchAll(CALL)) {
+ const [, variable, key] = m;
+ if (!declared.has(variable)) continue; // not a translator receiver
+ callsChecked += 1;
+ const ok = spaces.some((ns) => keys.has(`${ns}.${key}`));
+ if (!ok) {
+ problems.push(
+ `${rel}: ${variable}("${key}") resolves under none of ` +
+ `[${spaces.join(", ")}]`,
+ );
+ }
+ }
+}
+
+if (problems.length > 0) {
+ failed = true;
+ console.error(
+ `✖ ${problems.length} message key(s) used in code do not resolve in en.json:`,
+ );
+ for (const p of problems.slice(0, 40)) console.error(` ${p}`);
+ if (problems.length > 40) console.error(` … and ${problems.length - 40} more`);
+}
+
+if (failed) {
+ console.error("\ni18n usage check failed.");
+ process.exit(1);
+}
+
+console.log(
+ `✔ messages/en.json: ${keys.size} keys, no dotted key names\n` +
+ `✔ ${callsChecked} literal t()/t.rich() calls in ${filesChecked} file(s) all resolve`,
+);
diff --git a/packages/web/scripts/find-untranslated.mjs b/packages/web/scripts/find-untranslated.mjs
new file mode 100644
index 000000000..49d300b60
--- /dev/null
+++ b/packages/web/scripts/find-untranslated.mjs
@@ -0,0 +1,616 @@
+#!/usr/bin/env node
+/**
+ * Untranslated-string detector for the Repowise Web UI.
+ *
+ * Reports user-visible copy that is still hard-coded in the tsx files under
+ * src/ instead of coming from the message catalogs. It is a linter, not a
+ * translator: it never edits files, it prints a list.
+ *
+ * npm run i18n:todo # full baseline, grouped by file
+ * npm run i18n:todo -- src/components # scope to a directory
+ * npm run i18n:todo -- --json # machine-readable, for follow-up cards
+ * npm run i18n:todo -- --strict # exit 1 when anything is untranslated
+ *
+ * What counts as untranslated (see I18N.md, "Finding untranslated copy"):
+ * - JSX text nodes <span>Save changes</span>
+ * - JSX attribute strings placeholder="Search", aria-label="Close",
+ * title="...", alt="...", label="..."
+ * - user-facing string exits toast.*("..."), confirm("..."), alert("..."),
+ * window.prompt("..."), new Error("...")
+ *
+ * Deliberately not reported: className / data-* / key / id, imports and types,
+ * comments, test files, the contents of <code>, <pre>, <kbd> and <samp>, URLs,
+ * paths, identifiers, and every string listed in
+ * i18n-untranslated-allowlist.json.
+ *
+ * Exit: 0 = list produced, 1 = --strict and something is untranslated,
+ * 2 = usage or configuration error.
+ */
+
+import { createRequire } from "node:module";
+import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import path from "node:path";
+
+const require = createRequire(import.meta.url);
+let ts;
+try {
+ ts = require("typescript");
+} catch {
+ console.error(
+ "cannot resolve 'typescript' - run `npm install` at the repo root first.",
+ );
+ process.exit(2);
+}
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const PACKAGE_ROOT = path.resolve(HERE, "..");
+const SRC_ROOT = path.join(PACKAGE_ROOT, "src");
+const DEFAULT_ALLOWLIST = path.join(
+ PACKAGE_ROOT,
+ "i18n-untranslated-allowlist.json",
+);
+
+/** JSX attributes whose string value is user-visible copy. */
+const JSX_TEXT_ATTRIBUTES = new Set([
+ "placeholder",
+ "aria-label",
+ "aria-placeholder",
+ "aria-description",
+ "title",
+ "alt",
+ "label",
+ "hint",
+ "description",
+]);
+
+/** Element contents that are code, not prose. */
+const NON_PROSE_TAGS = new Set(["code", "pre", "kbd", "samp", "script", "style"]);
+
+/** Object keys of a toast options bag that carry copy. */
+const TOAST_OPTION_KEYS = new Set(["description", "title", "label"]);
+
+const ERROR_CONSTRUCTORS = new Set(["Error"]);
+const WINDOW_DIALOGS = new Set(["confirm", "alert", "prompt"]);
+
+// ---------------------------------------------------------------------------
+// text helpers
+// ---------------------------------------------------------------------------
+
+const ENTITIES = {
+ amp: "&",
+ lt: "<",
+ gt: ">",
+ quot: '"',
+ apos: "'",
+ nbsp: " ",
+ hellip: "\u2026",
+ mdash: "\u2014",
+ ndash: "\u2013",
+ rarr: "\u2192",
+ larr: "\u2190",
+ times: "\u00d7",
+ check: "\u2713",
+ middot: "\u00b7",
+};
+
+function decodeEntities(raw) {
+ return raw.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (whole, body) => {
+ if (body.startsWith("#")) {
+ const hex = body[1] === "x" || body[1] === "X";
+ const code = Number.parseInt(hex ? body.slice(2) : body.slice(1), hex ? 16 : 10);
+ return Number.isFinite(code) ? String.fromCodePoint(code) : whole;
+ }
+ const named = ENTITIES[body];
+ return named === undefined ? whole : named;
+ });
+}
+
+/** JSX text nodes carry their own indentation and newlines - flatten them. */
+function normalizeText(raw) {
+ return decodeEntities(raw).replace(/\s+/g, " ").trim();
+}
+
+const CJK = /[\u3000-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/;
+
+/** Technical tokens: never translated, and never worth an allowlist entry. */
+const TECHNICAL = [
+ /^(https?:\/\/|mailto:|www\.)/i, // URLs
+ /^[^\s@]+@[^\s@]+\.[^\s@]+$/, // emails
+ /^[a-z][a-z0-9+.-]*\/[a-z0-9+.-]+$/i, // mime types
+ /^[./~]/, // absolute / relative paths
+ /^[A-Za-z0-9_@*-]+(\/[A-Za-z0-9_@*-]+)+$/, // a/b/c, src/**/*
+ /^[A-Za-z0-9]+([_.:-][A-Za-z0-9]+)+$/, // dotted, snake, kebab, scoped
+ /^\.[a-z0-9]+$/i, // .tsx
+ /^v?\d+(\.\d+)+$/i, // 1.2.3
+ /^[A-Z][A-Z0-9_]{2,}=/, // ENV_VAR=value snippets
+ /^\d+(\.\d+)?\s*(px|rem|em|ms|s|%|kb|mb|gb|tb|d|h|m)$/i, // 24px, 3s
+ /^[#@][A-Za-z0-9_-]+$/, // #123, @user
+];
+
+/**
+ * Returns the copy to report, or null when the string is not translatable
+ * prose. `minLength` is the configurable floor for JSX text nodes.
+ */
+function translatable(raw, minLength) {
+ const text = normalizeText(raw);
+ if (!text) return null;
+ if (text.length < minLength) return null;
+ if (!/[A-Za-z]/.test(text)) return null; // no latin letters: symbols, digits
+ if (CJK.test(text)) return null; // already Chinese/Japanese copy
+ for (const pattern of TECHNICAL) {
+ if (pattern.test(text)) return null;
+ }
+ return text;
+}
+
+// ---------------------------------------------------------------------------
+// allowlist
+// ---------------------------------------------------------------------------
+
+const ALLOWLIST_HELP =
+ "i18n-untranslated-allowlist.json: {\"entries\": [{\"value\": \"Repowise\", \"reason\": \"product name\"}]}. Every entry needs a value and a short reason; optional \"match\": \"regex\".";
+
+function loadAllowlist(file) {
+ if (!existsSync(file)) {
+ console.warn(`! no allowlist at ${path.relative(PACKAGE_ROOT, file)} - every hit is reported.`);
+ return { exact: new Map(), regex: [], entries: 0 };
+ }
+
+ let parsed;
+ try {
+ parsed = JSON.parse(readFileSync(file, "utf8"));
+ } catch (error) {
+ console.error(`✖ allowlist is not valid JSON: ${error.message}`);
+ process.exit(2);
+ }
+
+ const entries = Array.isArray(parsed) ? parsed : parsed?.entries;
+ if (!Array.isArray(entries)) {
+ console.error(`✖ allowlist has no "entries" array.\n ${ALLOWLIST_HELP}`);
+ process.exit(2);
+ }
+
+ const exact = new Map();
+ const regex = [];
+ entries.forEach((entry, index) => {
+ const where = `entries[${index}]`;
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
+ console.error(`✖ ${where} is not an object.\n ${ALLOWLIST_HELP}`);
+ process.exit(2);
+ }
+ const { value, reason, match = "exact" } = entry;
+ if (typeof value !== "string" || value.trim() === "") {
+ console.error(`✖ ${where} has no "value".\n ${ALLOWLIST_HELP}`);
+ process.exit(2);
+ }
+ if (typeof reason !== "string" || reason.trim().length < 8) {
+ console.error(
+ `✖ ${where} ("${value}") needs a real "reason" - a short audit note, not a shrug.\n ${ALLOWLIST_HELP}`,
+ );
+ process.exit(2);
+ }
+ if (match === "exact") {
+ if (exact.has(value)) {
+ console.warn(`! allowlist entry "${value}" is duplicated; keeping the first reason.`);
+ } else {
+ exact.set(value, reason);
+ }
+ } else if (match === "regex") {
+ try {
+ regex.push({ pattern: new RegExp(value, "u"), source: value, reason, hits: 0 });
+ } catch (error) {
+ console.error(`✖ ${where} ("${value}") is not a valid regex: ${error.message}`);
+ process.exit(2);
+ }
+ } else {
+ console.error(`✖ ${where} has match="${match}" - use "exact" or "regex".`);
+ process.exit(2);
+ }
+ });
+
+ return { exact, regex, entries: entries.length };
+}
+
+/** Returns the audit reason when the string is allowlisted, else null. */
+function allowlistReason(allowlist, text) {
+ const direct = allowlist.exact.get(text);
+ if (direct) return direct;
+ for (const rule of allowlist.regex) {
+ if (rule.pattern.test(text)) {
+ rule.hits += 1;
+ return rule.reason;
+ }
+ }
+ return null;
+}
+
+// ---------------------------------------------------------------------------
+// JSX / call-site extraction
+// ---------------------------------------------------------------------------
+
+function tagNameText(name) {
+ if (ts.isIdentifier(name)) return name.text;
+ return name.getText();
+}
+
+function rootIdentifier(node) {
+ let current = node;
+ while (ts.isPropertyAccessExpression(current) || ts.isElementAccessExpression(current)) {
+ current = current.expression;
+ }
+ return ts.isIdentifier(current) ? current.text : null;
+}
+
+/**
+ * String literals reachable from a JSX attribute value or call argument:
+ * "copy", {"copy"}, {cond ? "a" : "b"}, `copy`, `copy ${x}`.
+ */
+function literalParts(expression) {
+ if (!expression) return [];
+ if (ts.isParenthesizedExpression(expression)) return literalParts(expression.expression);
+ if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression)) {
+ return [{ copy: expression.text, node: expression }];
+ }
+ if (ts.isTemplateExpression(expression)) {
+ const copy = expression.templateSpans.reduce(
+ (acc, span) => `${acc}{…}${span.literal.text}`,
+ expression.head.text,
+ );
+ return [{ copy, node: expression }];
+ }
+ if (ts.isConditionalExpression(expression)) {
+ return [...literalParts(expression.whenTrue), ...literalParts(expression.whenFalse)];
+ }
+ if (ts.isJsxExpression(expression)) return literalParts(expression.expression);
+ return [];
+}
+
+function stringExitDetail(node) {
+ const callee = node.expression;
+ if (ts.isIdentifier(callee)) {
+ if (callee.text === "toast" || WINDOW_DIALOGS.has(callee.text)) {
+ return `call:${callee.text}`;
+ }
+ return null;
+ }
+ if (!ts.isPropertyAccessExpression(callee)) return null;
+ const root = rootIdentifier(callee);
+ if (root === "toast") return "call:toast";
+ if ((root === "window" || root === "globalThis") && WINDOW_DIALOGS.has(callee.name.text)) {
+ return `call:window.${callee.name.text}`;
+ }
+ return null;
+}
+// ---------------------------------------------------------------------------
+// scanning
+// ---------------------------------------------------------------------------
+
+const TEST_FILE = /\.(test|spec|stories)\.tsx$/;
+
+function isTestPath(relative) {
+ return TEST_FILE.test(relative) || /(^|\/)(__tests__|__mocks__)\//.test(relative);
+}
+
+function collectTsx(dir, out = []) {
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ if (entry.name === "node_modules" || entry.name === ".next") continue;
+ const full = path.join(dir, entry.name);
+ if (entry.isDirectory()) {
+ collectTsx(full, out);
+ continue;
+ }
+ if (!entry.name.endsWith(".tsx")) continue;
+ if (isTestPath(path.relative(PACKAGE_ROOT, full))) continue;
+ out.push(full);
+ }
+ return out;
+}
+
+function collectHits(file, source, allowlist, options) {
+ const sourceFile = ts.createSourceFile(
+ file,
+ source,
+ ts.ScriptTarget.Latest,
+ true,
+ ts.ScriptKind.TSX,
+ );
+ const found = [];
+ const allowed = [];
+ const seen = new Set();
+
+ const push = (node, kind, detail, raw) => {
+ const text = translatable(raw, options.minLength);
+ if (!text) return;
+ const pos = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
+ const entry = {
+ file: path.relative(PACKAGE_ROOT, file),
+ line: pos.line + 1,
+ column: pos.character + 1,
+ kind,
+ detail,
+ text,
+ };
+ const key = `${entry.line}:${entry.column}:${text}`;
+ if (seen.has(key)) return;
+ seen.add(key);
+ const reason = allowlistReason(allowlist, text);
+ if (reason) {
+ entry.reason = reason;
+ allowed.push(entry);
+ } else {
+ found.push(entry);
+ }
+ };
+
+ const checkToastBag = (node) => {
+ const bag = node.arguments[1];
+ if (!bag || !ts.isObjectLiteralExpression(bag)) return;
+ for (const prop of bag.properties) {
+ if (!ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name)) continue;
+ if (!TOAST_OPTION_KEYS.has(prop.name.text)) continue;
+ for (const part of literalParts(prop.initializer)) {
+ push(part.node, "string-exit", `toast.${prop.name.text}`, part.copy);
+ }
+ }
+ };
+
+ const visit = (node, inNonProse) => {
+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
+ const tag = ts.isJsxElement(node) ? node.openingElement.tagName : node.tagName;
+ const nonProse = inNonProse || NON_PROSE_TAGS.has(tagNameText(tag));
+ ts.forEachChild(node, (child) => visit(child, nonProse));
+ return;
+ }
+ if (ts.isJsxText(node)) {
+ if (!inNonProse) push(node, "jsx-text", null, node.text);
+ return;
+ }
+ if (ts.isJsxAttribute(node)) {
+ const name = tagNameText(node.name);
+ if (!inNonProse && JSX_TEXT_ATTRIBUTES.has(name)) {
+ for (const part of literalParts(node.initializer)) {
+ push(part.node, "jsx-attribute", name, part.copy);
+ }
+ }
+ ts.forEachChild(node, (child) => visit(child, inNonProse));
+ return;
+ }
+ if (ts.isCallExpression(node)) {
+ const detail = stringExitDetail(node);
+ if (detail) {
+ for (const part of literalParts(node.arguments[0])) {
+ push(part.node, "string-exit", detail, part.copy);
+ }
+ if (detail === "call:toast") checkToastBag(node);
+ }
+ } else if (
+ ts.isNewExpression(node) &&
+ ts.isIdentifier(node.expression) &&
+ ERROR_CONSTRUCTORS.has(node.expression.text)
+ ) {
+ for (const part of literalParts(node.arguments?.[0])) {
+ push(part.node, "string-exit", "new:Error", part.copy);
+ }
+ }
+ ts.forEachChild(node, (child) => visit(child, inNonProse));
+ };
+
+ visit(sourceFile, false);
+ return { found, allowed };
+}
+// ---------------------------------------------------------------------------
+// CLI + report
+// ---------------------------------------------------------------------------
+
+const USAGE = [
+ "Usage: node scripts/find-untranslated.mjs [paths...] [options]",
+ "",
+ " paths directories or .tsx files to scan (default: src/)",
+ " --json print the machine-readable report instead",
+ " --strict exit 1 when anything is untranslated (CI gate)",
+ " --show-allowed include allowlisted hits in the report",
+ " --min-length=<n> ignore copy shorter than n chars (default: 2)",
+ " --group-depth=<n> directory grouping depth under src/ (default: 2)",
+ " --allowlist=<file> allowlist to use (default: i18n-untranslated-allowlist.json)",
+ " -h, --help this text",
+].join("\n");
+
+function parseArgs(argv) {
+ const options = {
+ json: false,
+ strict: false,
+ showAllowed: false,
+ minLength: 2,
+ groupDepth: 2,
+ allowlist: DEFAULT_ALLOWLIST,
+ targets: [],
+ };
+ const number = (flag, raw, min, max) => {
+ const value = Number.parseInt(raw, 10);
+ if (!Number.isInteger(value) || value < min || value > max) {
+ console.error(`✖ ${flag} expects an integer between ${min} and ${max}, got "${raw}".`);
+ process.exit(2);
+ }
+ return value;
+ };
+ for (const arg of argv) {
+ if (arg === "--json") options.json = true;
+ else if (arg === "--strict") options.strict = true;
+ else if (arg === "--show-allowed") options.showAllowed = true;
+ else if (arg === "-h" || arg === "--help") {
+ console.log(USAGE);
+ process.exit(0);
+ } else if (arg.startsWith("--min-length=")) {
+ options.minLength = number("--min-length", arg.slice(13), 1, 64);
+ } else if (arg.startsWith("--group-depth=")) {
+ options.groupDepth = number("--group-depth", arg.slice(14), 1, 6);
+ } else if (arg.startsWith("--allowlist=")) {
+ options.allowlist = path.resolve(process.cwd(), arg.slice(12));
+ } else if (arg.startsWith("-")) {
+ console.error(`✖ unknown option "${arg}".\n\n${USAGE}`);
+ process.exit(2);
+ } else {
+ options.targets.push(arg);
+ }
+ }
+ return options;
+}
+
+function resolveTargets(targets) {
+ if (targets.length === 0) return [SRC_ROOT];
+ return targets.map((target) => {
+ const cleaned = target.replace(/\/\*\*$/, "").replace(/\/+$/, "");
+ const candidates = [
+ path.resolve(PACKAGE_ROOT, cleaned),
+ path.resolve(SRC_ROOT, cleaned),
+ ];
+ const found = candidates.find((candidate) => existsSync(candidate));
+ if (!found) {
+ console.error(
+ `✖ no such path "${target}" (tried ${candidates
+ .map((c) => path.relative(PACKAGE_ROOT, c))
+ .join(", ")}).`,
+ );
+ process.exit(2);
+ }
+ return found;
+ });
+}
+
+function groupDirectory(relative, depth) {
+ const parts = path.dirname(relative).split(path.sep);
+ const underSrc = parts[0] === "src" ? parts.slice(1) : parts;
+ return underSrc.slice(0, depth).join("/") || ".";
+}
+
+function byLocation(a, b) {
+ return a.file.localeCompare(b.file) || a.line - b.line || a.column - b.column;
+}
+
+function summarize(hits, depth) {
+ const buckets = new Map();
+ for (const hit of hits) {
+ const directory = groupDirectory(hit.file, depth);
+ const bucket = buckets.get(directory) ?? { directory, files: new Set(), strings: 0 };
+ bucket.files.add(hit.file);
+ bucket.strings += 1;
+ buckets.set(directory, bucket);
+ }
+ return [...buckets.values()]
+ .map((b) => ({ directory: b.directory, files: b.files.size, strings: b.strings }))
+ .sort((a, b) => b.strings - a.strings || a.directory.localeCompare(b.directory));
+}
+
+function printHits(hits, stream, options) {
+ let current = null;
+ for (const hit of hits) {
+ if (hit.file !== current) {
+ current = hit.file;
+ stream.write(`\n${hit.file}\n`);
+ }
+ const where = `${hit.line}:${hit.column}`.padEnd(7);
+ const kind = (hit.detail ? `${hit.kind}:${hit.detail}` : hit.kind).padEnd(24);
+ const note = hit.reason ? ` [allowed: ${hit.reason}]` : "";
+ stream.write(` ${where}${kind}${hit.text}${note}\n`);
+ }
+ if (hits.length === 0) stream.write("\n (none)\n");
+}
+
+function reportText(result, options, extras) {
+ const scope = options.targets.length ? options.targets.join(" ") : "src/";
+ process.stdout.write(
+ `untranslated copy in ${scope} (min length ${options.minLength})\n`,
+ );
+ printHits(result.hits, process.stdout, options);
+ if (options.showAllowed) {
+ process.stdout.write(`\nallowlisted (${result.allowlistedHits})\n`);
+ printHits(result.allowlisted ?? [], process.stdout, options);
+ }
+ const line = "─".repeat(58);
+ process.stdout.write(`\n${line}\n`);
+ const rows = [
+ ["files scanned", extras.scanned],
+ ["files with untranslated copy", result.hitFiles],
+ ["untranslated strings", result.totalHits],
+ ["allowlisted strings", result.allowlistedHits],
+ ];
+ for (const [label, value] of rows) {
+ process.stdout.write(`${label.padEnd(32)}${String(value).padStart(6)}\n`);
+ }
+ if (result.byDirectory.length > 0) {
+ process.stdout.write(`\nby directory (depth ${options.groupDepth} under src/)\n`);
+ process.stdout.write(` ${"strings".padStart(8)}${"files".padStart(7)} directory\n`);
+ for (const row of result.byDirectory) {
+ process.stdout.write(
+ ` ${String(row.strings).padStart(8)}${String(row.files).padStart(7)} ${row.directory}\n`,
+ );
+ }
+ }
+ for (const warning of extras.stale) process.stderr.write(`! ${warning}\n`);
+}
+function main() {
+ const options = parseArgs(process.argv.slice(2));
+ const allowlist = loadAllowlist(options.allowlist);
+ const targets = resolveTargets(options.targets);
+
+ const files = [
+ ...new Set(
+ targets.flatMap((target) => {
+ if (statSync(target).isDirectory()) return collectTsx(target);
+ const relative = path.relative(PACKAGE_ROOT, target);
+ return target.endsWith(".tsx") && !isTestPath(relative) ? [target] : [];
+ }),
+ ),
+ ].sort();
+
+ const hits = [];
+ const allowed = [];
+ for (const file of files) {
+ const scanned = collectHits(file, readFileSync(file, "utf8"), allowlist, options);
+ hits.push(...scanned.found);
+ allowed.push(...scanned.allowed);
+ }
+ hits.sort(byLocation);
+ allowed.sort(byLocation);
+
+ const hitFiles = new Set(hits.map((hit) => hit.file)).size;
+ const result = {
+ scope: options.targets.length ? options.targets : ["src"],
+ minLength: options.minLength,
+ scannedFiles: files.length,
+ hitFiles,
+ totalHits: hits.length,
+ allowlistedHits: allowed.length,
+ byDirectory: summarize(hits, options.groupDepth),
+ hits,
+ allowlisted: allowed,
+ };
+
+ const used = new Set(allowed.map((hit) => hit.text));
+ const stale = [
+ ...[...allowlist.exact.keys()]
+ .filter((value) => !used.has(value))
+ .map((value) => `allowlist entry "${value}" matched nothing in this scan.`),
+ ...allowlist.regex
+ .filter((rule) => rule.hits === 0)
+ .map((rule) => `allowlist regex /${rule.source}/ matched nothing in this scan.`),
+ ];
+
+ if (options.json) {
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
+ } else {
+ reportText(result, options, { scanned: files.length, stale });
+ }
+
+ if (options.strict && hits.length > 0) {
+ if (!options.json) {
+ process.stderr.write(
+ `\n✖ ${hits.length} untranslated string(s) in ${hitFiles} file(s).\n`,
+ );
+ }
+ process.exit(1);
+ }
+}
+
+main();
diff --git a/packages/web/src/app/error.tsx b/packages/web/src/app/error.tsx
index e463291ca..076d117c7 100644
--- a/packages/web/src/app/error.tsx
+++ b/packages/web/src/app/error.tsx
@@ -2,6 +2,7 @@
import { useEffect } from "react";
import { AlertTriangle, RefreshCw } from "lucide-react";
+import { useTranslations } from "next-intl";
import { Button } from "@repowise-dev/ui/ui/button";
export default function GlobalError({
@@ -11,6 +12,8 @@ export default function GlobalError({
error: Error & { digest?: string };
reset: () => void;
}) {
+ const t = useTranslations("errors");
+
useEffect(() => {
console.error(error);
}, [error]);
@@ -22,20 +25,20 @@ export default function GlobalError({
</div>
<div>
<h2 className="text-base font-semibold text-[var(--color-text-primary)]">
- Something went wrong
+ {t("errorTitle")}
</h2>
<p className="mt-1 text-sm text-[var(--color-text-secondary)] max-w-sm">
- {error.message || "An unexpected error occurred. Please try again."}
+ {error.message || t("errorFallback")}
</p>
{error.digest && (
<p className="mt-1 text-xs font-mono text-[var(--color-text-tertiary)]">
- Digest: {error.digest}
+ {t("digest")}: {error.digest}
</p>
)}
</div>
<Button onClick={reset} size="sm" className="gap-2">
<RefreshCw className="h-3.5 w-3.5" />
- Try again
+ {t("tryAgain")}
</Button>
</div>
);
diff --git a/packages/web/src/app/layout.tsx b/packages/web/src/app/layout.tsx
index 1969f5bdb..4f00b3423 100644
--- a/packages/web/src/app/layout.tsx
+++ b/packages/web/src/app/layout.tsx
@@ -1,5 +1,7 @@
import type { Metadata } from "next";
import { Suspense } from "react";
+import { NextIntlClientProvider } from "next-intl";
+import { getLocale, getTranslations } from "next-intl/server";
import { GeistSans } from "geist/font/sans";
import { GeistMono } from "geist/font/mono";
import { Lora } from "next/font/google";
@@ -29,19 +31,26 @@ const lora = Lora({ subsets: ["latin"], variable: "--font-lora", display: "swap"
// healthy server, and it sticks until a hard reload (#2260).
export const dynamic = "force-dynamic";
-export const metadata: Metadata = {
- title: {
- default: "repowise",
- template: "%s — repowise",
- },
- description: "Open-source codebase documentation engine",
-};
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("app");
+ return {
+ title: {
+ default: "repowise",
+ template: "%s — repowise",
+ },
+ description: t("description"),
+ };
+}
export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
+ // The locale the request resolved to (cookie `NEXT_LOCALE`, else English).
+ // Read here so `<html lang>` and every server-rendered string agree.
+ const locale = await getLocale();
+ const t = await getTranslations("shell");
// Fetch repos + workspace info server-side for the sidebar.
//
// A rejection is NOT an empty account. Falling back to `[]` silently made
@@ -65,17 +74,22 @@ export default async function RootLayout({
return (
<html
- lang="en"
+ lang={locale}
suppressHydrationWarning
className={`${GeistSans.variable} ${GeistMono.variable} ${lora.variable}`}
>
<body className="bg-[var(--color-bg-root)] text-[var(--color-text-primary)] antialiased">
+ {/* Rendered in a Server Component, so every message the request
+ resolved is handed to the client tree automatically — client
+ components call `useTranslations()` against the same catalog the
+ server rendered with. */}
+ <NextIntlClientProvider>
<ThemeProvider>
<a
href="#main-content"
className="sr-only focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[100] focus:rounded-md focus:bg-[var(--color-bg-elevated)] focus:px-3 focus:py-2 focus:text-sm focus:text-[var(--color-text-primary)] focus:outline focus:outline-2 focus:outline-[var(--color-accent-primary)]"
>
- Skip to content
+ {t("skipToContent")}
</a>
<NuqsAdapter>
<SWRProvider>
@@ -119,6 +133,7 @@ export default async function RootLayout({
</NuqsAdapter>
<ThemedToaster />
</ThemeProvider>
+ </NextIntlClientProvider>
</body>
</html>
);
diff --git a/packages/web/src/app/not-found.tsx b/packages/web/src/app/not-found.tsx
index f0dd0dcd8..38d24e692 100644
--- a/packages/web/src/app/not-found.tsx
+++ b/packages/web/src/app/not-found.tsx
@@ -1,7 +1,10 @@
import Link from "next/link";
import { Compass, ChevronLeft } from "lucide-react";
+import { getTranslations } from "next-intl/server";
+
+export default async function NotFound() {
+ const t = await getTranslations("errors");
-export default function NotFound() {
return (
<div className="flex min-h-[60vh] flex-col items-center justify-center gap-4 px-6 text-center">
<div className="rounded-full bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)] p-4">
@@ -9,11 +12,10 @@ export default function NotFound() {
</div>
<div className="space-y-1">
<h1 className="text-lg font-semibold text-[var(--color-text-primary)]">
- Page not found
+ {t("notFoundTitle")}
</h1>
<p className="max-w-md text-sm text-[var(--color-text-secondary)]">
- The page you requested doesn&apos;t exist. It may have been moved or
- never existed.
+ {t("notFoundBody")}
</p>
</div>
<Link
@@ -21,7 +23,7 @@ export default function NotFound() {
className="inline-flex items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 py-1.5 text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] transition-colors"
>
<ChevronLeft className="h-4 w-4" />
- Back to dashboard
+ {t("backToDashboard")}
</Link>
</div>
);
diff --git a/packages/web/src/app/page.tsx b/packages/web/src/app/page.tsx
index 41b887bc1..f02f4d800 100644
--- a/packages/web/src/app/page.tsx
+++ b/packages/web/src/app/page.tsx
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { redirect } from "next/navigation";
import Link from "next/link";
+import { getTranslations } from "next-intl/server";
import { LayoutGrid } from "lucide-react";
import type { RepoSummaryRow } from "@repowise-dev/types/repos";
import { PageShell } from "@repowise-dev/ui/shared";
@@ -19,7 +20,10 @@ import { DeleteRepoButton } from "@/components/repos/delete-repo-button";
import { EmptyReposState } from "@/components/repos/empty-repos-state";
import { JobRows } from "@/components/jobs/job-rows";
-export const metadata: Metadata = { title: "Dashboard" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("dashboard");
+ return { title: t("title") };
+}
export const revalidate = 30;
@@ -47,6 +51,8 @@ const JOB_WINDOW = 10;
* above it.
*/
export default async function DashboardPage() {
+ const t = await getTranslations("dashboard");
+ const ta = await getTranslations("attention");
// One wave. The shape this replaces fetched the repo list, then a stats call
// per repo, then a git-summary call per repo, in two sequential rounds.
const [summary, jobs, ws] = await Promise.allSettled([
@@ -65,9 +71,9 @@ export default async function DashboardPage() {
if (repos.length === 0) {
return (
<PageShell
- title="Repositories"
+ title={t("title")}
icon={<LayoutGrid className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Everything repowise has indexed from this machine."
+ description={t("description")}
>
<EmptyReposState />
</PageShell>
@@ -88,32 +94,35 @@ export default async function DashboardPage() {
const ribbon: RibbonStat[] = [
{
- label: "Files",
+ label: t("ribbon.files"),
value: formatNumber(totals.files),
- sub: `across ${repos.length} repositories`,
+ sub: t("ribbon.filesSub", { count: repos.length }),
},
{
- label: "Symbols",
+ label: t("ribbon.symbols"),
value: formatNumber(totals.symbols),
- sub: "functions, classes and methods",
+ sub: t("ribbon.symbolsSub"),
},
{
- label: "Doc freshness",
+ label: t("ribbon.docFreshness"),
value: totals.pages > 0 ? `${Math.round((totals.freshPages / totals.pages) * 100)}%` : "—",
sub:
totals.pages > 0
- ? `${formatNumber(totals.freshPages)} of ${formatNumber(totals.pages)} pages`
- : "no documentation generated yet",
+ ? t("ribbon.docFreshnessSub", {
+ fresh: formatNumber(totals.freshPages),
+ total: formatNumber(totals.pages),
+ })
+ : t("ribbon.docFreshnessNone"),
},
{
- label: "Hotspots",
+ label: t("ribbon.hotspots"),
value: formatNumber(totals.hotspots),
- sub: "files by churn and prior fixes",
+ sub: t("ribbon.hotspotsSub"),
},
{
- label: "Unused exports",
+ label: t("ribbon.unusedExports"),
value: formatNumber(totals.deadExports),
- sub: "open dead-code findings",
+ sub: t("ribbon.unusedExportsSub"),
},
];
@@ -122,38 +131,44 @@ export default async function DashboardPage() {
return (
<PageShell
- title="Repositories"
+ title={t("title")}
icon={<LayoutGrid className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Everything repowise has indexed from this machine."
+ description={t("description")}
>
<PageLede
- label="Repositories"
+ label={t("ledeLabel")}
value={String(repos.length)}
- unit="indexed on this machine"
+ unit={t("ledeUnit")}
layout="beside"
>
<p>
- {formatNumber(totals.files)} files and {formatNumber(totals.symbols)} symbols are under
- intelligence here, with {formatNumber(totals.pages)} documentation pages written from
- them. Every figure below is measured from the index rather than estimated.
+ {t("intro", {
+ files: formatNumber(totals.files),
+ symbols: formatNumber(totals.symbols),
+ pages: formatNumber(totals.pages),
+ })}
</p>
- <p>{attentionSentence(repos)}</p>
+ <p>{attentionSentence(repos, ta)}</p>
</PageLede>
<StatRibbon stats={ribbon} />
{activeJobs.length > 0 && (
<OverviewSection
- title={activeJobs.length === 1 ? "Indexing now" : `Indexing now (${activeJobs.length})`}
- description="Progress streams live; this page does not need a refresh to catch up."
+ title={
+ activeJobs.length === 1
+ ? t("indexingNow")
+ : t("indexingNowCount", { count: activeJobs.length })
+ }
+ description={t("indexingNowDescription")}
>
<JobRows jobs={activeJobs} nameFor={nameFor} />
</OverviewSection>
)}
<OverviewSection
- title="Repositories"
- description="Ordered by what needs attention first — never indexed, then behind their working tree, then by health score — rather than by when they last changed."
+ title={t("repositoriesTitle")}
+ description={t("repositoriesDescription")}
>
<RepoRows
repos={repos.slice().sort(byAttention).map(toRow)}
@@ -164,8 +179,8 @@ export default async function DashboardPage() {
{jobList.length > 0 && (
<OverviewSection
- title="Recent activity"
- description="The last indexing and sync runs across every repository."
+ title={t("recentActivity")}
+ description={t("recentActivityDescription")}
>
<JobRows jobs={jobList} nameFor={nameFor} />
</OverviewSection>
diff --git a/packages/web/src/app/repos/[id]/architecture/loading.tsx b/packages/web/src/app/repos/[id]/architecture/loading.tsx
index 44ef3bad6..5c1618a7d 100644
--- a/packages/web/src/app/repos/[id]/architecture/loading.tsx
+++ b/packages/web/src/app/repos/[id]/architecture/loading.tsx
@@ -1,3 +1,4 @@
+import { getTranslations } from "next-intl/server";
import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
/**
@@ -6,11 +7,12 @@ import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
* canvas filling the rest. Matching `h-full` / `flex-1` matters more here
* than elsewhere, because the canvas below sizes itself from this box.
*/
-export default function ArchitectureLoading() {
+export default async function ArchitectureLoading() {
+ const t = await getTranslations("loading");
return (
<SkeletonRegion
className="flex h-full flex-col"
- label="Loading architecture"
+ label={t("architecture")}
>
<div className="shrink-0 px-4 pt-3 sm:px-6">
<Skeleton className="h-9 w-80 max-w-full rounded-lg" />
diff --git a/packages/web/src/app/repos/[id]/architecture/page.tsx b/packages/web/src/app/repos/[id]/architecture/page.tsx
index c80f0a5e3..34b5604d2 100644
--- a/packages/web/src/app/repos/[id]/architecture/page.tsx
+++ b/packages/web/src/app/repos/[id]/architecture/page.tsx
@@ -44,6 +44,7 @@
import { use, useCallback, useEffect } from "react";
import { useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import { useQueryState, parseAsStringLiteral } from "nuqs";
import { Code2 } from "lucide-react";
import { ViewTabs } from "@repowise-dev/ui/shared/view-tabs";
@@ -100,13 +101,6 @@ const TAB_FOR_VIEW: Record<CanonicalView, string> = {
const TAB_PANEL_ID = "architecture-tab-panel";
-const TABS: { id: string; label: string }[] = [
- { id: "map", label: "Map" },
- { id: "coupling", label: "Coupling" },
- { id: "packages", label: "Third-party" },
- { id: "symbols", label: "Symbols" },
-];
-
/** Landing view when a tab is clicked, and for the page with no `?view=`.
*
* Map opens on Files. It used to open on Communities, because Files was 1,500
@@ -130,6 +124,8 @@ export default function ArchitecturePage({
}) {
const { id: repoId } = use(params);
const router = useRouter();
+ const t = useTranslations("views.architecture");
+ const tCoupling = useTranslations("coupling");
const [rawView, setView] = useQueryState(
"view",
parseAsStringLiteral(VIEWS).withDefault(DEFAULT_VIEW),
@@ -165,6 +161,12 @@ export default function ArchitecturePage({
const view: CanonicalView =
legacy?.view ?? VIEW_ALIASES[rawView] ?? (rawView as CanonicalView);
const activeTab = TAB_FOR_VIEW[view] ?? "map";
+ const tabs: { id: string; label: string }[] = [
+ { id: "map", label: t("tabs.map") },
+ { id: "coupling", label: t("tabs.coupling") },
+ { id: "packages", label: t("tabs.packages") },
+ { id: "symbols", label: t("tabs.symbols") },
+ ];
// Leaving a tab drops the params that only meant something inside it, so the
// URL never carries a `signal=hot` into the Packages table where nothing
@@ -202,7 +204,7 @@ export default function ArchitecturePage({
<div className="flex h-full flex-col">
<div className="shrink-0 px-4 pt-3 sm:px-6">
<ViewTabs
- tabs={TABS}
+ tabs={tabs}
value={activeTab}
onValueChange={handleTabChange}
panelId={TAB_PANEL_ID}
@@ -239,7 +241,7 @@ export default function ArchitecturePage({
<div className="mb-2">
<h1 className="mb-1 flex items-center gap-2 text-xl font-semibold text-[var(--color-text-primary)]">
<Code2 className="h-5 w-5 text-[var(--color-accent-primary)]" />
- Change coupling
+ {t("couplingTitle")}
</h1>
<p className="text-sm text-[var(--color-text-secondary)]">
{COUPLING_DISCLAIMER}
@@ -247,7 +249,7 @@ export default function ArchitecturePage({
</div>
{/* Contain a render throw to the tab instead of letting it reach
the route boundary and blank the page. */}
- <ErrorBoundary title="Couldn't load change coupling">
+ <ErrorBoundary title={tCoupling("loadFailed")}>
<CouplingTab repoId={repoId} />
</ErrorBoundary>
</div>
diff --git a/packages/web/src/app/repos/[id]/code-health/page.tsx b/packages/web/src/app/repos/[id]/code-health/page.tsx
index 745391e37..6ef4384c2 100644
--- a/packages/web/src/app/repos/[id]/code-health/page.tsx
+++ b/packages/web/src/app/repos/[id]/code-health/page.tsx
@@ -86,6 +86,7 @@ import {
type HealthOverviewResponse,
type HealthTrendResponse,
} from "@/lib/api/code-health";
+import { useTranslations } from "next-intl";
const TABS = [
"triage",
@@ -99,15 +100,15 @@ const TABS = [
] as const;
type TabId = (typeof TABS)[number];
-const TAB_LABELS: Record<TabId, string> = {
- triage: "Overview",
- performance: "Performance",
- findings: "Findings",
- coverage: "Tests",
- "dead-code": "Dead code",
- "doc-drift": "Doc drift",
- security: "Security",
- impact: "Blast radius",
+const TAB_LABEL_KEYS: Record<TabId, string> = {
+ triage: "tabs.triage",
+ performance: "tabs.performance",
+ findings: "tabs.findings",
+ coverage: "tabs.coverage",
+ "dead-code": "tabs.deadCode",
+ "doc-drift": "tabs.docDrift",
+ security: "tabs.security",
+ impact: "tabs.impact",
};
/**
@@ -155,9 +156,9 @@ const OVERLAYS: CodeHealthOverlay[] = ["health", "maintainability", "performance
*/
const SCOPED_TABS: TabId[] = ["triage", "findings"];
-const SCOPE_LABEL: Record<HealthScope, string> = {
- all: "All code",
- production: "Production",
+const SCOPE_LABEL_KEYS: Record<HealthScope, string> = {
+ all: "scopeAll",
+ production: "scopeProduction",
};
/**
@@ -207,9 +208,9 @@ function ViewSelect({
);
}
-const COUNTS_LABEL: Record<HealthCounts, string> = {
- everything: "Everything",
- code_shape: "Code shape only",
+const COUNTS_LABEL_KEYS: Record<HealthCounts, string> = {
+ everything: "countsEverything",
+ code_shape: "countsCodeShape",
};
/**
@@ -237,6 +238,7 @@ const MAP_CAP = 2000;
const CHURN_POINT_LIMIT = 5000;
export default function CodeHealthPage() {
+ const t = useTranslations("views.codeHealth");
const params = useParams<{ id: string }>();
const router = useRouter();
const searchParams = useSearchParams();
@@ -494,7 +496,7 @@ export default function CodeHealthPage() {
return (
<PageShell
- title="Code health"
+ title={t("title")}
icon={<HeartPulse className="h-5 w-5 text-[var(--color-success)]" />}
// No description: the lede below opens with what the score is built from,
// and a header that says it first only says it twice.
@@ -511,25 +513,31 @@ export default function CodeHealthPage() {
<div className="flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2">
{SCOPED_TABS.includes(activeTab) && (
<ViewSelect
- label="Files"
+ label={t("scopeFiles")}
value={scope}
onValueChange={setScope}
- options={HEALTH_SCOPES.map((id) => ({ id, label: SCOPE_LABEL[id] }))}
+ options={HEALTH_SCOPES.map((id) => ({
+ id,
+ label: t(SCOPE_LABEL_KEYS[id]),
+ }))}
/>
)}
{COUNTED_TABS.includes(activeTab) && (
<ViewSelect
- label="Counts"
+ label={t("scopeCounts")}
value={counts}
onValueChange={setCounts}
- options={HEALTH_COUNTS.map((id) => ({ id, label: COUNTS_LABEL[id] }))}
+ options={HEALTH_COUNTS.map((id) => ({
+ id,
+ label: t(COUNTS_LABEL_KEYS[id]),
+ }))}
/>
)}
<Button size="sm" variant="outline" onClick={refresh} disabled={refreshing}>
<RotateCw
className={`mr-1.5 h-3.5 w-3.5 ${refreshing ? "motion-safe:animate-spin" : ""}`}
/>{" "}
- {refreshing ? "Refreshing…" : "Refresh"}
+ {refreshing ? t("refreshing") : t("refresh")}
</Button>
</div>
}
@@ -538,22 +546,18 @@ export default function CodeHealthPage() {
release's version so a reader who dismissed an earlier one sees it. */}
<ReleaseNotice id="health-scoring" version="0.55.0">
<span className="font-medium text-[var(--color-text-primary)]">
- Health scores changed in this release.
+ {t("coChangeNoticeTitle")}
</span>{" "}
- Most files score higher: cohesion, duplication, hotspot and complexity findings
- that did not hold up are gone, and test code no longer counts against production files. Files in languages health cannot analyse used
- to count as 10.0; they now read &quot;Not analysed&quot; and leave the average, so a
- repository with many of them can read lower. Scores are not comparable to
- snapshots taken before this release.
+ {t("coChangeNoticeBody")}
</ReleaseNotice>
{meta ? (
<p className="-mt-3 font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
{meta.last_indexed_at
- ? `Indexed ${formatDateTime(meta.last_indexed_at)}`
- : "Not indexed yet"}
+ ? t("indexed", { date: formatDateTime(meta.last_indexed_at) })
+ : t("notIndexed")}
{meta.head_commit ? ` · ${meta.head_commit.slice(0, 8)}` : ""}
- {` · ${meta.snapshot_count} snapshot${meta.snapshot_count === 1 ? "" : "s"}`}
+ {` · ${t("snapshots", { count: meta.snapshot_count })}`}
</p>
) : null}
@@ -562,7 +566,7 @@ export default function CodeHealthPage() {
const Icon = TAB_ICONS[id];
return {
id,
- label: TAB_LABELS[id],
+ label: t(TAB_LABEL_KEYS[id]),
icon: <Icon className="h-3.5 w-3.5" />,
...(badges[id] !== undefined ? { badge: badges[id] } : {}),
};
@@ -587,8 +591,8 @@ export default function CodeHealthPage() {
hotspotsSlot={<HotspotsSection repoId={repoId} />}
trendSlot={
<OverviewSection
- title="Health trend"
- description="How the scores have moved across indexed snapshots."
+ title={t("trendTitle")}
+ description={t("trendDescription")}
>
<TrendSection
data={trend}
diff --git a/packages/web/src/app/repos/[id]/commits/loading.tsx b/packages/web/src/app/repos/[id]/commits/loading.tsx
index 148cd69c5..3fbefd041 100644
--- a/packages/web/src/app/repos/[id]/commits/loading.tsx
+++ b/packages/web/src/app/repos/[id]/commits/loading.tsx
@@ -1,3 +1,4 @@
+import { getTranslations } from "next-intl/server";
import { PageSkeleton, TableSkeleton } from "@repowise-dev/ui/shared/loading-skeletons";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
@@ -5,9 +6,10 @@ import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
* Mirrors the Commits layout: the shell header, the lede stats, the
* evolution chart section, then the commit table.
*/
-export default function CommitsLoading() {
+export default async function CommitsLoading() {
+ const t = await getTranslations("loading");
return (
- <PageSkeleton actions={false} label="Loading commits">
+ <PageSkeleton actions={false} label={t("commits")}>
<Skeleton className="h-28 w-full rounded-xl" />
<div className="space-y-3">
<Skeleton className="h-5 w-64" />
diff --git a/packages/web/src/app/repos/[id]/commits/page.tsx b/packages/web/src/app/repos/[id]/commits/page.tsx
index 2606620fe..25c56d03c 100644
--- a/packages/web/src/app/repos/[id]/commits/page.tsx
+++ b/packages/web/src/app/repos/[id]/commits/page.tsx
@@ -16,6 +16,7 @@ import {
getCommitStats,
getCommitsPage,
} from "@/lib/api/git";
+import { getTranslations } from "next-intl/server";
export const metadata: Metadata = { title: "Commits" };
@@ -52,6 +53,7 @@ export default async function CommitsPage({
}) {
const { id } = await params;
const base = `/repos/${id}`;
+ const t = await getTranslations("views.commits");
// One wave. The scatter plots its own recency sample rather than reusing the
// queue's first page: the feed is risk-sorted, so reusing it would draw only
@@ -72,12 +74,11 @@ export default async function CommitsPage({
return (
<PageShell
icon={<GitCommitHorizontal className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- title="Commits"
- description="Every commit scored for change-risk against this repo's own history."
+ title={t("title")}
+ description={t("emptyDescription")}
>
<p className="max-w-[62ch] text-sm text-[var(--color-text-secondary)]">
- Per-commit change-risk is captured on the next full index. Run a sync and
- the review queue fills in behind it.
+ {t("emptyHint")}
</p>
</PageShell>
);
@@ -86,15 +87,15 @@ export default async function CommitsPage({
return (
<PageShell
icon={<GitCommitHorizontal className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- title="Commits"
- description="Every commit scored for change-risk against this repo's own history, so 'elevated' means elevated here rather than on some global curve."
+ title={t("title")}
+ description={t("description")}
>
{stats && <CommitsLede stats={stats} base={base} LinkComponent={Link} />}
{evolution && evolution.total_commits > 0 && (
<OverviewSection
- title="How the work changed shape"
- description="Commit categories over time, read off the subject line. Fixes carry the accent because that is the series this chart exists to show."
+ title={t("evolutionTitle")}
+ description={t("evolutionDescription")}
>
<CodeEvolutionChart evolution={evolution} />
</OverviewSection>
@@ -103,8 +104,8 @@ export default async function CommitsPage({
{trend && trend.agent_commits > 0 && <AgentTrendStrip trend={trend} />}
<OverviewSection
- title="Review queue"
- description="Newest first by default. Priority is a tercile of this repo's own distribution, so sorting by it shows only the top third — the filters narrow the whole repository, not the page."
+ title={t("reviewQueueTitle")}
+ description={t("reviewQueueDescription")}
action={<CredibilityInfoButton />}
>
<CommitQueue
@@ -124,11 +125,11 @@ export default async function CommitsPage({
</OverviewSection>
<OverviewSection
- title="How the score behaves here"
- description="Two views of the same model: where the cuts fall, and what commit shape lands you above them."
+ title={t("scoreBehaviourTitle")}
+ description={t("scoreBehaviourDescription")}
action={
<SectionLink href={`${base}/code-health?tab=triage`} LinkComponent={Link}>
- Change risk
+ {t("changeRisk")}
</SectionLink>
}
>
diff --git a/packages/web/src/app/repos/[id]/costs/page.tsx b/packages/web/src/app/repos/[id]/costs/page.tsx
index bd2045df5..1b9b77a50 100644
--- a/packages/web/src/app/repos/[id]/costs/page.tsx
+++ b/packages/web/src/app/repos/[id]/costs/page.tsx
@@ -26,6 +26,7 @@ import {
} from "@repowise-dev/ui/savings";
import { getCostSummary, getSavings } from "@/lib/api/costs";
import type { CostSummary, Savings } from "@/lib/api/costs";
+import { useTranslations } from "next-intl";
/** Where the accounting is written down. One constant, used by the lede, the
* reset notice and the methodology section, so the three cannot drift. */
@@ -59,6 +60,7 @@ function resetNoticeKey(repoId: string): string {
export default function CostsPage() {
const params = useParams<{ id: string }>();
const id = params.id;
+ const t = useTranslations("views.costs");
// Two fetches above the fold, in one wave. The previous page made five, three
// of them the same endpoint with a different `by` for tabs that were not
@@ -82,20 +84,20 @@ export default function CostsPage() {
return (
<PageShell
- title="Usage & savings"
- description="What agents avoided, what Repowise cost, and how we know."
+ title={t("title")}
+ description={t("description")}
>
<ResetNotice repoId={id} />
{savingsError ? (
<ApiError
- title="Couldn't load agent savings"
+ title={t("savingsErrorTitle")}
// Only claim spend is fine when it actually is. Asserted
// unconditionally, this sat directly above a spend error.
message={
spendError
- ? "The savings endpoint did not respond."
- : "The savings endpoint did not respond. Model spend below is unaffected."
+ ? t("savingsErrorBody")
+ : t("savingsErrorBodySpendUnaffected")
}
onRetry={() => void retrySavings()}
/>
@@ -109,13 +111,13 @@ export default function CostsPage() {
)}
<OverviewSection
- title="Repowise model spend"
- description="What Repowise's own model work cost, reported beside agent savings and never subtracted from them."
+ title={t("spendTitle")}
+ description={t("spendDescription")}
>
{spendError ? (
- <ApiError title="Couldn't load model spend" onRetry={() => void retrySpend()} />
+ <ApiError title={t("spendErrorTitle")} onRetry={() => void retrySpend()} />
) : spend === undefined ? (
- <p className="text-sm text-[var(--color-text-tertiary)]">Loading model spend…</p>
+ <p className="text-sm text-[var(--color-text-tertiary)]">{t("loadingSpend")}</p>
) : (
<SpendSummary spend={spend} />
)}
@@ -138,8 +140,9 @@ export default function CostsPage() {
* that `PageShell` is already rendering for real just above this.
*/
function SavingsSkeleton() {
+ const t = useTranslations("views.costs");
return (
- <SkeletonRegion label="Loading agent savings" className="flex flex-col gap-6">
+ <SkeletonRegion label={t("loadingSavings")} className="flex flex-col gap-6">
<div className="flex flex-col gap-5 lg:flex-row lg:items-start lg:gap-12">
<div className="flex flex-col gap-2.5 lg:w-[220px]">
<Skeleton className="h-3 w-40" />
@@ -171,13 +174,14 @@ function SavingsSkeleton() {
* different claim from a measured zero.
*/
function SavingsSections({ data }: { data: SavingsView }) {
+ const t = useTranslations("views.costs");
if (!data.available) {
return (
<EmptyState
- title="No agent savings recorded yet"
+ title={t("savingsEmptyTitle")}
// Plain text: EmptyState renders its description as a string, so
// backticks would print as backticks.
- description="Route noisy commands through repowise distill, or install the rewrite hook with repowise hook rewrite install. Savings appear here on their own once an agent starts using this repository."
+ description={t("savingsEmptyDescription")}
/>
);
}
@@ -197,17 +201,17 @@ function SavingsSections({ data }: { data: SavingsView }) {
<SavingsLede data={data} methodologyHref={METHODOLOGY_HREF} LinkComponent={Link} />
<OverviewSection
- title="Savings by source"
- description="Which capture surface produced each part of the total."
+ title={t("bySourceTitle")}
+ description={t("bySourceDescription")}
>
<SavingsSourceTable
rows={surfaces}
total={data.saved_input_tokens}
- nameHeader="Surface"
- caption="Savings by the surface that produced them"
+ nameHeader={t("surfaceHeader")}
+ caption={t("surfaceCaption")}
empty={
<p className="text-sm text-[var(--color-text-secondary)]">
- No savings in this window carry a surface.
+ {t("surfaceEmpty")}
</p>
}
/>
@@ -215,16 +219,16 @@ function SavingsSections({ data }: { data: SavingsView }) {
{opportunities.length > 0 && (
<OverviewSection
- title="Observed opportunities"
- description="Behaviour that could have been optimised and was not. Never part of the total above."
+ title={t("opportunitiesTitle")}
+ description={t("opportunitiesDescription")}
>
<OpportunityList items={opportunities} LinkComponent={Link} />
</OverviewSection>
)}
<OverviewSection
- title="Details"
- description="The same savings, cut by day, operation, pricing model and agent."
+ title={t("detailsTitle")}
+ description={t("detailsDescription")}
>
<UsageDetails data={data} />
</OverviewSection>
diff --git a/packages/web/src/app/repos/[id]/decisions/page.tsx b/packages/web/src/app/repos/[id]/decisions/page.tsx
index 85f65d897..63926a904 100644
--- a/packages/web/src/app/repos/[id]/decisions/page.tsx
+++ b/packages/web/src/app/repos/[id]/decisions/page.tsx
@@ -13,6 +13,7 @@ import { listEpisodes } from "@/lib/api/episodes";
import { ApiClientError } from "@/lib/api/client";
import { AddDecisionButton } from "@/components/decisions/add-decision-button";
import { DecisionReviewWrapper } from "@/components/decisions/decision-review-wrapper";
+import { getTranslations } from "next-intl/server";
export const revalidate = 30;
export const metadata: Metadata = { title: "Decisions" };
@@ -64,6 +65,7 @@ interface Props {
*/
export default async function DecisionsPage({ params }: Props) {
const { id: repoId } = await params;
+ const t = await getTranslations("views.decisions");
let decisions;
try {
@@ -139,8 +141,8 @@ export default async function DecisionsPage({ params }: Props) {
return (
<PageShell
- title="Decisions"
- description="What this codebase has settled on and what is true of the checkout you are standing in: the constraints, the tradeoffs, and the facts that catch people out."
+ title={t("title")}
+ description={t("description")}
>
{/* The headline used to be the size of the review queue, so the largest
number on the page pointed at the work nobody had done rather than at
@@ -162,18 +164,16 @@ export default async function DecisionsPage({ params }: Props) {
what it counts and the pairs stay visible in their lane, where they
can be superseded. */}
<PageLede
- label={measuredByLane ? "Accepted" : "Confirmed"}
+ label={measuredByLane ? t("ledeAccepted") : t("ledeConfirmed")}
value={accepted.toLocaleString()}
unit={denominator}
layout="beside"
>
{empty ? (
<p>
- Decisions land here as the indexer mines them from pull requests,
- commit messages, code comments and your own sessions, and as you
- record them yourself — below, or with{" "}
- <code>repowise decision add</code>. Each one keeps the quote it was
- drawn from and the files it governs.
+ {t.rich("ledeEmpty", {
+ code: (chunks) => <code>{chunks}</code>,
+ })}
</p>
) : accepted === 0 ? (
// A repository with records and no accepted one is not an empty
@@ -184,39 +184,14 @@ export default async function DecisionsPage({ params }: Props) {
// column called active turns out to be something nobody accepted, so
// this is the state most likely to be read by somebody surprised.
<>
- <p>
- Nothing here governs yet. A record governs only once somebody
- accepts it, naming the files it covers and why — mining it,
- seeing it recur, and scoring it confident all stop short of that.
- </p>
- <p>
- {proposed.toLocaleString()} candidate
- {proposed === 1 ? " is" : "s are"} waiting below, and{" "}
- {proposed === 1 ? "it is" : "they are"} all still here: nothing
- was deleted and every id still resolves. If this page used to
- show confirmed decisions, those are the records now in
- Candidates. Accepting one takes a click and changes no code.
- </p>
+ <p>{t("ledeNoGovernance")}</p>
+ <p>{t("ledeCandidates", { count: proposed })}</p>
</>
) : (
<>
- <p>
- {accepted.toLocaleString()} record
- {accepted === 1 ? " is" : "s are"} accepted: somebody read{" "}
- {accepted === 1 ? "it" : "them"} and marked{" "}
- {accepted === 1 ? "it" : "them"} as something the team stands
- behind, which is what makes {accepted === 1 ? "it" : "them"} worth
- quoting back to an agent later.
- </p>
+ <p>{t("ledeAcceptedRecords", { count: accepted })}</p>
{proposed > 0 && (
- <p>
- {proposed.toLocaleString()} more are candidates the indexer
- mined and nobody has accepted. Until one is accepted it is a
- guess about your codebase rather than a rule for it, and no
- agent is ever given one. Open the Candidates lane below to work
- through them; accepting or dismissing one takes a click and
- changes no code.
- </p>
+ <p>{t("ledeAcceptedMore", { count: proposed })}</p>
)}
</>
)}
@@ -231,8 +206,8 @@ export default async function DecisionsPage({ params }: Props) {
{facts && (
<OverviewSection
- title="About this checkout"
- description="Facts about the working tree rather than claims anybody made about it, derived at index time with no model call and no history. These are the ones that trip up a newcomer, human or agent."
+ title={t("checkoutTitle")}
+ description={t("checkoutDescription")}
>
<CheckoutFacts
facts={facts.episodes}
@@ -244,8 +219,8 @@ export default async function DecisionsPage({ params }: Props) {
{!empty && (
<OverviewSection
- title="Review"
- description="Split by what each record's acceptance amounts to, not by a status word. Every record is in exactly one lane and the counts add up: what governs, what nobody has reviewed, what has drifted from the code it names, what names nothing at all, and what has been retired."
+ title={t("reviewTitle")}
+ description={t("reviewDescription")}
>
<DecisionReviewWrapper repoId={repoId} pageSize={PAGE_SIZE} />
</OverviewSection>
diff --git a/packages/web/src/app/repos/[id]/docs/coverage/loading.tsx b/packages/web/src/app/repos/[id]/docs/coverage/loading.tsx
index e26548a21..3b37c714a 100644
--- a/packages/web/src/app/repos/[id]/docs/coverage/loading.tsx
+++ b/packages/web/src/app/repos/[id]/docs/coverage/loading.tsx
@@ -1,3 +1,4 @@
+import { getTranslations } from "next-intl/server";
import { StatGridSkeleton } from "@repowise-dev/ui/shared/loading-skeletons";
import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
@@ -7,9 +8,10 @@ import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
* `MetricCard` boxes via `StatGridSkeleton`, so they do not resize on
* arrival the way a guessed height would.
*/
-export default function DocsCoverageLoading() {
+export default async function DocsCoverageLoading() {
+ const t = await getTranslations("loading");
return (
- <SkeletonRegion className="flex h-full flex-col" label="Loading coverage">
+ <SkeletonRegion className="flex h-full flex-col" label={t("coverage")}>
<div className="shrink-0 border-b border-[var(--color-border-default)] px-4 py-3 sm:px-6">
<Skeleton className="h-6 w-56 max-w-full" />
</div>
diff --git a/packages/web/src/app/repos/[id]/docs/coverage/page.tsx b/packages/web/src/app/repos/[id]/docs/coverage/page.tsx
index d0cff3780..425d2ff55 100644
--- a/packages/web/src/app/repos/[id]/docs/coverage/page.tsx
+++ b/packages/web/src/app/repos/[id]/docs/coverage/page.tsx
@@ -8,6 +8,7 @@ import type { DocPage } from "@repowise-dev/types/docs";
import { MetricCard } from "@repowise-dev/ui/shared/metric-card";
import { listAllPages } from "@/lib/api/pages";
import { formatNumber } from "@repowise-dev/ui/lib/format";
+import { getTranslations } from "next-intl/server";
import { HostedNudgeSlot } from "@/components/hosted/hosted-nudge-slot";
export const metadata: Metadata = { title: "Doc freshness" };
@@ -18,6 +19,7 @@ export default async function CoveragePage({
params: Promise<{ id: string }>;
}) {
const { id } = await params;
+ const t = await getTranslations("views.docsFreshness");
let pages: Awaited<ReturnType<typeof listAllPages>> = [];
@@ -34,13 +36,16 @@ export default async function CoveragePage({
const fresh = pages.filter((p) => p.freshness_status === "fresh").length;
const stale = pages.filter((p) => p.freshness_status === "stale").length;
const outdated = pages.filter((p) => p.freshness_status === "outdated").length;
- const freshPct = pages.length > 0 ? Math.round((fresh / pages.length) * 100) : 0;
+ /** Share of the indexed pages one bucket holds, rounded to a whole percent. */
+ const pctOf = (count: number) =>
+ pages.length > 0 ? Math.round((count / pages.length) * 100) : 0;
+ const freshPct = pctOf(fresh);
return (
<div className="flex flex-col h-full">
<DocsHeader>
<span className="text-xs text-[var(--color-text-tertiary)]">
- Freshness across {formatNumber(total)} pages
+ {t("header", { count: formatNumber(total) })}
</span>
</DocsHeader>
@@ -50,26 +55,26 @@ export default async function CoveragePage({
<div className="flex flex-col items-center gap-4 lg:w-56 shrink-0">
<CoverageDonut fresh={fresh} stale={stale} outdated={outdated} />
<p className="text-sm text-[var(--color-text-secondary)]">
- {freshPct}% of pages are fresh
+ {t("freshPct", { pct: freshPct })}
</p>
</div>
{/* Stat cards */}
<div className="flex-1 grid grid-cols-1 gap-3 sm:grid-cols-3">
<MetricCard
- label="Fresh"
+ label={t("fresh")}
value={formatNumber(fresh)}
- description={`${pages.length > 0 ? Math.round((fresh / pages.length) * 100) : 0}% of pages`}
+ description={t("pctOfPages", { pct: pctOf(fresh) })}
/>
<MetricCard
- label="Stale"
+ label={t("stale")}
value={formatNumber(stale)}
- description={`${pages.length > 0 ? Math.round((stale / pages.length) * 100) : 0}% of pages`}
+ description={t("pctOfPages", { pct: pctOf(stale) })}
/>
<MetricCard
- label="Outdated"
+ label={t("outdated")}
value={formatNumber(outdated)}
- description={`${pages.length > 0 ? Math.round((outdated / pages.length) * 100) : 0}% of pages`}
+ description={t("pctOfPages", { pct: pctOf(outdated) })}
/>
</div>
</div>
@@ -77,7 +82,9 @@ export default async function CoveragePage({
{/* Freshness distribution bar */}
{pages.length > 0 && (
<div>
- <p className="text-xs text-[var(--color-text-tertiary)] mb-1.5">Distribution</p>
+ <p className="text-xs text-[var(--color-text-tertiary)] mb-1.5">
+ {t("distribution")}
+ </p>
<div className="h-3 rounded-full overflow-hidden flex">
<div className="bg-[var(--color-fresh)]" style={{ width: `${(fresh / pages.length) * 100}%` }} />
<div className="bg-[var(--color-stale)]" style={{ width: `${(stale / pages.length) * 100}%` }} />
@@ -85,13 +92,13 @@ export default async function CoveragePage({
</div>
<div className="flex gap-4 mt-1.5 text-xs text-[var(--color-text-tertiary)]">
<span className="flex items-center gap-1">
- <span className="h-2 w-2 rounded-full bg-[var(--color-fresh)]" /> Fresh
+ <span className="h-2 w-2 rounded-full bg-[var(--color-fresh)]" /> {t("fresh")}
</span>
<span className="flex items-center gap-1">
- <span className="h-2 w-2 rounded-full bg-[var(--color-stale)]" /> Stale
+ <span className="h-2 w-2 rounded-full bg-[var(--color-stale)]" /> {t("stale")}
</span>
<span className="flex items-center gap-1">
- <span className="h-2 w-2 rounded-full bg-[var(--color-outdated)]" /> Outdated
+ <span className="h-2 w-2 rounded-full bg-[var(--color-outdated)]" /> {t("outdated")}
</span>
</div>
</div>
diff --git a/packages/web/src/app/repos/[id]/error.tsx b/packages/web/src/app/repos/[id]/error.tsx
index 8fe88506f..88096cda7 100644
--- a/packages/web/src/app/repos/[id]/error.tsx
+++ b/packages/web/src/app/repos/[id]/error.tsx
@@ -2,6 +2,7 @@
import { useEffect } from "react";
import Link from "next/link";
+import { useTranslations } from "next-intl";
import { AlertTriangle, RefreshCw, ArrowLeft } from "lucide-react";
import { Button } from "@repowise-dev/ui/ui/button";
@@ -12,6 +13,8 @@ export default function RepoError({
error: Error & { digest?: string };
reset: () => void;
}) {
+ const t = useTranslations("errors");
+
useEffect(() => {
console.error(error);
}, [error]);
@@ -23,21 +26,21 @@ export default function RepoError({
</div>
<div>
<h2 className="text-base font-semibold text-[var(--color-text-primary)]">
- Failed to load repository
+ {t("repoErrorTitle")}
</h2>
<p className="mt-1 text-sm text-[var(--color-text-secondary)] max-w-sm">
- {error.message || "Could not load repository data. The backend may be unavailable."}
+ {error.message || t("repoErrorFallback")}
</p>
</div>
<div className="flex items-center gap-2">
<Button onClick={reset} size="sm" variant="secondary" className="gap-2">
<RefreshCw className="h-3.5 w-3.5" />
- Retry
+ {t("retry")}
</Button>
<Button asChild size="sm" variant="ghost" className="gap-2">
<Link href="/">
<ArrowLeft className="h-3.5 w-3.5" />
- Dashboard
+ {t("dashboard")}
</Link>
</Button>
</div>
diff --git a/packages/web/src/app/repos/[id]/files/page.tsx b/packages/web/src/app/repos/[id]/files/page.tsx
index 2fc17260c..797583db3 100644
--- a/packages/web/src/app/repos/[id]/files/page.tsx
+++ b/packages/web/src/app/repos/[id]/files/page.tsx
@@ -1,9 +1,13 @@
import type { Metadata } from "next";
+import { getTranslations } from "next-intl/server";
import { Files } from "lucide-react";
import { PageShell } from "@repowise-dev/ui/shared/page-shell";
import { FilesExplorer } from "@/components/files/files-explorer";
-export const metadata: Metadata = { title: "Files" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("views.files");
+ return { title: t("title") };
+}
export default async function FilesIndexPage({
params,
@@ -11,13 +15,14 @@ export default async function FilesIndexPage({
params: Promise<{ id: string }>;
}) {
const { id } = await params;
+ const t = await getTranslations("views.files");
return (
<PageShell
maxWidth="wide"
icon={<Files className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- title="Files"
- description="Drill the map to see how the tree is shaped and where health is thin, then filter the table to find a specific file."
+ title={t("title")}
+ description={t("description")}
>
<FilesExplorer repoId={id} />
</PageShell>
diff --git a/packages/web/src/app/repos/[id]/knowledge-graph/loading.tsx b/packages/web/src/app/repos/[id]/knowledge-graph/loading.tsx
index ce0d53151..10ce3588c 100644
--- a/packages/web/src/app/repos/[id]/knowledge-graph/loading.tsx
+++ b/packages/web/src/app/repos/[id]/knowledge-graph/loading.tsx
@@ -1,3 +1,4 @@
+import { getTranslations } from "next-intl/server";
import { PageSkeleton } from "@repowise-dev/ui/shared/loading-skeletons";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
@@ -7,9 +8,10 @@ import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
* `h-[520px]` band, so this hands over to it without the canvas changing
* size.
*/
-export default function KnowledgeGraphLoading() {
+export default async function KnowledgeGraphLoading() {
+ const t = await getTranslations("loading");
return (
- <PageSkeleton maxWidth="wide" label="Loading knowledge graph">
+ <PageSkeleton maxWidth="wide" label={t("knowledgeGraph")}>
<Skeleton className="h-[520px] w-full rounded-lg" />
</PageSkeleton>
);
diff --git a/packages/web/src/app/repos/[id]/knowledge-graph/page.tsx b/packages/web/src/app/repos/[id]/knowledge-graph/page.tsx
index 91329b035..2c3271711 100644
--- a/packages/web/src/app/repos/[id]/knowledge-graph/page.tsx
+++ b/packages/web/src/app/repos/[id]/knowledge-graph/page.tsx
@@ -26,6 +26,7 @@
import { use, useCallback, useMemo, useRef, useState } from "react";
import { parseAsString, useQueryState } from "nuqs";
+import { useTranslations } from "next-intl";
import { ScanSearch } from "lucide-react";
import { PageShell } from "@repowise-dev/ui/shared/page-shell";
import { ZoomCanvas } from "@repowise-dev/ui/zoom";
@@ -44,6 +45,7 @@ const EMPTY_RELATIONS: ZoomRelation[] = [];
const NO_RELATIONS: Map<string, ZoomRelation[]> = new Map();
export default function KnowledgeGraphPage({ params }: { params: Promise<{ id: string }> }) {
+ const t = useTranslations("views.knowledgeGraph");
const { id: repoId } = use(params);
const { zoomMap, error, isLoading } = useZoomMap(repoId);
@@ -92,9 +94,9 @@ export default function KnowledgeGraphPage({ params }: { params: Promise<{ id: s
return (
<PageShell
- title="Knowledge Graph"
+ title={t("title")}
icon={<ScanSearch className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- description="Explore your codebase like a map: scroll to zoom, drag to pan, and double-click any card to dive into its layers, folders and files, ranked by how the code actually runs."
+ description={t("description")}
// The export has its own endpoint and does not need the zoom map, but a
// map that failed to load is the cheapest signal that this repo has
// nothing indexed to export either.
@@ -103,12 +105,12 @@ export default function KnowledgeGraphPage({ params }: { params: Promise<{ id: s
>
{isLoading && (
<div className="flex h-[520px] items-center justify-center text-sm text-[var(--color-text-secondary)]">
- Building the knowledge graph…
+ {t("loading")}
</div>
)}
{error && !isLoading && (
<div className="flex h-[520px] items-center justify-center text-sm text-[var(--color-error)]">
- Could not load the knowledge graph for this repository.
+ {t("error")}
</div>
)}
{zoomMap && !isLoading && (
diff --git a/packages/web/src/app/repos/[id]/loading.tsx b/packages/web/src/app/repos/[id]/loading.tsx
index 55689b17a..b4be6b3f9 100644
--- a/packages/web/src/app/repos/[id]/loading.tsx
+++ b/packages/web/src/app/repos/[id]/loading.tsx
@@ -1,3 +1,4 @@
+import { getTranslations } from "next-intl/server";
import { PageSkeleton } from "@repowise-dev/ui/shared/loading-skeletons";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
@@ -16,9 +17,10 @@ import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
* block rather than a guessed composition — 24 routes differ below the
* header, and a specific guess would reflow on arrival for most of them.
*/
-export default function RepoLoading() {
+export default async function RepoLoading() {
+ const t = await getTranslations("loading");
return (
- <PageSkeleton label="Loading">
+ <PageSkeleton label={t("repo")}>
<Skeleton className="h-[60vh] min-h-80 w-full rounded-xl" />
</PageSkeleton>
);
diff --git a/packages/web/src/app/repos/[id]/modules/[path]/page.tsx b/packages/web/src/app/repos/[id]/modules/[path]/page.tsx
index 6b79c463d..1d2b6173f 100644
--- a/packages/web/src/app/repos/[id]/modules/[path]/page.tsx
+++ b/packages/web/src/app/repos/[id]/modules/[path]/page.tsx
@@ -1,6 +1,7 @@
"use client";
import { useParams, useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import useSWR from "swr";
import Link from "next/link";
import { Folder } from "lucide-react";
@@ -17,6 +18,7 @@ import type { ModuleHealthDetail } from "@/lib/api/types";
export default function ModuleHealthPage() {
const { id, path } = useParams<{ id: string; path: string }>();
const router = useRouter();
+ const t = useTranslations("views.modules");
const modulePath = decodeURIComponent(path);
const { data, isLoading, error } = useSWR<ModuleHealthDetail>(
@@ -43,8 +45,8 @@ export default function ModuleHealthPage() {
{error && (
<EmptyState
icon={<Folder className="h-6 w-6" />}
- title="Module not found"
- description="The requested module path doesn't exist in this repository's index."
+ title={t("notFoundTitle")}
+ description={t("notFoundDescription")}
/>
)}
@@ -54,7 +56,7 @@ export default function ModuleHealthPage() {
breadcrumb={[
// There is no Modules tab any more — it folded into the map's hub
// layer on the overview. Name where the link actually goes.
- { label: "Code Health", href: `/repos/${id}/code-health?tab=triage` },
+ { label: t("breadcrumb"), href: `/repos/${id}/code-health?tab=triage` },
{ label: modulePath.split("/").pop() || modulePath },
]}
LinkComponent={Link}
diff --git a/packages/web/src/app/repos/[id]/not-found.tsx b/packages/web/src/app/repos/[id]/not-found.tsx
index 9094dd3f4..46f92d74d 100644
--- a/packages/web/src/app/repos/[id]/not-found.tsx
+++ b/packages/web/src/app/repos/[id]/not-found.tsx
@@ -1,7 +1,10 @@
import Link from "next/link";
import { Home, ChevronLeft } from "lucide-react";
+import { getTranslations } from "next-intl/server";
+
+export default async function RepoNotFound() {
+ const t = await getTranslations("errors");
-export default function RepoNotFound() {
return (
<div className="flex min-h-[60vh] flex-col items-center justify-center gap-4 px-6 text-center">
<div className="rounded-full bg-[var(--color-bg-elevated)] border border-[var(--color-border-default)] p-4">
@@ -9,11 +12,10 @@ export default function RepoNotFound() {
</div>
<div className="space-y-1">
<h1 className="text-lg font-semibold text-[var(--color-text-primary)]">
- Page not found
+ {t("repoNotFoundTitle")}
</h1>
<p className="max-w-md text-sm text-[var(--color-text-secondary)]">
- The page or resource you requested doesn&apos;t exist for this repository. It may
- have been moved or never existed.
+ {t("repoNotFoundBody")}
</p>
</div>
<Link
@@ -21,7 +23,7 @@ export default function RepoNotFound() {
className="inline-flex items-center gap-1 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 py-1.5 text-sm text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] transition-colors"
>
<ChevronLeft className="h-4 w-4" />
- Back to dashboard
+ {t("backToDashboard")}
</Link>
</div>
);
diff --git a/packages/web/src/app/repos/[id]/owners/[owner]/page.tsx b/packages/web/src/app/repos/[id]/owners/[owner]/page.tsx
index ba8e784a6..d8aeae427 100644
--- a/packages/web/src/app/repos/[id]/owners/[owner]/page.tsx
+++ b/packages/web/src/app/repos/[id]/owners/[owner]/page.tsx
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import Link from "next/link";
+import { getTranslations } from "next-intl/server";
import { Users } from "lucide-react";
import { PageShell } from "@repowise-dev/ui/shared/page-shell";
import { OwnerAvatar } from "@repowise-dev/ui/owners/owner-avatar";
@@ -9,7 +10,10 @@ import { fileEntityPath } from "@repowise-dev/ui/shared/entity";
import { formatDate, formatRelativeTimeOrNull } from "@repowise-dev/ui/lib/format";
import { getOwnerProfile } from "@/lib/api/owners";
-export const metadata: Metadata = { title: "Contributor" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("views.contributors");
+ return { title: t("profileTitle") };
+}
/**
* A server component, where this was a client component behind one SWR wave.
@@ -26,6 +30,7 @@ export default async function OwnerProfilePage({
params: Promise<{ id: string; owner: string }>;
}) {
const { id, owner } = await params;
+ const t = await getTranslations("views.contributors");
const base = `/repos/${id}`;
const ownerKey = decodeURIComponent(owner);
@@ -35,18 +40,18 @@ export default async function OwnerProfilePage({
return (
<PageShell
icon={<Users className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- title="Contributor"
+ title={t("profileTitle")}
>
<EmptyState
icon={<Users className="h-6 w-6" />}
- title="No profile for this contributor"
- description="Nobody by this name or address appears in the indexed git history. They may have committed under a different address, or the history may not have been synced yet."
+ title={t("profileEmptyTitle")}
+ description={t("profileEmptyDescription")}
/>
</PageShell>
);
}
- const displayName = profile.name || profile.email || "unknown";
+ const displayName = profile.name || profile.email || t("unknownName");
const lastTouched = formatRelativeTimeOrNull(profile.last_commit_at);
// Tenure as a sentence rather than a "new to this repo" badge. That badge
@@ -55,9 +60,9 @@ export default async function OwnerProfilePage({
// dates says the same thing without dressing it as a verdict.
const tenure = [
profile.first_commit_at
- ? `Committing here since ${formatDate(profile.first_commit_at)}`
+ ? t("tenureSince", { date: formatDate(profile.first_commit_at) })
: null,
- lastTouched ? `last touched ${lastTouched}` : null,
+ lastTouched ? t("tenureLastTouched", { time: lastTouched }) : null,
]
.filter(Boolean)
.join(", ");
diff --git a/packages/web/src/app/repos/[id]/owners/page.tsx b/packages/web/src/app/repos/[id]/owners/page.tsx
index 60cf33b2c..12c1424da 100644
--- a/packages/web/src/app/repos/[id]/owners/page.tsx
+++ b/packages/web/src/app/repos/[id]/owners/page.tsx
@@ -3,6 +3,7 @@
import { useMemo, useState } from "react";
import Link from "next/link";
import { useParams, useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import useSWR from "swr";
import useSWRInfinite from "swr/infinite";
import { Users } from "lucide-react";
@@ -21,6 +22,7 @@ const LIMIT = 30;
const DISTRIBUTION_PREFETCH_CAP = 120;
export default function OwnersDirectoryPage() {
+ const t = useTranslations("views.contributors");
const { id } = useParams<{ id: string }>();
const router = useRouter();
const [filters, setFilters] = useState<OwnerDirectoryFilters>({
@@ -75,8 +77,8 @@ export default function OwnersDirectoryPage() {
return (
<PageShell
icon={<Users className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- title="Contributors"
- description="Who knows what, mined from full git history. Ownership follows whoever wrote the surviving lines, not whoever committed last."
+ title={t("title")}
+ description={t("description")}
>
<OwnerDirectory
owners={items}
diff --git a/packages/web/src/app/repos/[id]/refactoring/page.tsx b/packages/web/src/app/repos/[id]/refactoring/page.tsx
index a85b0c5d0..64c372567 100644
--- a/packages/web/src/app/repos/[id]/refactoring/page.tsx
+++ b/packages/web/src/app/repos/[id]/refactoring/page.tsx
@@ -17,6 +17,7 @@ import { use, useCallback, useDeferredValue, useMemo, useState } from "react";
import useSWR from "swr";
import { useRouter } from "next/navigation";
import { parseAsString, parseAsStringLiteral, useQueryState } from "nuqs";
+import { useTranslations } from "next-intl";
import { Wrench, RotateCw } from "lucide-react";
import { PageShell } from "@repowise-dev/ui/shared/page-shell";
import { ViewTabs } from "@repowise-dev/ui/shared/view-tabs";
@@ -79,6 +80,8 @@ function leadTypeFor(type: TypeFilter): string | undefined {
export default function RefactoringPage({ params }: { params: Promise<{ id: string }> }) {
const { id: repoId } = use(params);
const router = useRouter();
+ const t = useTranslations("views.refactoring");
+ const tCommon = useTranslations("common");
const [type, setType] = useQueryState(
"type",
parseAsStringLiteral(TYPE_VALUES).withDefault("all"),
@@ -233,14 +236,14 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
// Summed from the facets, not from the rollup: the facets follow the status
// filter and the rollup does not, so under "Resolved" the rollup would put
// the open total on a tab that lists resolved rows.
- { id: "all" as const, label: "All", badge: facetTotal },
- { id: "structural" as const, label: "Structural", badge: structuralCount },
+ { id: "all" as const, label: t("tabAll"), badge: facetTotal },
+ { id: "structural" as const, label: t("tabStructural"), badge: structuralCount },
...TYPE_ORDER.filter((t) => t !== "performance_fix").map((t) => ({
id: t,
label: typeMeta(t).label,
badge: facetCounts[t] ?? 0,
})),
- ].filter((t) => t.id === "all" || (t.badge ?? 0) > 0);
+ ].filter((tab) => tab.id === "all" || (tab.badge ?? 0) > 0);
const serverState: RefactoringBoardServerState = {
query,
@@ -259,9 +262,9 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
return (
<PageShell
- title="Refactoring"
+ title={t("title")}
icon={<Wrench className="h-5 w-5 text-[var(--color-accent-primary)]" />}
- description="One opportunity per file: the ordered steps the health pass wrote from your code. Open one to see the change, or hand it to a coding agent."
+ description={t("description")}
actions={
<button
type="button"
@@ -269,7 +272,7 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
className="inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs font-medium text-[var(--color-text-secondary)] transition-colors hover:text-[var(--color-text-primary)]"
>
<RotateCw className="h-3.5 w-3.5" />
- Refresh
+ {tCommon("refresh")}
</button>
}
>
@@ -292,8 +295,7 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
>
{error ? (
<div className="rounded-2xl border border-[var(--color-error)]/30 bg-[var(--color-error)]/5 p-6 text-sm text-[var(--color-text-secondary)]">
- Couldn&apos;t load refactoring opportunities. The repo may not be indexed yet, or the
- API is unreachable.
+ {t("loadFailed")}
</div>
) : data?.summary?.status === "unavailable" ? (
<div className="rounded-2xl border border-[var(--color-border-default)] p-6 text-sm text-[var(--color-text-secondary)]">
@@ -301,7 +303,7 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
</div>
) : isLoading ? (
// Matches the real layout's shapes: a lede block, a ribbon, a field.
- <SkeletonRegion className="space-y-8" label="Loading refactoring opportunities">
+ <SkeletonRegion className="space-y-8" label={t("loading")}>
<Skeleton className="h-32 rounded-xl" />
<Skeleton className="h-16 rounded-xl" />
<Skeleton className="h-72 rounded-xl" />
@@ -337,11 +339,11 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
sectionTitle={
type === "all"
? serverState.appliedScope === "fix_first"
- ? "Opportunities worth doing"
- : "All opportunities"
+ ? t("sectionTitleFixFirst")
+ : t("sectionTitleAll")
: type === "structural"
- ? "Structural opportunities"
- : `${typeMeta(type).label} opportunities`
+ ? t("sectionTitleStructural")
+ : t("sectionTitleFiltered", { type: typeMeta(type).label })
}
/>
)}
@@ -395,8 +397,8 @@ export default function RefactoringPage({ params }: { params: Promise<{ id: stri
: null
}
filePath={promptFor?.value.file_path ?? null}
- title="AI refactoring prompt"
- description="A ready-to-paste plan that hands your AI coding agent the ordered steps, which of them are mechanical, the evidence behind the diagnosis, and the id to query it back."
+ title={t("promptTitle")}
+ description={t("promptDescription")}
/>
</PageShell>
);
diff --git a/packages/web/src/app/repos/[id]/settings/page.tsx b/packages/web/src/app/repos/[id]/settings/page.tsx
index c7a2ce378..c949fdaea 100644
--- a/packages/web/src/app/repos/[id]/settings/page.tsx
+++ b/packages/web/src/app/repos/[id]/settings/page.tsx
@@ -12,6 +12,7 @@ import { RepoSettingsFormWrapper as RepoSettingsForm } from "@/components/repos/
import { CoordinatorHealthPanel } from "@/components/repos/coordinator-health-panel";
import { DeleteRepoButton } from "@/components/repos/delete-repo-button";
import { OperationsPanel } from "@/components/repos/operations-panel";
+import { getTranslations } from "next-intl/server";
import { PublishPanel } from "@/components/hosted/publish";
interface Props {
@@ -42,6 +43,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
*/
export default async function RepoSettingsPage({ params }: Props) {
const { id } = await params;
+ const t = await getTranslations("views.repoSettings");
let repo;
try {
@@ -54,50 +56,50 @@ export default async function RepoSettingsPage({ params }: Props) {
return (
<PageShell
- title="Settings"
- description={`Indexing, model keys and health for ${repo.name}. Server, webhook and editor configuration are shared across repositories.`}
+ title={t("title")}
+ description={t("description", { repo: repo.name })}
className="max-w-3xl"
>
<OverviewSection
- title="General"
- description="Where this repository lives and which branch is indexed."
+ title={t("generalTitle")}
+ description={t("generalDescription")}
flush
>
<RepoSettingsForm repo={repo} />
</OverviewSection>
<OverviewSection
- title="Sync and indexing"
- description="Pull recent commits into the existing index, or rebuild it from scratch."
+ title={t("syncTitle")}
+ description={t("syncDescription")}
>
<OperationsPanel repoId={id} repoName={repo.name} />
</OverviewSection>
<OverviewSection
id="provider"
- title="AI provider"
- description="A model key lets this repository's documentation be written with AI. Keys are stored with the repository and used by generation from the UI or the CLI."
+ title={t("providerTitle")}
+ description={t("providerDescription")}
>
<ProviderSettingsPanel repoId={id} />
</OverviewSection>
<OverviewSection
- title="Decision capture"
- description="What mines architectural decisions from this repository, and whether any of it may send prose to your configured model. Capture only ever produces candidates: nothing here can accept a decision on your behalf."
+ title={t("captureTitle")}
+ description={t("captureDescription")}
>
<DecisionCaptureSettingsWrapper repoId={id} />
</OverviewSection>
<OverviewSection
- title="Refactoring code generation"
- description="Opt in to turning refactoring plans into reviewable diffs with your configured model."
+ title={t("refactoringTitle")}
+ description={t("refactoringDescription")}
>
<RefactoringSettingsSection repoId={id} />
</OverviewSection>
<OverviewSection
- title="Index health"
- description="Per-population drift: wiki pages against page vectors, and decision records against decision vectors. A gap means search is answering from a stale set."
+ title={t("healthTitle")}
+ description={t("healthDescription")}
>
<CoordinatorHealthPanel repoId={id} initial={coordinatorHealth} />
</OverviewSection>
@@ -113,12 +115,10 @@ export default async function RepoSettingsPage({ params }: Props) {
the sentence, not on a coloured ground the eye reads before either. */}
<section className="flex flex-col gap-3 border-t border-[var(--color-border-default)] pt-6 sm:pt-8">
<h2 className="text-base font-semibold tracking-tight text-[var(--color-error)]">
- Delete this repository
+ {t("deleteTitle")}
</h2>
<p className="max-w-[62ch] text-xs leading-relaxed text-[var(--color-text-tertiary)] [text-wrap:pretty]">
- Removes the index and everything generated from it — pages, symbols,
- decisions and history. Your source files are untouched. This cannot be
- undone.
+ {t("deleteDescription")}
</p>
<div>
<DeleteRepoButton
@@ -131,14 +131,16 @@ export default async function RepoSettingsPage({ params }: Props) {
</section>
<p className="border-t border-[var(--color-border-default)] pt-6 text-xs text-[var(--color-text-tertiary)]">
- Server connection, webhooks, model defaults and MCP configuration are in{" "}
- <Link
- href="/settings"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- global settings
- </Link>
- .
+ {t.rich("footer", {
+ link: (chunks) => (
+ <Link
+ href="/settings"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })}
</p>
</PageShell>
);
diff --git a/packages/web/src/app/repos/[id]/stats/page.tsx b/packages/web/src/app/repos/[id]/stats/page.tsx
index c2b832d7c..21e881f6b 100644
--- a/packages/web/src/app/repos/[id]/stats/page.tsx
+++ b/packages/web/src/app/repos/[id]/stats/page.tsx
@@ -1,11 +1,15 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
+import { getTranslations } from "next-intl/server";
import { BarChart3 } from "lucide-react";
import { getStatsHighlights } from "@/lib/api/stats";
import { PageShell } from "@repowise-dev/ui/shared";
import { StatsView } from "@/components/stats/stats-view";
-export const metadata: Metadata = { title: "Stats" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("views.stats");
+ return { title: t("title") };
+}
interface Props {
params: Promise<{ id: string }>;
@@ -13,6 +17,7 @@ interface Props {
export default async function StatsPage({ params }: Props) {
const { id } = await params;
+ const t = await getTranslations("views.stats");
let data;
try {
@@ -23,9 +28,9 @@ export default async function StatsPage({ params }: Props) {
return (
<PageShell
- title="By the Numbers"
+ title={t("title")}
icon={<BarChart3 className="h-5 w-5" />}
- description="The things about this codebase you can't see anywhere else: how big it got, when it started, when the work happens, and the records it holds."
+ description={t("description")}
maxWidth="wide"
>
<StatsView data={data} repoId={id} />
diff --git a/packages/web/src/app/settings/page.tsx b/packages/web/src/app/settings/page.tsx
index 99618fc09..a02b21c58 100644
--- a/packages/web/src/app/settings/page.tsx
+++ b/packages/web/src/app/settings/page.tsx
@@ -7,6 +7,7 @@ import { WebhookSection } from "@/components/settings/webhook-section";
import { McpSection } from "@/components/settings/mcp-section";
import { McpToolsSection } from "@/components/settings/mcp-tools-section";
import { DisplaySection } from "@/components/settings/display-section";
+import { getTranslations } from "next-intl/server";
import { HostedNudgeSlot } from "@/components/hosted/hosted-nudge-slot";
export const metadata: Metadata = { title: "Settings" };
@@ -22,11 +23,13 @@ export const metadata: Metadata = { title: "Settings" };
* `max-w-3xl` rather than the default 1280: this is a form, and a control that
* stretches to 1280 loses the relationship between its label and itself.
*/
-export default function SettingsPage() {
+export default async function SettingsPage() {
+ const t = await getTranslations("views.globalSettings");
+
return (
<PageShell
- title="Settings"
- description="How this dashboard reaches your server, which model it defaults to, and what the MCP server offers an agent. Changes save as you make them."
+ title={t("title")}
+ description={t("description")}
className="max-w-3xl"
>
<ConnectionSection />
@@ -38,14 +41,16 @@ export default function SettingsPage() {
<WebhookSection />
<p className="border-t border-[var(--color-border-default)] pt-6 text-xs text-[var(--color-text-tertiary)]">
- Sync schedule, exclude patterns and deletion are per repository, on{" "}
- <Link
- href="/"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- a repo&apos;s own settings page
- </Link>
- .
+ {t.rich("footer", {
+ link: (chunks) => (
+ <Link
+ href="/"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })}
</p>
</PageShell>
);
diff --git a/packages/web/src/app/workspace/co-changes/co-changes-explorer.tsx b/packages/web/src/app/workspace/co-changes/co-changes-explorer.tsx
index 30a01ffde..fb888711d 100644
--- a/packages/web/src/app/workspace/co-changes/co-changes-explorer.tsx
+++ b/packages/web/src/app/workspace/co-changes/co-changes-explorer.tsx
@@ -3,6 +3,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import Link from "next/link";
import useSWR from "swr";
+import { useTranslations } from "next-intl";
import { Search, X } from "lucide-react";
import type { GitMetadataResponse, WorkspaceCoChangeEntry } from "@repowise-dev/api-client/types";
import { OverviewSection } from "@repowise-dev/ui/overview";
@@ -22,7 +23,6 @@ import {
buildCoChangeRepoPairAiPrompt,
} from "@repowise-dev/ui/workspace/co-change-ai-prompt";
import {
- capRule,
coChangeRepoPairId,
nearbyCommits,
type CoChangeCaps,
@@ -44,8 +44,33 @@ interface Props {
initialOpen: string | null;
}
+/** The minimal translator shape the copy helpers below need; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
type PromptTarget = { kind: "file" } | { kind: "repo"; pair: RepoPairSummary } | null;
+/**
+ * The rule that trimmed the stored pairs, as a clause.
+ *
+ * Named here rather than read from `@repowise-dev/ui`, which stays
+ * language-agnostic: the clause is a sentence fragment, so it comes from the
+ * catalog and the caller capitalises it.
+ */
+function capRule(t: Translator, caps: CoChangeCaps): string | null {
+ if (caps.truncatedBy === "per_repo_pair" && caps.perRepoPairCap) {
+ return t("scope.rulePerPair", { cap: caps.perRepoPairCap });
+ }
+ if (caps.truncatedBy === "total" && caps.totalCap) {
+ return caps.perRepoPairCap
+ ? t("scope.ruleTotalWithPerPair", {
+ cap: caps.totalCap,
+ perPair: caps.perRepoPairCap,
+ })
+ : t("scope.ruleTotal", { cap: caps.totalCap });
+ }
+ return caps.truncatedBy ? t("scope.ruleUnknown") : null;
+}
+
const SEARCH_DEBOUNCE_MS = 150;
function flip(cc: WorkspaceCoChangeEntry): WorkspaceCoChangeEntry {
@@ -80,6 +105,7 @@ function syncUrl(pair: string | null, q: string, cc: string | null) {
/** One side's per-repo git facts, or why there are none. Keyed like the docs
* viewer's fetch, so a file already seen there costs nothing here. */
function useFileHistory(repoId: string | undefined, path: string | undefined): Loadable<CoChangeFileHistory> {
+ const t = useTranslations("coChanges");
const { data, error } = useSWR<GitMetadataResponse | null>(
repoId && path ? `git-meta:${repoId}:${path}` : null,
() =>
@@ -93,10 +119,10 @@ function useFileHistory(repoId: string | undefined, path: string | undefined): L
// lets the reconstructed commits be computed once per pair.
return useMemo((): Loadable<CoChangeFileHistory> => {
if (!path) return { state: "loading" };
- if (!repoId) return { state: "unavailable", reason: "Repository not indexed, so no history" };
- if (error) return { state: "unavailable", reason: "History failed to load" };
+ if (!repoId) return { state: "unavailable", reason: t("reason.repoNotIndexed") };
+ if (error) return { state: "unavailable", reason: t("reason.historyFailed") };
if (data === undefined) return { state: "loading" };
- if (data === null) return { state: "unavailable", reason: "No git history indexed for this file" };
+ if (data === null) return { state: "unavailable", reason: t("reason.noGitHistory") };
return {
state: "ready",
data: {
@@ -112,7 +138,7 @@ function useFileHistory(repoId: string | undefined, path: string | undefined): L
})),
},
};
- }, [repoId, path, data, error]);
+ }, [repoId, path, data, error, t]);
}
export function CoChangesExplorer({
@@ -125,6 +151,7 @@ export function CoChangesExplorer({
initialQuery,
initialOpen,
}: Props) {
+ const t = useTranslations("coChanges");
const [selectedPair, setSelectedPair] = useState<string | null>(initialPair);
const [query, setQuery] = useState(initialQuery);
const [debouncedQuery, setDebouncedQuery] = useState(initialQuery);
@@ -191,7 +218,7 @@ export function CoChangesExplorer({
const structure = useMemo(
() =>
structureError
- ? ({ state: "unavailable", reason: "Contract links failed to load, so this pair was not checked." } as const)
+ ? ({ state: "unavailable", reason: t("reason.linksFailed") } as const)
: structureData
? ({
state: "ready",
@@ -259,28 +286,50 @@ export function CoChangesExplorer({
const selected = selectedPair ? repoPairs.find((p) => p.id === selectedPair) ?? null : null;
const trimmed = debouncedQuery.trim();
const inScope = selected ? selected.filePairCount : coChanges.length;
- const rule = capRule(caps);
+ const rule = capRule(t, caps);
const dropped = totalMined - coChanges.length;
+ const scopeValues = {
+ rows: formatNumber(rows.length),
+ scope: formatNumber(inScope),
+ total: formatNumber(totalMined),
+ query: trimmed,
+ };
const scope = [
trimmed
- ? `${formatNumber(rows.length)} of ${formatNumber(inScope)} pairs ${selected ? `in ${selected.repo1} and ${selected.repo2} ` : ""}touch a path matching "${trimmed}", strongest first.`
+ ? selected
+ ? t("scope.filteredInPair", {
+ ...scopeValues,
+ repo1: selected.repo1,
+ repo2: selected.repo2,
+ })
+ : t("scope.filtered", scopeValues)
: selected
- ? `${formatNumber(rows.length)} file pairs in ${selected.repo1} and ${selected.repo2}, strongest first.`
- : `${formatNumber(coChanges.length)} of ${formatNumber(totalMined)} pairs, strongest first.`,
+ ? t("scope.selected", {
+ rows: formatNumber(rows.length),
+ repo1: selected.repo1,
+ repo2: selected.repo2,
+ })
+ : t("scope.all", {
+ rows: formatNumber(rows.length),
+ total: formatNumber(totalMined),
+ }),
rule && dropped > 0
- ? ` ${rule[0]!.toUpperCase()}${rule.slice(1)}, so ${formatNumber(dropped)} weaker pairs across the workspace are not listed.`
+ ? t("scope.capped", {
+ rule: `${rule[0]!.toUpperCase()}${rule.slice(1)}`,
+ dropped: formatNumber(dropped),
+ })
: "",
].join("");
return (
<>
<OverviewSection
- title="Repository pairs"
+ title={t("pairs.title")}
description={
caps.truncatedBy === "per_repo_pair" && caps.perRepoPairCap
- ? `Ranked by their strongest file pair. File pairs stop at ${caps.perRepoPairCap} per repository pair because the miner keeps no more.`
- : "Ranked by their strongest file pair."
+ ? t("pairs.descriptionCapped", { cap: caps.perRepoPairCap })
+ : t("pairs.descriptionRanked")
}
>
<RepoPairTable
@@ -292,12 +341,19 @@ export function CoChangesExplorer({
</OverviewSection>
<OverviewSection
- title={selected ? `Files in ${selected.repo1} and ${selected.repo2}` : "Files that change together"}
+ title={
+ selected
+ ? t("files.titleScoped", {
+ repo1: selected.repo1,
+ repo2: selected.repo2,
+ })
+ : t("files.titleAll")
+ }
description={scope}
>
<div className="flex flex-wrap items-center gap-3">
<label className="relative flex min-w-0 max-w-[420px] flex-1 items-center">
- <span className="sr-only">Filter by file path</span>
+ <span className="sr-only">{t("files.filterLabel")}</span>
<Search
className="pointer-events-none absolute left-2.5 h-3.5 w-3.5 text-[var(--color-text-tertiary)]"
aria-hidden
@@ -306,7 +362,7 @@ export function CoChangesExplorer({
type="search"
value={query}
onChange={(e) => setQuery(e.target.value)}
- placeholder="What changes with this file? Type a path"
+ placeholder={t("files.searchPlaceholder")}
className="h-8 w-full rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] pl-8 pr-3 font-mono text-xs text-[var(--color-text-primary)] placeholder:font-sans placeholder:text-[var(--color-text-tertiary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-primary)]"
/>
</label>
@@ -317,14 +373,17 @@ export function CoChangesExplorer({
className="inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-elevated)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-primary)]"
>
<X className="h-3 w-3" aria-hidden />
- Show all repository pairs
+ {t("files.clearPair")}
</button>
)}
</div>
{rows.length === 0 ? (
<EmptyState
- title="No file pairs match"
- description={`No listed pair touches a path containing "${trimmed}". Only the ${formatNumber(coChanges.length)} strongest pairs are listed, so a weaker partner may exist that is not shown.`}
+ title={t("files.emptyTitle")}
+ description={t("files.emptyDescription", {
+ query: trimmed,
+ count: formatNumber(coChanges.length),
+ })}
/>
) : (
<CoChangeTable coChanges={rows} onSelect={onSelectRow} selectedKey={openKey} />
@@ -364,11 +423,11 @@ export function CoChangesExplorer({
? `${openPair.source_file} and ${openPair.target_file}`
: null
}
- title="AI co-change prompt"
+ title={t("prompt.title")}
description={
prompt?.kind === "repo"
- ? "A ready-to-paste prompt that has your agent group this repository pair's co-changing files by the concept they share and decide which lockstep a contract, shared type or generated client should replace."
- : "A ready-to-paste prompt that has your agent find why these two files change together and whether a contract, shared type or generated client should replace the manual lockstep."
+ ? t("prompt.descriptionRepo")
+ : t("prompt.descriptionFile")
}
/>
</>
diff --git a/packages/web/src/app/workspace/co-changes/page.tsx b/packages/web/src/app/workspace/co-changes/page.tsx
index 0612c8b62..ad1855d44 100644
--- a/packages/web/src/app/workspace/co-changes/page.tsx
+++ b/packages/web/src/app/workspace/co-changes/page.tsx
@@ -1,5 +1,6 @@
import type { Metadata } from "next";
import { GitMerge } from "lucide-react";
+import { getTranslations } from "next-intl/server";
import type { WorkspaceCoChangeEntry } from "@repowise-dev/api-client/types";
import { PageShell } from "@repowise-dev/ui/shared";
import { PageLede } from "@repowise-dev/ui/shared/page-lede";
@@ -11,7 +12,10 @@ import { repoPairId, STRENGTH_DEFINITION } from "@repowise-dev/ui/workspace/co-c
import { getWorkspace, getWorkspaceCoChanges } from "@/lib/api/workspace";
import { CoChangesExplorer } from "./co-changes-explorer";
-export const metadata: Metadata = { title: "Co-changes" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("coChanges");
+ return { title: t("title") };
+}
export const revalidate = 30;
@@ -33,6 +37,7 @@ type Props = {
* pair is a linkable address.
*/
export default async function CoChangesPage({ searchParams }: Props) {
+ const t = await getTranslations("coChanges");
const { pair, q, cc } = await searchParams;
// One wave. The workspace call is what the layout already makes, and it
@@ -52,14 +57,14 @@ export default async function CoChangesPage({ searchParams }: Props) {
}
const icon = <GitMerge className="h-5 w-5 text-[var(--color-text-tertiary)]" />;
- const description = "Files in different repositories that recent commits touched together.";
+ const description = t("description");
if (coChanges.length === 0) {
return (
- <PageShell title="Co-changes" icon={icon} description={description}>
+ <PageShell title={t("title")} icon={icon} description={description}>
<EmptyState
- title="No cross-repo co-changes found"
- description="Co-changes are mined from each repository's git history during a workspace sync. Pairs appear once commits close together in time touch files in two repositories."
+ title={t("emptyTitle")}
+ description={t("emptyDescription")}
icon={<GitMerge className="h-8 w-8" />}
/>
</PageShell>
@@ -79,45 +84,49 @@ export default async function CoChangesPage({ searchParams }: Props) {
// The lede owns the file-pair count, so the ribbon does not repeat it.
const ribbon: RibbonStat[] = [
{
- label: "Repository pairs",
+ label: t("ribbon.repoPairs"),
value: String(repoPairs.length),
- sub: "with shared work sessions",
+ sub: t("ribbon.repoPairsSub"),
},
{
- label: "Strongest pair",
+ label: t("ribbon.strongest"),
value: strongest ? `${strongest.repo1} and ${strongest.repo2}` : "",
- sub: "by its strongest file pair",
+ sub: t("ribbon.strongestSub"),
},
{
- label: "Peak strength",
+ label: t("ribbon.peakStrength"),
value: strongest ? `${Math.round(strongest.maxStrength * 100)}%` : "",
hint: STRENGTH_DEFINITION,
- sub: "the single strongest file pair",
+ sub: t("ribbon.peakStrengthSub"),
},
{
- label: "Sessions per pair",
- value: minFreq === maxFreq ? String(minFreq) : `${minFreq} to ${maxFreq}`,
- sub: "shared work sessions per file pair",
+ label: t("ribbon.sessionsPerPair"),
+ value:
+ minFreq === maxFreq
+ ? String(minFreq)
+ : t("ribbon.sessionsRange", { min: minFreq, max: maxFreq }),
+ sub: t("ribbon.sessionsPerPairSub"),
},
{
- label: "Most recent",
+ label: t("ribbon.mostRecent"),
value: mostRecent ? mostRecent.slice(0, 10) : "",
- sub: "last shared session",
+ sub: t("ribbon.mostRecentSub"),
},
];
return (
- <PageShell title="Co-changes" icon={icon} description={description}>
+ <PageShell title={t("title")} icon={icon} description={description}>
<PageLede
- label="File pairs"
+ label={t("ledeLabel")}
value={formatNumber(coChanges.length)}
- unit={totalMined > coChanges.length ? `of ${formatNumber(totalMined)} found` : "found"}
+ unit={
+ totalMined > coChanges.length
+ ? t("ledeUnitOfFound", { total: formatNumber(totalMined) })
+ : t("ledeUnitFound")
+ }
layout="beside"
>
- <p>
- Files in two repositories that the same author keeps changing in the same work
- sessions: a pattern read from git history, not a declared dependency.
- </p>
+ <p>{t("ledeSentence")}</p>
</PageLede>
<StatRibbon stats={ribbon} />
diff --git a/packages/web/src/app/workspace/conformance/conformance-ai-prompt.tsx b/packages/web/src/app/workspace/conformance/conformance-ai-prompt.tsx
index 036b47232..6949aa73a 100644
--- a/packages/web/src/app/workspace/conformance/conformance-ai-prompt.tsx
+++ b/packages/web/src/app/workspace/conformance/conformance-ai-prompt.tsx
@@ -1,6 +1,7 @@
"use client";
import { useState } from "react";
+import { useTranslations } from "next-intl";
import {
AiPromptButton,
AiPromptModal,
@@ -21,10 +22,11 @@ export function ConformanceAiPrompt({
violations: ConformanceViolation[];
}) {
const [open, setOpen] = useState(false);
+ const t = useTranslations("conformance");
return (
<>
- <AiPromptButton label="Fix violations with AI" onClick={() => setOpen(true)} />
+ <AiPromptButton label={t("aiPrompt.label")} onClick={() => setOpen(true)} />
<AiPromptModal
open={open}
onOpenChange={setOpen}
@@ -43,8 +45,8 @@ export function ConformanceAiPrompt({
flavor,
})
}
- title="AI conformance fix"
- description="A ready-to-paste prompt that has your AI agent resolve these architecture rule violations by removing the disallowed dependencies."
+ title={t("aiPrompt.title")}
+ description={t("aiPrompt.description")}
/>
</>
);
diff --git a/packages/web/src/app/workspace/conformance/page.tsx b/packages/web/src/app/workspace/conformance/page.tsx
index 32f13dbd2..8bd7009b7 100644
--- a/packages/web/src/app/workspace/conformance/page.tsx
+++ b/packages/web/src/app/workspace/conformance/page.tsx
@@ -5,6 +5,7 @@ import type {
ConformanceReport,
ArchitectureMetrics,
} from "@repowise-dev/api-client/types";
+import { getTranslations } from "next-intl/server";
import { PageShell } from "@repowise-dev/ui/shared";
import { PageLede, LedeLink } from "@repowise-dev/ui/shared/page-lede";
import { EmptyState } from "@repowise-dev/ui/shared/empty-state";
@@ -19,20 +20,13 @@ import {
} from "@/lib/api/workspace";
import { ConformanceAiPrompt } from "./conformance-ai-prompt";
-export const metadata: Metadata = { title: "Conformance" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("conformance");
+ return { title: t("title") };
+}
export const revalidate = 30;
-/**
- * The matrix counts a co-change relationship as a filled cell and the ribbon's
- * structural-link figure does not, so the two numbers differ by design and sit
- * a few hundred pixels apart. Reconciled in the copy rather than left for the
- * reader to work out, and stated here rather than changing the shared matrix's
- * own caption, which is accurate for what it counts.
- */
-const DSM_DESCRIPTION =
- "Each filled cell means the row service depends on the column service, tinted by transport. Red cells break a declared rule; amber cells sit on a cycle. The matrix counts co-change relationships too, so its total runs above the structural-link figure above.";
-
/**
* Whether the conformance analyser has ever produced this report.
*
@@ -55,6 +49,8 @@ function reportState(
}
export default async function ConformancePage() {
+ const t = await getTranslations("conformance");
+
const [sg, cf, arch] = await Promise.allSettled([
getWorkspaceSystemGraph(),
getWorkspaceConformance(),
@@ -76,79 +72,84 @@ export default async function ConformancePage() {
const ribbon: RibbonStat[] = [
{
- label: "Services",
+ label: t("ribbon.services"),
value: metrics ? formatNumber(metrics.node_count) : "—",
- sub: "repositories and their sub-packages",
+ sub: t("ribbon.servicesSub"),
},
{
- label: "Structural links",
+ label: t("ribbon.structuralLinks"),
value: metrics ? formatNumber(metrics.structural_edge_count) : "—",
- sub: "contracts and imports, not co-changes",
+ sub: t("ribbon.structuralLinksSub"),
},
{
- label: "Propagation cost",
+ label: t("ribbon.propagationCost"),
value: metrics ? `${metrics.propagation_cost_pct.toFixed(1)}%` : "—",
- sub: "of the system a change can reach",
+ sub: t("ribbon.propagationCostSub"),
},
{
- label: "Core size",
+ label: t("ribbon.coreSize"),
value: metrics ? formatNumber(metrics.core_size) : "—",
sub: metrics
- ? `${Math.round(metrics.core_ratio * 100)}% of all services`
- : "mutually dependent centre",
+ ? t("ribbon.coreSizeSubPct", { pct: Math.round(metrics.core_ratio * 100) })
+ : t("ribbon.coreSizeSub"),
},
{
- label: "Cycles",
+ label: t("ribbon.cycles"),
value: metrics ? formatNumber(cycleCount) : "—",
- sub: "circular service dependencies",
+ sub: t("ribbon.cyclesSub"),
},
];
return (
<PageShell
- title="Conformance"
+ title={t("title")}
icon={<ShieldCheck className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="How the workspace is shaped, and whether it obeys the dependency rules you declared."
+ description={t("description")}
>
<PageLede
- label="Architecture score"
+ label={t("ledeLabel")}
value={metrics ? metrics.score.toFixed(1) : "—"}
- unit="out of 10"
+ unit={t("ledeUnit")}
{...(metrics?.architecture_type
? { band: { label: metrics.architecture_type } }
: {})}
layout="beside"
action={
<LedeLink href="/workspace/system-map" LinkComponent={Link}>
- See the system map
+ {t("ledeSeeSystemMap")}
</LedeLink>
}
>
{metrics ? (
<p>
- A change here can reach {metrics.propagation_cost_pct.toFixed(1)}% of the system
- through {formatNumber(metrics.structural_edge_count)} structural links between{" "}
- {formatNumber(metrics.node_count)} services. The score weighs that reach against
- the size of the mutually dependent core and any cycles; it is computed from the
- system graph on every request, so it does not depend on the check below having run.
+ {t("ledeSentence", {
+ pct: metrics.propagation_cost_pct.toFixed(1),
+ links: formatNumber(metrics.structural_edge_count),
+ services: formatNumber(metrics.node_count),
+ })}
</p>
) : (
- <p>
- No system graph has been built yet, so there is nothing to measure. Run a workspace
- sync to build one.
- </p>
+ <p>{t("ledeNoGraph")}</p>
)}
- {ruleSentence(state, report)}
+ <RuleSentence state={state} report={report} />
</PageLede>
<StatRibbon stats={ribbon} />
+ {/*
+ The matrix counts a co-change relationship as a filled cell and the
+ ribbon's structural-link figure does not, so the two numbers differ by
+ design and sit a few hundred pixels apart. Reconciled in
+ `dsmDescription` rather than left for the reader to work out, and
+ stated there rather than changing the shared matrix's own caption,
+ which is accurate for what it counts.
+ */}
<OverviewSection
- title="Dependency-structure matrix"
- description={DSM_DESCRIPTION}
+ title={t("dsmTitle")}
+ description={t("dsmDescription")}
action={
<SectionLink href="/workspace/system-map" LinkComponent={Link}>
- System map
+ {t("dsmSystemMapLink")}
</SectionLink>
}
>
@@ -157,9 +158,11 @@ export default async function ConformancePage() {
<OverviewSection
title={
- state === "checked" ? `Rule violations (${violations.length})` : "Rule violations"
+ state === "checked"
+ ? t("violationsTitleCount", { count: violations.length })
+ : t("violationsTitle")
}
- description="Dependencies that exist in the graph but are forbidden by a rule you declared."
+ description={t("violationsDescription")}
{...(violations.length > 0
? { action: <ConformanceAiPrompt violations={violations} /> }
: {})}
@@ -188,7 +191,7 @@ export default async function ConformancePage() {
</span>
</div>
<p className="mt-1 text-xs text-[var(--color-text-secondary)]">
- Breaks{" "}
+ {t("violationBreaks")}{" "}
<span className="font-mono text-[var(--color-warning)]">
{v.rule_source} !&gt; {v.rule_target}
</span>
@@ -201,21 +204,21 @@ export default async function ConformancePage() {
</OverviewSection>
<OverviewSection
- title={`Dependency cycles (${cycleCount})`}
- description="Groups of services that depend on each other in a loop, so none of them can be changed or deployed independently."
+ title={t("cyclesTitle", { count: cycleCount })}
+ description={t("cyclesDescription")}
>
{cycles.length === 0 ? (
<EmptyState
className="p-6"
title={
cycleCount > 0
- ? `${cycleCount} ${cycleCount === 1 ? "cycle" : "cycles"} detected, but not listed`
- : "No circular dependencies"
+ ? t("cyclesDetectedNotListed", { count: cycleCount })
+ : t("noCyclesTitle")
}
description={
cycleCount > 0
- ? "The count is recomputed from the system graph, but the services in each cycle are recorded by the conformance check. Run it to see which services are involved."
- : "Every dependency in the graph runs one way. Nothing has to be changed in lockstep."
+ ? t("cyclesUnlistedDescription")
+ : t("noCyclesDescription")
}
/>
) : (
@@ -223,7 +226,7 @@ export default async function ConformancePage() {
{cycles.map((c) => (
<li key={c.nodes.join("->")} className="py-3.5">
<p className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
- {c.length} services
+ {t("cycleServices", { count: c.length })}
</p>
<p className="mt-1 text-sm text-[var(--color-text-primary)] [overflow-wrap:anywhere]">
{c.nodes.join(" → ")} → {c.nodes[0]}
@@ -238,41 +241,52 @@ export default async function ConformancePage() {
}
/** The sentence in the lede that says whether the check has anything to say. */
-function ruleSentence(
- state: ReturnType<typeof reportState>,
- report: ConformanceReport | null,
-) {
+async function RuleSentence({
+ state,
+ report,
+}: {
+ state: ReturnType<typeof reportState>;
+ report: ConformanceReport | null;
+}) {
+ const t = await getTranslations("conformance");
if (state === "checked") {
const n = report?.rules_evaluated ?? 0;
const v = report?.violations?.length ?? 0;
return (
<p>
- {formatNumber(n)} declared {n === 1 ? "rule was" : "rules were"} checked against that
- graph, and {v === 0 ? "nothing breaks them" : `${formatNumber(v)} ${v === 1 ? "dependency breaks" : "dependencies break"} them`}.
+ {v === 0
+ ? t("ruleCheckedClean", { rules: n })
+ : t("ruleCheckedViolations", { rules: n, violations: v })}
</p>
);
}
if (state === "no_rules") {
return (
<p>
- The check has run, but no dependency rules are declared, so it had nothing to enforce.
- Add a <code className="font-mono text-[var(--color-text-primary)]">conformance:</code>{" "}
- block to{" "}
- <code className="font-mono text-[var(--color-text-primary)]">
- .repowise-workspace.yaml
- </code>{" "}
- to describe which services may depend on which.
+ {t.rich("ruleNoneDeclared", {
+ c: (chunks) => (
+ <code className="font-mono text-[var(--color-text-primary)]">
+ {chunks}
+ </code>
+ ),
+ f: (chunks) => (
+ <code className="font-mono text-[var(--color-text-primary)]">
+ {chunks}
+ </code>
+ ),
+ })}
</p>
);
}
return (
<p>
- The conformance check has not run on this workspace yet, so nothing below is a verdict —
- an empty violations list here means unmeasured, not clean. Run{" "}
- <code className="font-mono text-[var(--color-text-primary)]">
- repowise workspace check
- </code>{" "}
- to evaluate it.
+ {t.rich("ruleNeverRan", {
+ c: (chunks) => (
+ <code className="font-mono text-[var(--color-text-primary)]">
+ {chunks}
+ </code>
+ ),
+ })}
</p>
);
}
@@ -283,13 +297,18 @@ function ruleSentence(
* Collapsing them into one "no violations" message is the failure this page
* shipped with: the artifact's zeros are written before anything runs.
*/
-function ViolationsEmptyState({ state }: { state: ReturnType<typeof reportState> }) {
+async function ViolationsEmptyState({
+ state,
+}: {
+ state: ReturnType<typeof reportState>;
+}) {
+ const t = await getTranslations("conformance");
if (state === "checked") {
return (
<EmptyState
className="p-6"
- title="No rules are broken"
- description="Every dependency in the graph is allowed by the rules you declared."
+ title={t("emptyNoRulesBrokenTitle")}
+ description={t("emptyNoRulesBrokenDescription")}
/>
);
}
@@ -297,8 +316,8 @@ function ViolationsEmptyState({ state }: { state: ReturnType<typeof reportState>
return (
<EmptyState
className="p-6"
- title="No rules declared"
- description="Nothing has been forbidden yet, so nothing can be violated. Declare which services may depend on which under `conformance:` in .repowise-workspace.yaml, then run `repowise workspace check` to gate CI on it."
+ title={t("emptyNoRulesDeclaredTitle")}
+ description={t("emptyNoRulesDeclaredDescription")}
/>
);
}
@@ -306,16 +325,16 @@ function ViolationsEmptyState({ state }: { state: ReturnType<typeof reportState>
return (
<EmptyState
className="p-6"
- title="Not checked yet"
- description="The conformance analyser has not run on this workspace, so no rules have been evaluated. This is not a clean bill of health — run `repowise workspace check` to produce one."
+ title={t("emptyNotCheckedTitle")}
+ description={t("emptyNotCheckedDescription")}
/>
);
}
return (
<EmptyState
className="p-6"
- title="Conformance report unavailable"
- description="The report could not be read. Run a workspace sync to rebuild it."
+ title={t("emptyUnavailableTitle")}
+ description={t("emptyUnavailableDescription")}
/>
);
}
diff --git a/packages/web/src/app/workspace/contracts/breaking-changes-section.tsx b/packages/web/src/app/workspace/contracts/breaking-changes-section.tsx
index 16f6f6280..4b3d30060 100644
--- a/packages/web/src/app/workspace/contracts/breaking-changes-section.tsx
+++ b/packages/web/src/app/workspace/contracts/breaking-changes-section.tsx
@@ -1,5 +1,6 @@
"use client";
+import { useTranslations } from "next-intl";
import { BreakingChangesView } from "@repowise-dev/ui/workspace/breaking-changes-view";
import { OverviewSection } from "@repowise-dev/ui/overview/section";
import { fileEntityPath, symbolEntityPath } from "@repowise-dev/ui/shared/entity";
@@ -21,6 +22,7 @@ export function BreakingChangesSection({
/** Repo alias to indexed repo id; a never-indexed repo's references stay text. */
repoIds: Record<string, string>;
}) {
+ const t = useTranslations("contracts");
const open = useOpenContract();
const { data, isLoading } = useWorkspaceBreakingChanges();
const hasFindings = (data?.changes.length ?? 0) > 0;
@@ -32,13 +34,8 @@ export function BreakingChangesSection({
return (
<OverviewSection
- title="Breaking changes"
- {...(hasFindings
- ? {
- description:
- "Provider contracts that changed in the most recent workspace update, and the consumers linked to them. Breaking first, then warnings.",
- }
- : {})}
+ title={t("breaking.title")}
+ {...(hasFindings ? { description: t("breaking.description") } : {})}
>
<BreakingChangesView
report={data}
diff --git a/packages/web/src/app/workspace/contracts/contract-filters.tsx b/packages/web/src/app/workspace/contracts/contract-filters.tsx
index 238cd3062..9c693022f 100644
--- a/packages/web/src/app/workspace/contracts/contract-filters.tsx
+++ b/packages/web/src/app/workspace/contracts/contract-filters.tsx
@@ -1,6 +1,7 @@
"use client";
import { useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import { useEffect, useRef, useState, useTransition } from "react";
import { Search } from "lucide-react";
import { PaginationControls } from "@repowise-dev/ui/shared/pagination-controls";
@@ -15,6 +16,9 @@ const ALL_TYPES = ["http", "grpc", "socket", "topic", "data", "code"];
/** Keystrokes settle for this long before the list is re-fetched. */
const SEARCH_DEBOUNCE_MS = 300;
+/** The minimal translator shape `typeTabs` needs; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
/**
* The type tabs, from the workspace-wide distribution rather than the
* vocabulary: a tab that can never return a row is a control that cannot act.
@@ -22,7 +26,11 @@ const SEARCH_DEBOUNCE_MS = 300;
* every other tab. A type someone linked to stays, so the URL never selects a
* tab that is not drawn.
*/
-function typeTabs(byType: Record<string, number> | null, selected: string) {
+function typeTabs(
+ t: Translator,
+ byType: Record<string, number> | null,
+ selected: string,
+) {
const known = byType ? ALL_TYPES.filter((t) => (byType[t] ?? 0) > 0) : ALL_TYPES;
const extra = byType
? Object.keys(byType).filter((t) => !ALL_TYPES.includes(t) && byType[t]! > 0)
@@ -31,7 +39,7 @@ function typeTabs(byType: Record<string, number> | null, selected: string) {
if (selected && !values.includes(selected)) values.push(selected);
const total = byType ? Object.values(byType).reduce((a, b) => a + b, 0) : null;
return [
- { id: "", label: "All", ...(total != null ? { badge: formatNumber(total) } : {}) },
+ { id: "", label: t("filters.allTypes"), ...(total != null ? { badge: formatNumber(total) } : {}) },
...values.map((t) => ({
id: t,
label: contractTypeLabel(t),
@@ -58,6 +66,7 @@ export function ContractListControls({
/** Workspace-wide contracts per type, from `contract_summary`. */
byType: Record<string, number> | null;
}) {
+ const t = useTranslations("contracts");
const router = useRouter();
const [pending, startTransition] = useTransition();
const [text, setText] = useState(filters.q ?? "");
@@ -98,14 +107,14 @@ export function ContractListControls({
return (
<div className="flex flex-col gap-3">
<ViewTabs
- aria-label="Contract type"
- tabs={typeTabs(byType, filters.type ?? "")}
+ aria-label={t("filters.typeAria")}
+ tabs={typeTabs(t, byType, filters.type ?? "")}
value={filters.type ?? ""}
onValueChange={(type) => go({ ...filters, type })}
/>
<div className="flex flex-wrap items-center gap-2" aria-busy={pending}>
<label className="relative min-w-[220px] flex-1">
- <span className="sr-only">Search contracts</span>
+ <span className="sr-only">{t("filters.searchLabel")}</span>
<Search
className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--color-text-tertiary)]"
aria-hidden
@@ -114,13 +123,13 @@ export function ContractListControls({
type="search"
value={text}
onChange={(e) => setText(e.target.value)}
- placeholder="Search path, table, file, symbol or service"
+ placeholder={t("filters.searchPlaceholder")}
className={`${SELECT_CLASS} w-full pl-8`}
/>
</label>
<label className="sr-only" htmlFor="contract-repo">
- Repository
+ {t("filters.repoLabel")}
</label>
<select
id="contract-repo"
@@ -128,7 +137,7 @@ export function ContractListControls({
value={filters.repo ?? ""}
onChange={(e) => go({ ...filters, repo: e.target.value })}
>
- <option value="">All repositories</option>
+ <option value="">{t("filters.allRepos")}</option>
{repos.map((r) => (
<option key={r} value={r}>
{r}
@@ -137,7 +146,7 @@ export function ContractListControls({
</select>
<label className="sr-only" htmlFor="contract-role">
- Role
+ {t("filters.roleLabel")}
</label>
<select
id="contract-role"
@@ -145,13 +154,13 @@ export function ContractListControls({
value={filters.role ?? ""}
onChange={(e) => go({ ...filters, role: e.target.value })}
>
- <option value="">Providers and consumers</option>
- <option value="provider">Providers</option>
- <option value="consumer">Consumers</option>
+ <option value="">{t("filters.roleAll")}</option>
+ <option value="provider">{t("filters.roleProviders")}</option>
+ <option value="consumer">{t("filters.roleConsumers")}</option>
</select>
<label className="sr-only" htmlFor="contract-linked">
- Link
+ {t("filters.linkedLabel")}
</label>
<select
id="contract-linked"
@@ -159,14 +168,14 @@ export function ContractListControls({
value={filters.linked ?? ""}
onChange={(e) => go({ ...filters, linked: e.target.value })}
>
- <option value="">Linked or not</option>
- <option value="yes">On a matched link</option>
- <option value="no">On no link</option>
+ <option value="">{t("filters.linkedAll")}</option>
+ <option value="yes">{t("filters.linkedYes")}</option>
+ <option value="no">{t("filters.linkedNo")}</option>
</select>
{pending ? (
<span className="text-[10px] text-[var(--color-text-tertiary)]" role="status">
- Updating...
+ {t("filters.updating")}
</span>
) : null}
</div>
@@ -188,6 +197,7 @@ export function ContractListPager({
shown: number;
total: number;
}) {
+ const t = useTranslations("contracts");
const router = useRouter();
const to = (p: number) =>
router.push(contractsListHref({ ...filters, page: p }), { scroll: false });
@@ -197,7 +207,7 @@ export function ContractListPager({
offset={offset}
shown={shown}
total={total}
- label="contracts"
+ label={t("pager.label")}
onPrevious={page > 1 ? () => to(page - 1) : undefined}
onNext={offset + shown < total ? () => to(page + 1) : undefined}
/>
diff --git a/packages/web/src/app/workspace/contracts/detail/contract-body.tsx b/packages/web/src/app/workspace/contracts/detail/contract-body.tsx
index 1c81ed70c..377de2358 100644
--- a/packages/web/src/app/workspace/contracts/detail/contract-body.tsx
+++ b/packages/web/src/app/workspace/contracts/detail/contract-body.tsx
@@ -1,5 +1,6 @@
import type { ReactNode } from "react";
import Link from "next/link";
+import { getTranslations } from "next-intl/server";
import type {
WorkspaceContractDetail,
WorkspaceContractEntry,
@@ -18,12 +19,9 @@ import {
contractLede,
contractMetaEntries,
contractMetaLabel,
+ contractMetaString,
flattenSchemaFields,
- providerLinkedProse,
schemaFieldConstraints,
- unlinkedProviderProse,
- unmatchedConsumerProse,
- unmatchedReasonCopy,
} from "@repowise-dev/ui/workspace/contract-facts";
import { fileEntityPath } from "@repowise-dev/ui/shared/entity";
import { ContractPromptButton } from "@repowise-dev/ui/workspace/contract-prompt-button";
@@ -52,7 +50,8 @@ interface Props {
testImpactError?: string | null;
}
-export function ContractBody({ detail, repoIds, testImpact, testImpactError }: Props) {
+export async function ContractBody({ detail, repoIds, testImpact, testImpactError }: Props) {
+ const t = await getTranslations("contracts");
const { contract, links, unmatched_reason: unmatchedReason } = detail;
const isProvider = contract.role === "provider";
const schema = asContractSchema(detail.contract_schema);
@@ -63,14 +62,14 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
href="/workspace/contracts"
className="text-xs font-medium text-[var(--color-accent-primary)] hover:underline"
>
- <span aria-hidden>&larr;</span> Contracts
+ <span aria-hidden>&larr;</span> {t("detail.back")}
</Link>
<header className="mt-6 flex flex-col gap-3">
<p className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
- {contractTypeLabel(contract.contract_type)} contract
+ {contractTypeLabel(contract.contract_type)} {t("detail.typeContract")}
<span className="mx-2 text-[var(--color-border-hover)]">/</span>
- {isProvider ? "Provider" : "Consumer"}
+ {isProvider ? t("detail.roleProvider") : t("detail.roleConsumer")}
</p>
<h1 className="text-[2rem] font-semibold leading-tight tracking-tight text-[var(--color-text-primary)] [overflow-wrap:anywhere]">
{contractHeading(contract)}
@@ -88,16 +87,16 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
</header>
<Section
- title={isProvider ? "Declared here" : "Called here"}
+ title={isProvider ? t("detail.declaredHere") : t("detail.calledHere")}
description={
isProvider
- ? "Where this contract is declared, and how confident extraction is that this is the declaration."
- : "The call site, and how confident extraction is that it names this contract."
+ ? t("detail.declaredHereDescription")
+ : t("detail.calledHereDescription")
}
>
<Facts>
- <Fact label="Repository">{contract.repo}</Fact>
- <Fact label="File">
+ <Fact label={t("detail.fact.repository")}>{contract.repo}</Fact>
+ <Fact label={t("detail.fact.file")}>
<FileRef
repo={contract.repo}
path={contract.file_path}
@@ -105,19 +104,21 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
repoIds={repoIds}
/>
</Fact>
- {contract.service && <Fact label="Service">{contract.service}</Fact>}
- <Fact label="Symbol">
+ {contract.service && (
+ <Fact label={t("detail.fact.service")}>{contract.service}</Fact>
+ )}
+ <Fact label={t("detail.fact.symbol")}>
{/* The extractor's own string, dialect prefix included: it is what
names the framework that matched, and shortening it would hide
the difference between a route declaration and a client call. */}
<span className="font-mono text-xs [overflow-wrap:anywhere]">
- {contract.symbol_name || "None recorded"}
+ {contract.symbol_name || t("detail.symbolNone")}
</span>
</Fact>
- <Fact label="Confidence">
+ <Fact label={t("detail.fact.confidence")}>
<span className="tabular-nums">{Math.round(contract.confidence * 100)}%</span>
</Fact>
- <Fact label="Contract id">
+ <Fact label={t("detail.fact.contractId")}>
<span className="font-mono text-xs [overflow-wrap:anywhere]">
{contract.contract_id}
</span>
@@ -141,8 +142,8 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
<SchemaSection contract={contract} schema={schema} />
<Section
- title="How it was found"
- description="What the extractor recorded about this contract. The layer is the part worth reading: an index contract came from the parsed symbol table, a regex one from a text dialect, which is where recall is least certain."
+ title={t("detail.howFound")}
+ description={t("detail.howFoundDescription")}
>
<Facts>
{contractMetaEntries(contract.meta).map(([key, value]) => (
@@ -151,9 +152,9 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
</Fact>
))}
{contractMetaEntries(contract.meta).length === 0 && (
- <Fact label="Detail">
+ <Fact label={t("detail.fact.detail")}>
<span className="text-[var(--color-text-tertiary)]">
- The extractor recorded none.
+ {t("detail.extractorNone")}
</span>
</Fact>
)}
@@ -167,7 +168,85 @@ export function ContractBody({ detail, repoIds, testImpact, testImpactError }: P
// The link section, and the states a contract can be in
// ---------------------------------------------------------------------------
-function LinkSection({
+/** The minimal translator shape the prose helpers below need; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
+/**
+ * The unmatched-reason titles.
+ *
+ * The prose helpers in `@repowise-dev/ui` carry this copy for the browser and
+ * stay language-agnostic, so the label is named on this side instead of read
+ * out of the shared package.
+ */
+const REASON_TITLE_KEYS: Record<string, string> = {
+ no_provider: "detail.reasonTitle.no_provider",
+ unlinked: "detail.reasonTitle.unlinked",
+ internal_only: "detail.reasonTitle.internal_only",
+ external_host: "detail.reasonTitle.external_host",
+};
+
+/**
+ * A provider nothing calls, which is the ordinary state of exported code.
+ *
+ * The sentence is composed here rather than in `packages/ui` so it follows the
+ * page's locale; the excluded set is what the matcher leaves out by design.
+ */
+function unmatchedProviderDescription(
+ t: Translator,
+ contract: WorkspaceContractEntry,
+): string {
+ return contract.service
+ ? t("detail.prose.unlinkedProviderWithService", {
+ repo: contract.repo,
+ service: contract.service,
+ })
+ : t("detail.prose.unlinkedProvider", { repo: contract.repo });
+}
+
+/** One consumer's unmatched state as a paragraph, with the concrete next step. */
+function unmatchedConsumerDescription(
+ t: Translator,
+ reason: string | null,
+ contract: WorkspaceContractEntry,
+): string {
+ const host = contractMetaString(contract.meta, "host");
+ switch (reason) {
+ case "external_host":
+ return host
+ ? t("detail.prose.unmatchedExternalHost", { host })
+ : t("detail.prose.unmatchedExternalHostGeneric");
+ case "internal_only":
+ return t("detail.prose.unmatchedInternalOnly");
+ case "no_provider":
+ return t("detail.prose.unmatchedNoProvider", {
+ contract: contractHeading(contract),
+ });
+ case "unlinked":
+ return t("detail.prose.unmatchedUnlinked");
+ default:
+ return t("detail.prose.unmatchedDefault");
+ }
+}
+
+/** How many call sites resolve to a provider, and from where. */
+function linkedProviderDescription(
+ t: Translator,
+ links: { consumer_repo: string }[],
+ repo: string,
+): string {
+ const repos = new Set(links.map((l) => l.consumer_repo));
+ if (repos.size === 1 && repos.has(repo)) {
+ return links.length === 1
+ ? t("detail.prose.linkedFromOne", { calls: links.length, repo })
+ : t("detail.prose.linkedAllFromOne", { calls: links.length, repo });
+ }
+ return t("detail.prose.linkedAcross", {
+ calls: links.length,
+ repos: repos.size,
+ });
+}
+
+async function LinkSection({
contract,
links,
unmatchedReason,
@@ -178,16 +257,21 @@ function LinkSection({
unmatchedReason: string | null;
repoIds: Record<string, string>;
}) {
+ const t = await getTranslations("contracts");
const isProvider = contract.role === "provider";
if (links.length === 0) {
return (
<Section
- title={isProvider ? "No caller found" : unmatchedReasonCopy(unmatchedReason).title}
+ title={
+ isProvider
+ ? t("detail.noCallerFound")
+ : t(REASON_TITLE_KEYS[unmatchedReason ?? ""] ?? "detail.reasonTitle.unknown")
+ }
description={
isProvider
- ? unlinkedProviderProse(contract)
- : unmatchedConsumerProse(unmatchedReason, contract)
+ ? unmatchedProviderDescription(t, contract)
+ : unmatchedConsumerDescription(t, unmatchedReason, contract)
}
/>
);
@@ -195,11 +279,11 @@ function LinkSection({
return (
<Section
- title={isProvider ? "Callers" : "Served by"}
+ title={isProvider ? t("detail.callers") : t("detail.servedBy")}
description={
isProvider
- ? providerLinkedProse(links, contract.repo)
- : "This call resolves to the code that serves it. A match joins a call site to a declaration; it does not mean the two were written against a shared schema."
+ ? linkedProviderDescription(t, links, contract.repo)
+ : t("detail.servedByDescription")
}
>
<LinkTable links={links} side={isProvider ? "consumer" : "provider"} repoIds={repoIds} />
@@ -207,7 +291,7 @@ function LinkSection({
);
}
-function LinkTable({
+async function LinkTable({
links,
side,
repoIds,
@@ -216,6 +300,7 @@ function LinkTable({
side: "provider" | "consumer";
repoIds: Record<string, string>;
}) {
+ const t = await getTranslations("contracts");
// A local table rather than `ContractLinksTable`: that one leads with the
// contract id and its type, and on this page both of those are the heading.
// What is left to say is the other side of each link.
@@ -223,19 +308,21 @@ function LinkTable({
<TableScroll>
<table className="w-full border-collapse text-left">
<caption className="sr-only">
- {side === "provider" ? "Providers serving this call" : "Call sites resolving here"}
+ {side === "provider"
+ ? t("detail.caption.providersServing")
+ : t("detail.caption.callSites")}
</caption>
<thead>
<tr className="text-xs uppercase tracking-wider text-[var(--color-text-tertiary)]">
- <Th>Repository</Th>
- <Th>File</Th>
+ <Th>{t("detail.fact.repository")}</Th>
+ <Th>{t("detail.fact.file")}</Th>
{/* Column priority, as the shared tables run it: below md only
the repository and the path survive, because three wrapping
mono columns in 358px break a path mid-token to make room for
a symbol nobody came here to read. */}
- <Th className="max-md:hidden">Symbol</Th>
- <Th className="max-lg:hidden">Match</Th>
- <Th className="max-md:hidden">Confidence</Th>
+ <Th className="max-md:hidden">{t("detail.fact.symbol")}</Th>
+ <Th className="max-lg:hidden">{t("detail.col.match")}</Th>
+ <Th className="max-md:hidden">{t("detail.fact.confidence")}</Th>
</tr>
</thead>
<tbody>
@@ -298,52 +385,58 @@ function LinkTable({
* stops, so a response table would be an empty box under every contract that
* has one. Naming what would fill it is the whole content of the absent case.
*/
-function SchemaSection({
+async function SchemaSection({
contract,
schema,
}: {
contract: WorkspaceContractEntry;
schema: ContractSchema | null;
}) {
+ const t = await getTranslations("contracts");
if (!schema) {
- return <Section title="Shape" description={noSchemaProse(contract.contract_type)} />;
+ return <Section title={t("detail.shape")} description={noSchemaProse(t, contract.contract_type)} />;
}
const hasRequest = schema.request_fields.length > 0;
const hasResponse = schema.response_fields.length > 0;
return (
- <Section title="Shape" description={schemaProse(schema.source, hasResponse)}>
- {hasRequest && <FieldTable caption="Request" fields={schema.request_fields} />}
- {hasResponse && <FieldTable caption="Response" fields={schema.response_fields} />}
+ <Section title={t("detail.shape")} description={schemaProse(t, schema.source, hasResponse)}>
+ {hasRequest && (
+ <FieldTable caption={t("detail.field.request")} fields={schema.request_fields} />
+ )}
+ {hasResponse && (
+ <FieldTable caption={t("detail.field.response")} fields={schema.response_fields} />
+ )}
{!hasRequest && !hasResponse && (
<p className="text-sm text-[var(--color-text-tertiary)]">
- The reader produced a shape with no fields in it.
+ {t("detail.shapeEmptyFields")}
</p>
)}
</Section>
);
}
-function schemaProse(source: string, hasResponse: boolean): string {
- const head = `Recovered by the ${source} reader.`;
+function schemaProse(t: Translator, source: string, hasResponse: boolean): string {
+ const head = t("detail.schema.recovered", { source });
if (hasResponse) {
- return `${head} Fields are what the declaration names, not what any one caller passes.`;
+ return t("detail.schema.withResponse", { head });
}
if (source === "signature") {
- return `${head} It reads a declaration's parameters and stops there, so there is no return shape below; a response would have to come from an OpenAPI or proto declaration.`;
+ return t("detail.schema.signature", { head });
}
- return `${head} It recovered no return shape for this contract.`;
+ return t("detail.schema.noReturn", { head });
}
-function noSchemaProse(type: string): string {
+function noSchemaProse(t: Translator, type: string): string {
if (type === "data") {
- return "A table contract carries no field shape. It is matched on the table name, and nothing on that path reads a column list, so this section is empty for every table contract rather than for this one in particular.";
+ return t("detail.schema.dataTable");
}
- return "No reader recovered a shape for this contract. A shape comes off a typed declaration, so an untyped signature, a route declared through a decorator alone, or a file the index never parsed all arrive here without one.";
+ return t("detail.schema.noReader");
}
-function FieldTable({ caption, fields }: { caption: string; fields: SchemaField[] }) {
+async function FieldTable({ caption, fields }: { caption: string; fields: SchemaField[] }) {
+ const t = await getTranslations("contracts");
const rows = flattenSchemaFields(fields);
return (
<TableScroll>
@@ -353,9 +446,9 @@ function FieldTable({ caption, fields }: { caption: string; fields: SchemaField[
</caption>
<thead>
<tr className="text-xs uppercase tracking-wider text-[var(--color-text-tertiary)]">
- <Th>Field</Th>
- <Th>Type</Th>
- <Th>Required</Th>
+ <Th>{t("detail.field.field")}</Th>
+ <Th>{t("detail.field.type")}</Th>
+ <Th>{t("detail.field.required")}</Th>
</tr>
</thead>
<tbody>
@@ -466,7 +559,7 @@ function Td({ children, className }: { children: ReactNode; className?: string }
* href because the file page takes no line parameter, and a link that lands
* nowhere near the number it names is worse than the number on its own.
*/
-function FileRef({
+async function FileRef({
repo,
path,
line,
@@ -477,6 +570,7 @@ function FileRef({
line: number | null;
repoIds: Record<string, string>;
}) {
+ const t = await getTranslations("contracts");
const repoId = repoIds[repo];
const text = <span className="font-mono text-xs [overflow-wrap:anywhere]">{path}</span>;
return (
@@ -493,7 +587,7 @@ function FileRef({
)}
{line != null && (
<span className="ml-2 text-xs tabular-nums text-[var(--color-text-tertiary)]">
- line {line}
+ {t("detail.line", { line })}
</span>
)}
</span>
diff --git a/packages/web/src/app/workspace/contracts/links-table.tsx b/packages/web/src/app/workspace/contracts/links-table.tsx
index 8524aca20..a74d99758 100644
--- a/packages/web/src/app/workspace/contracts/links-table.tsx
+++ b/packages/web/src/app/workspace/contracts/links-table.tsx
@@ -1,6 +1,7 @@
"use client";
import { useCallback } from "react";
+import { useTranslations } from "next-intl";
import useSWR from "swr";
import { OverviewSection } from "@repowise-dev/ui/overview/section";
import { ContractLinksTable } from "@repowise-dev/ui/workspace/contract-links-table";
@@ -9,6 +10,12 @@ import type { WorkspaceContractLinkEntry } from "@/lib/api/types";
import { getWorkspaceContracts } from "@/lib/api/workspace";
import { useOpenContract } from "./contract-drawer-host";
+/** The minimal translator shape `linksDescription` needs; next-intl's `t` fits. */
+type Translator = (
+ key: string,
+ values?: Record<string, string | number>,
+) => string;
+
/**
* The matched links, fetched here rather than on the server page.
*
@@ -27,6 +34,7 @@ export function LinksSection({
repo?: string | undefined;
q?: string | undefined;
}) {
+ const t = useTranslations("contracts");
const open = useOpenContract();
const { data, error, isLoading } = useSWR(
["workspace:contract-links", type ?? "", repo ?? "", q ?? ""],
@@ -47,15 +55,15 @@ export function LinksSection({
return (
<OverviewSection
- title="Matched links"
- {...(data ? { description: linksDescription(links, filtered) } : {})}
+ title={t("links.title")}
+ {...(data ? { description: linksDescription(t, links, filtered) } : {})}
>
{error ? (
<p className="text-xs text-[var(--color-text-secondary)]">
- The matched links could not be loaded. Reload to try again.
+ {t("links.loadFailed")}
</p>
) : !data ? (
- <p className="text-xs text-[var(--color-text-secondary)]">Loading matched links...</p>
+ <p className="text-xs text-[var(--color-text-secondary)]">{t("links.loading")}</p>
) : (
<ContractLinksTable links={links} onSelect={onSelect} />
)}
@@ -64,15 +72,19 @@ export function LinksSection({
}
/** Name the match basis once, since it is the same word on nearly every row. */
-function linksDescription(links: { match_type: string }[], filtered: boolean): string {
+function linksDescription(
+ t: Translator,
+ links: { match_type: string }[],
+ filtered: boolean,
+): string {
const byType = new Map<string, number>();
for (const l of links) byType.set(l.match_type, (byType.get(l.match_type) ?? 0) + 1);
const basis =
byType.size === 1 && byType.has("exact")
- ? `All ${formatNumber(links.length)} are exact matches.`
- : [...byType.entries()].map(([t, n]) => `${formatNumber(n)} ${t}`).join(", ") + ".";
+ ? t("links.allExact", { count: formatNumber(links.length) })
+ : [...byType.entries()].map(([type, n]) => `${formatNumber(n)} ${type}`).join(", ") + ".";
const head = filtered
- ? `${formatNumber(links.length)} ${links.length === 1 ? "link matches" : "links match"} the type, repository and search.`
- : "Every provider joined to the consumer that calls it, strongest first.";
- return `${head} ${basis} Open a row for the provider and every caller.`;
+ ? t("links.filteredHead", { count: links.length })
+ : t("links.defaultHead");
+ return t("links.description", { head, basis });
}
diff --git a/packages/web/src/app/workspace/contracts/page.tsx b/packages/web/src/app/workspace/contracts/page.tsx
index 8b8ff126b..5b096e578 100644
--- a/packages/web/src/app/workspace/contracts/page.tsx
+++ b/packages/web/src/app/workspace/contracts/page.tsx
@@ -1,15 +1,13 @@
import type { Metadata } from "next";
import Link from "next/link";
import { Link2 } from "lucide-react";
+import { getTranslations } from "next-intl/server";
import type { ExtractionDiagnostics } from "@repowise-dev/api-client/types";
import { PageShell } from "@repowise-dev/ui/shared";
import { PageLede } from "@repowise-dev/ui/shared/page-lede";
import { OverviewSection } from "@repowise-dev/ui/overview";
import { StatRibbon, type RibbonStat } from "@repowise-dev/ui/stats/stat-ribbon";
-import {
- groupOrphanProviders,
- unmatchedReasonCopy,
-} from "@repowise-dev/ui/workspace/contract-facts";
+import { groupOrphanProviders } from "@repowise-dev/ui/workspace/contract-facts";
import { MAX_PROMPT_ROWS } from "@repowise-dev/ui/workspace/contract-ai-prompt";
import { formatNumber } from "@repowise-dev/ui/lib/format";
import {
@@ -25,10 +23,16 @@ import { ContractsTable } from "./contracts-table";
import { LinksSection } from "./links-table";
import { NeedsAttention } from "./needs-attention";
-export const metadata: Metadata = { title: "Contracts" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("contracts");
+ return { title: t("title") };
+}
export const revalidate = 30;
+/** The minimal translator shape the copy helpers below need; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
/** Rows per page of the full list. The server caps a page at 1,000. */
const PAGE_SIZE = 100;
@@ -59,6 +63,7 @@ type Props = {
* filter, so a deep link never lands on a list narrowed by accident.
*/
export default async function ContractsPage({ searchParams }: Props) {
+ const t = await getTranslations("contracts");
const sp = await searchParams;
const deepLink =
sp.contract && sp.repo && sp.file
@@ -114,67 +119,60 @@ export default async function ContractsPage({ searchParams }: Props) {
// The lede carries matched links, so the ribbon does not repeat it.
const ribbon: RibbonStat[] = [
{
- label: "Providers",
+ label: t("ribbon.providers"),
value: diagnostics ? formatNumber(diagnostics.total_providers) : "",
- sub: "routes, tables and exports published",
+ sub: t("ribbon.providersSub"),
},
{
- label: "Consumers",
+ label: t("ribbon.consumers"),
value: diagnostics ? formatNumber(diagnostics.total_consumers) : "",
- sub: "call sites resolved to a contract",
+ sub: t("ribbon.consumersSub"),
},
{
- label: "Unmatched consumers",
+ label: t("ribbon.unmatched"),
value: diagnostics ? formatNumber(diagnostics.unmatched_consumers.length) : "",
- sub: unmatchedReasonSub(diagnostics),
+ sub: unmatchedReasonSub(t, diagnostics),
},
{
- label: "Providers with no caller",
+ label: t("ribbon.orphans"),
value: diagnostics ? formatNumber(diagnostics.orphan_providers.length) : "",
- sub: "in this workspace; not the same as unused",
+ sub: t("ribbon.orphansSub"),
},
{
// Extraction reporting on its own recall: the denominator is calls a
// dialect located, so it says nothing about calls nothing recognised.
- label: "HTTP calls resolved",
+ label: t("ribbon.httpResolved"),
value:
diagnostics?.http_consumer_coverage != null
? `${Math.floor(diagnostics.http_consumer_coverage * 100)}%`
: "",
sub: diagnostics?.http_consumers_unresolved
- ? `${formatNumber(diagnostics.http_consumers_unresolved)} located but not resolvable`
- : "of the client calls extraction located",
+ ? t("ribbon.httpUnresolved", {
+ count: formatNumber(diagnostics.http_consumers_unresolved),
+ })
+ : t("ribbon.httpSub"),
},
];
return (
<PageShell
- title="Contracts"
+ title={t("title")}
icon={<Link2 className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Routes, tables and exports one repository publishes and another consumes."
+ description={t("description")}
>
<PageLede
- label="Matched links"
- value={diagnostics ? formatNumber(diagnostics.total_links) : "Unknown"}
- unit="provider to consumer"
+ label={t("links.title")}
+ value={diagnostics ? formatNumber(diagnostics.total_links) : t("ledeUnknown")}
+ unit={t("ledeUnit")}
layout="beside"
>
{diagnostics ? (
<>
- <p>
- Each link is a call site resolved to the route, table or export that serves it, in
- another repository or service.
- </p>
- <p>
- It is a match on the path or name, not proof both sides share a schema. Calls that
- matched nothing and providers nothing calls are under Needs attention.
- </p>
+ <p>{t("ledeLinkLine1")}</p>
+ <p>{t("ledeLinkLine2", { attention: t("attention.title") })}</p>
</>
) : (
- <p>
- Extraction diagnostics are not available, so the totals cannot be shown. Run a
- workspace sync to rebuild them.
- </p>
+ <p>{t("ledeNoDiagnostics")}</p>
)}
</PageLede>
@@ -184,7 +182,7 @@ export default async function ContractsPage({ searchParams }: Props) {
<BreakingChangesSection repoIds={repoIds} />
{diagnostics ? (
- <OverviewSection title="Needs attention">
+ <OverviewSection title={t("attention.title")}>
<NeedsAttention
unmatched={diagnostics.unmatched_consumers}
// Counts plus a prompt's worth of rows per group, not all 1,000+.
@@ -197,32 +195,31 @@ export default async function ContractsPage({ searchParams }: Props) {
<OverviewSection
id="all-contracts"
- title="All detected contracts"
- description={data ? listDescription(total, workspaceTotal, filtered) : undefined}
+ title={t("list.title")}
+ description={data ? listDescription(t, total, workspaceTotal, filtered) : undefined}
>
<ContractListControls filters={filters} repos={repos} byType={byType} />
{rows.length === 0 ? (
// One quiet sentence, like every other state with nothing in it.
<p className="text-xs leading-relaxed text-[var(--color-text-secondary)]">
- {!data ? (
- "The contract list could not be loaded. The API may be restarting; reload in a moment."
- ) : total > 0 ? (
- <>
- Page {formatNumber(page)} is past the end of this list, which has{" "}
- {formatNumber(total)} {total === 1 ? "contract" : "contracts"}.{" "}
- <Link
- href={contractsListHref({ ...filters, page: 1 })}
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- Go to the first page
- </Link>
- .
- </>
- ) : filtered ? (
- "No contracts match these filters. Clear the search or a filter to widen the list."
- ) : (
- "No contracts detected. They are found during a workspace sync, by reading the routes each repository serves and the calls the others make."
- )}
+ {!data
+ ? t("list.loadFailed")
+ : total > 0
+ ? t.rich("list.pagePastEnd", {
+ page: formatNumber(page),
+ total,
+ first: (chunks) => (
+ <Link
+ href={contractsListHref({ ...filters, page: 1 })}
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })
+ : filtered
+ ? t("list.noMatch")
+ : t("list.noneDetected")}
</p>
) : (
<>
@@ -240,36 +237,59 @@ export default async function ContractsPage({ searchParams }: Props) {
</ContractDrawerProvider>
<p className="text-xs text-[var(--color-text-tertiary)]">
- Contracts are matched on path. Two routes that share a path are one contract here, so a
- repository can appear against a contract it declares for its own use.{" "}
- <Link
- href="/workspace/system-map"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- See how they connect
- </Link>
- .
+ {t.rich("footer.note", {
+ link: (chunks) => (
+ <Link
+ href="/workspace/system-map"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })}
</p>
</PageShell>
);
}
/** Say exactly what the list holds against the workspace it came from. */
-function listDescription(total: number, workspaceTotal: number | null, filtered: boolean): string {
- const noun = total === 1 ? "contract" : "contracts";
+function listDescription(
+ t: Translator,
+ total: number,
+ workspaceTotal: number | null,
+ filtered: boolean,
+): string {
if (!filtered) {
- return `All ${formatNumber(total)} ${noun} detected across the workspace, ${PAGE_SIZE} to a page. One contract can be declared in several places, so a name may repeat.`;
+ return t("list.description", { total, pageSize: PAGE_SIZE });
}
- const of = workspaceTotal != null ? ` of ${formatNumber(workspaceTotal)}` : "";
- return `${formatNumber(total)}${of} ${noun} match these filters.`;
+ return workspaceTotal != null
+ ? t("list.filteredOf", { total, workspaceTotal })
+ : t("list.filtered", { total });
}
+/**
+ * The unmatched-reason short labels. The reason codes come from the system
+ * graph; the prose in `@repowise-dev/ui` stays English, so the label the ribbon
+ * shows is named here instead.
+ */
+const REASON_KEYS: Record<string, string> = {
+ no_provider: "reasons.no_provider",
+ unlinked: "reasons.unlinked",
+ internal_only: "reasons.internal_only",
+ external_host: "reasons.external_host",
+};
+
/** Name why consumers went unmatched, since the count alone invites the wrong read. */
-function unmatchedReasonSub(diagnostics: ExtractionDiagnostics | null): string {
+function unmatchedReasonSub(
+ t: Translator,
+ diagnostics: ExtractionDiagnostics | null,
+): string {
if (!diagnostics) return "";
const reasons = Object.entries(diagnostics.unmatched_by_reason ?? {})
.filter(([, n]) => n > 0)
.sort((a, b) => b[1] - a[1]);
- if (reasons.length === 0) return "every consumer matched a provider";
- return reasons.map(([reason, n]) => `${n} ${unmatchedReasonCopy(reason).short}`).join(", ");
+ if (reasons.length === 0) return t("reasons.everyMatched");
+ return reasons
+ .map(([reason, n]) => `${n} ${t(REASON_KEYS[reason] ?? "reasons.unknown")}`)
+ .join(", ");
}
diff --git a/packages/web/src/app/workspace/page.tsx b/packages/web/src/app/workspace/page.tsx
index c1c5262c5..6e7375154 100644
--- a/packages/web/src/app/workspace/page.tsx
+++ b/packages/web/src/app/workspace/page.tsx
@@ -22,12 +22,19 @@ import { formatNumber } from "@repowise-dev/ui/lib/format";
import { getWorkspace, getWorkspaceCoChanges } from "@/lib/api/workspace";
import { getWorkspaceActions } from "@/lib/api/actions";
import { RemoveWorkspaceRepoButton, SyncButton } from "./sync-buttons";
+import { getTranslations } from "next-intl/server";
import { WorkspaceNextActionsPanel } from "./workspace-next-actions-panel";
-export const metadata: Metadata = { title: "Workspace" };
+export async function generateMetadata(): Promise<Metadata> {
+ const t = await getTranslations("views.workspace");
+ return { title: t("title") };
+}
export const revalidate = 30;
+/** The minimal translator shape the sentence helpers below need; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
/** Co-change rows shown inline. The full list has its own page, and this
* figure is never reported as a total, so the cap cannot be read as one. */
const COCHANGE_PREVIEW = 8;
@@ -51,6 +58,7 @@ const COCHANGE_PREVIEW = 8;
* that decides whether you open it.
*/
export default async function WorkspaceDashboardPage() {
+ const t = await getTranslations("views.workspace");
// One wave, both on the server. The graph section that used to sit here was
// a client component fetching after mount, which waterfalled a second
// per-repo sqlite sweep in behind the paint.
@@ -73,11 +81,11 @@ export default async function WorkspaceDashboardPage() {
<PageShell
title={workspace?.workspace_name ?? "Workspace"}
icon={<Layers className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Every repository registered in this workspace, and what connects them."
+ description={t("description")}
>
<EmptyState
- title="No repositories discovered yet"
- description="Run `repowise init .` in the workspace root to scan for git repositories and index them. They show up here as soon as the scan lands."
+ title={t("emptyTitle")}
+ description={t("emptyDescription")}
icon={<Layers className="h-8 w-8" />}
/>
</PageShell>
@@ -102,35 +110,35 @@ export default async function WorkspaceDashboardPage() {
const ribbon: RibbonStat[] = [
{
- label: "Files",
+ label: t("ribbon.files"),
value: formatNumber(totals.files),
- sub: `across ${repos.length} ${repos.length === 1 ? "repository" : "repositories"}`,
+ sub: t("ribbon.filesSub", { count: repos.length }),
},
{
- label: "Symbols",
+ label: t("ribbon.symbols"),
value: formatNumber(totals.symbols),
- sub: "functions, classes and methods",
+ sub: t("ribbon.symbolsSub"),
},
{
- label: "Doc freshness",
+ label: t("ribbon.docFreshness"),
value: docFreshness === null ? "—" : `${docFreshness}%`,
sub:
docFreshness === null
- ? "no documentation generated yet"
- : `weighted across ${formatNumber(totals.pages)} pages`,
+ ? t("ribbon.docFreshnessNoPages")
+ : t("ribbon.docFreshnessSub", { pages: formatNumber(totals.pages) }),
},
{
- label: "Hotspots",
+ label: t("ribbon.hotspots"),
value: formatNumber(totals.hotspots),
- sub: "files by churn and prior fixes",
+ sub: t("ribbon.hotspotsSub"),
},
{
- label: "Contract links",
+ label: t("ribbon.contractLinks"),
value: contracts ? formatNumber(contracts.total_links) : "—",
// No href: a linked ribbon cell drops its `sub`, and the sentence under
// the figure is worth more than a second route to the section below,
// which already carries its own link.
- sub: contracts ? "matched provider to consumer" : "no contract data yet",
+ sub: contracts ? t("ribbon.contractLinksSub") : t("ribbon.contractLinksNone"),
},
];
@@ -140,35 +148,41 @@ export default async function WorkspaceDashboardPage() {
<PageShell
title={workspace?.workspace_name ?? "Workspace"}
icon={<Layers className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Every repository registered in this workspace, and what connects them."
- actions={<SyncButton variant="primary" label="Sync workspace" />}
+ description={t("description")}
+ actions={<SyncButton variant="primary" label={t("syncWorkspace")} />}
>
<PageLede
- label="Repositories"
+ label={t("ledeLabel")}
value={String(repos.length)}
- unit="in this workspace"
+ unit={t("ledeUnit")}
layout="beside"
- action={<LedeLink href="/workspace/system-map" LinkComponent={Link}>See the system map</LedeLink>}
+ action={
+ <LedeLink href="/workspace/system-map" LinkComponent={Link}>
+ {t("seeSystemMap")}
+ </LedeLink>
+ }
>
<p>
- {formatNumber(totals.files)} files and {formatNumber(totals.symbols)} symbols are under
- intelligence here
- {totals.pages > 0
- ? `, with ${formatNumber(totals.pages)} documentation pages written from them`
- : ""}
- .{" "}
- {workspace?.workspace_root && (
- <>
- Everything is rooted at{" "}
- <span className="font-mono text-[var(--color-text-tertiary)] [overflow-wrap:anywhere]">
- {workspace.workspace_root}
- </span>
- .
- </>
- )}
+ {t("ledeSentence", {
+ files: formatNumber(totals.files),
+ symbols: formatNumber(totals.symbols),
+ pages:
+ totals.pages > 0
+ ? t("ledePagesWith", { pages: formatNumber(totals.pages) })
+ : "",
+ })}{" "}
+ {workspace?.workspace_root &&
+ t.rich("ledeRootedAt", {
+ root: (chunks) => (
+ <span className="font-mono text-[var(--color-text-tertiary)] [overflow-wrap:anywhere]">
+ {chunks}
+ </span>
+ ),
+ path: workspace.workspace_root,
+ })}
</p>
- <p>{attentionSentence(repos)}</p>
- {unregisteredNote(repos, crossRepo)}
+ <p>{attentionSentence(t, repos)}</p>
+ {unregisteredNote(t, repos, crossRepo)}
</PageLede>
<StatRibbon stats={ribbon} LinkComponent={Link} />
@@ -176,8 +190,8 @@ export default async function WorkspaceDashboardPage() {
{actions && <WorkspaceNextActionsPanel data={actions} />}
<OverviewSection
- title="Repositories"
- description="Ordered by what needs attention first — never indexed, then missing on disk, then by health score — rather than by name."
+ title={t("reposTitle")}
+ description={t("reposDescription")}
>
<RepoRows
repos={repos.slice().sort(byAttention).map(toRow)}
@@ -188,7 +202,7 @@ export default async function WorkspaceDashboardPage() {
) : (
<SyncButton
alias={repo.id}
- label={repo.status === "indexed" ? "Sync" : "Index now"}
+ label={repo.status === "indexed" ? t("sync") : t("indexNow")}
/>
)
}
@@ -197,11 +211,11 @@ export default async function WorkspaceDashboardPage() {
{contracts && contracts.total_contracts > 0 && (
<OverviewSection
- title="Contracts"
- description="Routes, topics and tables one repository publishes and another consumes, matched across the workspace."
+ title={t("contractsTitle")}
+ description={t("contractsDescription")}
action={
<SectionLink href="/workspace/contracts" LinkComponent={Link}>
- All contracts
+ {t("viewAllContracts")}
</SectionLink>
}
>
@@ -225,11 +239,11 @@ export default async function WorkspaceDashboardPage() {
{coChanges && coChanges.co_changes.length > 0 && (
<OverviewSection
- title="Files that change together"
- description="Cross-repo file pairs that recent commits touched in the same session. A work-pattern signal mined from git history, not a declared dependency."
+ title={t("coChangesTitle")}
+ description={t("coChangesDescription")}
action={
<SectionLink href="/workspace/co-changes" LinkComponent={Link}>
- All co-changes
+ {t("viewAllCoChanges")}
</SectionLink>
}
>
@@ -289,14 +303,17 @@ function toRow(repo: WorkspaceRepoEntry): RepoRow {
}
/** One sentence naming what needs doing, or confirming nothing does. */
-function attentionSentence(repos: WorkspaceRepoEntry[]): string {
+function attentionSentence(t: Translator, repos: WorkspaceRepoEntry[]): string {
const names = (list: WorkspaceRepoEntry[]) =>
list.length <= 3
? list.map((r) => r.alias).join(", ")
- : `${list
- .slice(0, 3)
- .map((r) => r.alias)
- .join(", ")} and ${list.length - 3} more`;
+ : t("attention.andMore", {
+ list: list
+ .slice(0, 3)
+ .map((r) => r.alias)
+ .join(", "),
+ count: list.length - 3,
+ });
const parts: string[] = [];
const needsIndex = repos.filter((r) => statusOf(r) === "needs_index");
@@ -305,24 +322,28 @@ function attentionSentence(repos: WorkspaceRepoEntry[]): string {
if (needsIndex.length > 0) {
parts.push(
- `${needsIndex.length} ${needsIndex.length === 1 ? "repository has" : "repositories have"} not been indexed yet (${names(needsIndex)})`,
+ t("attention.needsIndex", {
+ count: needsIndex.length,
+ names: names(needsIndex),
+ }),
);
}
if (missing.length > 0) {
- parts.push(
- `${missing.length} ${missing.length === 1 ? "directory is" : "directories are"} missing on disk (${names(missing)})`,
- );
+ parts.push(t("attention.missing", { count: missing.length, names: names(missing) }));
}
if (docsSkipped.length > 0) {
parts.push(
- `documentation was skipped for ${docsSkipped.length} (${names(docsSkipped)})`,
+ t("attention.docsSkipped", {
+ count: docsSkipped.length,
+ names: names(docsSkipped),
+ }),
);
}
if (parts.length === 0) {
- return "Every registered repository is indexed and present on disk.";
+ return t("attention.none");
}
- return `${parts.join("; ")}. Each is marked in the list below.`;
+ return t("attention.suffix", { parts: parts.join("; ") });
}
/**
@@ -336,6 +357,7 @@ function attentionSentence(repos: WorkspaceRepoEntry[]): string {
* says why. Saying it is cheap; the disagreement is itself the signal.
*/
function unregisteredNote(
+ t: Translator,
repos: WorkspaceRepoEntry[],
crossRepo: { top_connections: Array<{ repos: string[] }> } | null,
): ReactNode {
@@ -351,10 +373,7 @@ function unregisteredNote(
const names = [...seen].sort();
return (
<p>
- Cross-repo figures below also cover {names.length}{" "}
- {names.length === 1 ? "repository" : "repositories"} the workspace config no longer
- registers ({names.join(", ")}). Re-run a workspace sync to bring the two back into
- agreement.
+ {t("unregisteredNote", { count: names.length, names: names.join(", ") })}
</p>
);
}
diff --git a/packages/web/src/app/workspace/sync-buttons.tsx b/packages/web/src/app/workspace/sync-buttons.tsx
index c738d9074..62860026b 100644
--- a/packages/web/src/app/workspace/sync-buttons.tsx
+++ b/packages/web/src/app/workspace/sync-buttons.tsx
@@ -2,11 +2,15 @@
import { useState, useTransition } from "react";
import { useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import { RefreshCw, Trash2 } from "lucide-react";
import { removeWorkspaceRepo, syncWorkspace } from "@/lib/api/workspace";
import type { WorkspaceSyncResult } from "@/lib/api/types";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+/** The minimal translator shape `summarizeResults` needs; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
type SyncState =
| { kind: "idle" }
| { kind: "running" }
@@ -31,6 +35,7 @@ export function SyncButton({
variant = "ghost",
fullResync = false,
}: SyncButtonProps) {
+ const t = useTranslations("views.workspace");
const [state, setState] = useState<SyncState>({ kind: "idle" });
const [, startTransition] = useTransition();
const router = useRouter();
@@ -53,7 +58,7 @@ export function SyncButton({
};
const buttonText =
- label ?? (alias ? "Sync this repo" : "Sync workspace");
+ label ?? (alias ? t("syncThisRepo") : t("syncWorkspace"));
const baseClass =
"inline-flex items-center gap-1.5 rounded-md text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed";
@@ -74,11 +79,11 @@ export function SyncButton({
<RefreshCw
className={`h-3 w-3 ${state.kind === "running" ? "motion-safe:animate-spin" : ""}`}
/>
- {state.kind === "running" ? "Syncing…" : buttonText}
+ {state.kind === "running" ? t("syncing") : buttonText}
</button>
{state.kind === "ok" && (
<span className="text-xs text-[var(--color-text-tertiary)]">
- {summarizeResults(state.results)}
+ {summarizeResults(t, state.results)}
</span>
)}
{state.kind === "error" && (
@@ -90,15 +95,15 @@ export function SyncButton({
);
}
-function summarizeResults(results: WorkspaceSyncResult[]): string {
- if (results.length === 0) return "no repos";
+function summarizeResults(t: Translator, results: WorkspaceSyncResult[]): string {
+ if (results.length === 0) return t("syncNoRepos");
const accepted = results.filter((r) => r.status === "accepted").length;
const skipped = results.filter((r) => r.status === "skipped").length;
const errored = results.filter((r) => r.status === "error").length;
const parts: string[] = [];
- if (accepted) parts.push(`${accepted} queued`);
- if (skipped) parts.push(`${skipped} skipped`);
- if (errored) parts.push(`${errored} error`);
+ if (accepted) parts.push(t("syncQueued", { count: accepted }));
+ if (skipped) parts.push(t("syncSkipped", { count: skipped }));
+ if (errored) parts.push(t("syncErrors", { count: errored }));
return parts.join(", ");
}
@@ -111,6 +116,7 @@ export function RemoveWorkspaceRepoButton({
alias,
repoName,
}: RemoveWorkspaceRepoButtonProps) {
+ const t = useTranslations("views.workspace");
const [removing, setRemoving] = useState(false);
const [, startTransition] = useTransition();
const router = useRouter();
@@ -120,9 +126,7 @@ export function RemoveWorkspaceRepoButton({
e.stopPropagation();
if (
typeof window !== "undefined" &&
- !window.confirm(
- `Remove '${repoName || alias}' from .repowise-workspace.yaml?`,
- )
+ !window.confirm(t("removeConfirm", { name: repoName || alias }))
) {
return;
}
@@ -132,7 +136,7 @@ export function RemoveWorkspaceRepoButton({
startTransition(() => router.refresh());
} catch (e) {
if (typeof window !== "undefined") {
- window.alert(`Failed to remove: ${toFriendlyMessage(e)}`);
+ window.alert(t("removeFailed", { message: toFriendlyMessage(e) }));
}
} finally {
setRemoving(false);
@@ -145,10 +149,10 @@ export function RemoveWorkspaceRepoButton({
onClick={handleRemove}
disabled={removing}
className="inline-flex items-center gap-1.5 rounded-md border border-[var(--color-border-default)] px-2.5 py-1 text-xs font-medium text-[var(--color-error)] hover:bg-[var(--color-bg-elevated)] transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- aria-label={`Remove ${alias} from workspace`}
+ aria-label={t("removeAria", { alias })}
>
<Trash2 className="h-3 w-3" />
- {removing ? "Removing…" : "Remove"}
+ {removing ? t("removing") : t("remove")}
</button>
);
}
diff --git a/packages/web/src/app/workspace/system-map/page.tsx b/packages/web/src/app/workspace/system-map/page.tsx
index 66ad69476..f3aa9368b 100644
--- a/packages/web/src/app/workspace/system-map/page.tsx
+++ b/packages/web/src/app/workspace/system-map/page.tsx
@@ -3,6 +3,7 @@
import { useCallback, useMemo, useState } from "react";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
+import { useTranslations } from "next-intl";
import { Waypoints } from "lucide-react";
import {
SystemMap,
@@ -14,7 +15,6 @@ import {
buildBlastRadiusOverlay,
buildBreakingChangeOverlay,
buildConformanceOverlay,
- plural,
selectionRepo,
type ContractRef,
type RepoHealth,
@@ -41,6 +41,9 @@ import { useRepoContracts } from "./use-repo-contracts";
const LENSES: readonly SystemMapLens[] = ["none", "blast", "breaking", "conformance", "core"];
+/** The minimal translator shape the copy helpers below need; next-intl's `t` fits. */
+type Translator = (key: string, values?: Record<string, string | number>) => string;
+
function contractHref(ref: ContractRef): string {
const params = new URLSearchParams({ contract: ref.contract_id, repo: ref.repo });
if (ref.file_path) params.set("file", ref.file_path);
@@ -52,6 +55,7 @@ function contractsHref(repo: string): string {
}
export default function SystemMapPage() {
+ const t = useTranslations("systemMap");
const router = useRouter();
const searchParams = useSearchParams();
@@ -74,12 +78,21 @@ export default function SystemMapPage() {
}, [searchParams]);
const lensOptions = useMemo(
() =>
- lensOptionsFor(graph, breaking, conformance, architecture, {
+ lensOptionsFor(t, graph, breaking, conformance, architecture, {
breaking: Boolean(breakingError),
conformance: Boolean(conformanceError),
architecture: Boolean(architectureError),
}),
- [graph, breaking, conformance, architecture, breakingError, conformanceError, architectureError],
+ [
+ t,
+ graph,
+ breaking,
+ conformance,
+ architecture,
+ breakingError,
+ conformanceError,
+ architectureError,
+ ],
);
// A lens from the URL that cannot act here (0 findings, or its report
// failed) reads as no lens, rather than a checked option nobody can reach.
@@ -180,18 +193,17 @@ export default function SystemMapPage() {
return (
<PageShell
- title="System map"
+ title={t("title")}
icon={<Waypoints className="h-5 w-5 text-[var(--color-text-tertiary)]" />}
- description="Services and the typed relationships between them, rebuilt from code and git history on every workspace update."
+ description={t("description")}
maxWidth="wide"
>
- {graph && <Lede graph={graph} architecture={architecture} conformance={conformance} />}
- {graph && <StatRibbon stats={ribbon(graph, architecture)} LinkComponent={Link} />}
+ {graph && (
+ <Lede graph={graph} architecture={architecture} conformance={conformance} t={t} />
+ )}
+ {graph && <StatRibbon stats={ribbon(t, graph, architecture)} LinkComponent={Link} />}
- <OverviewSection
- title="Services and relationships"
- description="Each box is a service; each line is a contract, import or co-change between two of them. Pick a lens to ask the map one question at a time."
- >
+ <OverviewSection title={t("section.title")} description={t("section.description")}>
{isLoading ? (
// Same rows as the loaded map: lens, filters, legend, then the canvas.
<div className="flex flex-col gap-3" aria-hidden>
@@ -266,6 +278,7 @@ export default function SystemMapPage() {
/** Counts and disabled reasons for each lens, from data already on the page. */
function lensOptionsFor(
+ t: Translator,
graph: SystemGraph | null,
breaking: ReturnType<typeof useWorkspaceBreakingChanges>["data"],
conformance: ConformanceReport | null,
@@ -276,53 +289,53 @@ function lensOptionsFor(
const breakingTotal = breaking ? breaking.breaking_count + breaking.warning_count : 0;
const findings = conformance ? conformance.violation_count + (conformance.total_cycles ?? conformance.cycle_count) : 0;
return [
- { value: "none", label: "None", hint: "The map as extracted, no lens" },
+ { value: "none", label: t("lens.none.label"), hint: t("lens.none.hint") },
{
value: "blast",
- label: "Blast radius",
- hint: "What depends on one service, directly or through others",
- disabledReason: hasEdges ? undefined : "No relationships to trace yet.",
+ label: t("lens.blast.label"),
+ hint: t("lens.blast.hint"),
+ disabledReason: hasEdges ? undefined : t("lens.blast.disabled"),
},
{
value: "breaking",
- label: "Breaking changes",
+ label: t("lens.breaking.label"),
count: breaking ? String(breakingTotal) : undefined,
disabledReason: failed.breaking
- ? "Could not load the breaking-change report."
+ ? t("lens.breaking.disabledFailed")
: !breaking
- ? "Loading the breaking-change report."
+ ? t("lens.breaking.disabledLoading")
: !breaking.generated_at
- ? "Breaking-change detection has not run. Run a workspace update."
+ ? t("lens.breaking.disabledNotRun")
: breakingTotal === 0
- ? "No provider contract changed incompatibly in the most recent update."
+ ? t("lens.breaking.disabledNone")
: undefined,
},
{
value: "conformance",
- label: "Conformance",
+ label: t("lens.conformance.label"),
count: conformance ? String(findings) : undefined,
- hint: "Rule violations and dependency cycles",
+ hint: t("lens.conformance.hint"),
disabledReason: failed.conformance
- ? "Could not load the conformance report."
+ ? t("lens.conformance.disabledFailed")
: !conformance
- ? "Loading the conformance report."
+ ? t("lens.conformance.disabledLoading")
: !conformance.generated_at
- ? "Conformance has not been checked. Run a workspace update."
+ ? t("lens.conformance.disabledNotRun")
: findings === 0
- ? "No rule violations or dependency cycles."
+ ? t("lens.conformance.disabledNone")
: undefined,
},
{
value: "core",
- label: "Core",
+ label: t("lens.core.label"),
count: architecture ? String(architecture.core_size) : undefined,
- hint: "The largest group of services that all depend on each other, and every service's role",
+ hint: t("lens.core.hint"),
disabledReason: failed.architecture
- ? "Could not load the architecture metrics."
+ ? t("lens.core.disabledFailed")
: !architecture
- ? "Loading architecture metrics."
+ ? t("lens.core.disabledLoading")
: architecture.core_size === 0 && architecture.roles.length === 0
- ? "No services to classify."
+ ? t("lens.core.disabledNone")
: undefined,
},
];
@@ -332,10 +345,12 @@ function Lede({
graph,
architecture,
conformance,
+ t,
}: {
graph: SystemGraph;
architecture: ReturnType<typeof useWorkspaceArchitecture>["data"];
conformance: ConformanceReport | null;
+ t: Translator;
}) {
const name = (id: string) => graph.nodes.find((n) => n.id === id)?.name ?? id;
const repos = new Set(graph.nodes.map((n) => n.repo)).size;
@@ -347,33 +362,43 @@ function Lede({
return (
<PageLede
- label="Architecture score"
- labelHint="A 1 to 10 roll-up of propagation cost, the size of the cyclic core, dependency cycles and rule violations, over structural edges only. Higher means less coupled."
+ label={t("lede.label")}
+ labelHint={t("lede.labelHint")}
value={architecture ? architecture.score.toFixed(1) : "–"}
- unit="out of 10"
+ unit={t("lede.unit")}
layout="beside"
>
<p>
- {plural(graph.nodes.length, "service", "services")} in {plural(repos, "repository", "repositories")}, joined by{" "}
- {plural(graph.edges.length, "relationship", "relationships")}: {structural} structural (a contract or import
- in code) and {behavioral} co-change (files that change in the same commits, not a call).
+ {t("lede.counts", {
+ services: graph.nodes.length,
+ repos,
+ relationships: graph.edges.length,
+ structural,
+ behavioral,
+ })}
</p>
{first ? (
<p>
<span className="font-medium text-[var(--color-text-primary)]">
- {first.nodes.map(name).join(" and ")} depend on each other
+ {t("lede.cycleDepend", { names: first.nodes.map(name).join(", ") })}
</span>
- , a dependency cycle: none of them can change a contract, build or deploy alone.
- {totalCycles > 1 ? ` ${plural(totalCycles - 1, "more cycle is", "more cycles are")} listed under Needs attention.` : " It is listed under Needs attention with a prompt to break it."}
+ {t("lede.cycleTail")}{" "}
+ {totalCycles > 1
+ ? t("lede.cycleMore", { count: totalCycles - 1 })
+ : t("lede.cycleOne")}
</p>
) : conformance?.generated_at ? (
- <p>No dependency cycles: every service can change without a loop back to itself.</p>
+ <p>{t("lede.noCycles")}</p>
) : null}
{architecture && (
<p>
- On average a service reaches {architecture.propagation_cost_pct.toFixed(1)}% of the others through
- dependencies, and {architecture.core_size > 0 ? `${plural(architecture.core_size, "service forms", "services form")} the cyclic core` : "there is no cyclic core"}
- . Those two figures drive the score.
+ {t("lede.reachAndScore", {
+ pct: architecture.propagation_cost_pct.toFixed(1),
+ core:
+ architecture.core_size > 0
+ ? t("lede.coreForms", { count: architecture.core_size })
+ : t("lede.noCore"),
+ })}
</p>
)}
</PageLede>
@@ -381,6 +406,7 @@ function Lede({
}
function ribbon(
+ t: Translator,
graph: SystemGraph,
architecture: ReturnType<typeof useWorkspaceArchitecture>["data"],
): RibbonStat[] {
@@ -389,32 +415,40 @@ function ribbon(
const structural = graph.edges.filter((e) => e.structural).length;
return [
{
- label: "Services",
+ label: t("ribbon.services"),
value: formatNumber(graph.nodes.length),
- sub: `in ${plural(repos, "repository", "repositories")}`,
+ sub: t("ribbon.servicesSub", { count: repos }),
},
{
- label: "Relationships",
+ label: t("ribbon.relationships"),
value: formatNumber(graph.edges.length),
- sub: `${structural} structural, ${graph.edges.length - structural} co-change`,
+ sub: t("ribbon.relationshipsSub", {
+ structural,
+ behavioral: graph.edges.length - structural,
+ }),
},
{
- label: "Propagation cost",
+ label: t("ribbon.propagationCost"),
value: architecture ? `${architecture.propagation_cost_pct.toFixed(1)}%` : "–",
- sub: "of other services the average one reaches",
- hint: "The share of other services the average service can reach through structural dependencies. 0% is fully decoupled, 100% is everything reaching everything.",
+ sub: t("ribbon.propagationCostSub"),
+ hint: t("ribbon.propagationCostHint"),
},
{
- label: "Contract links",
+ label: t("ribbon.contractLinks"),
value: diag ? formatNumber(diag.total_links) : "–",
- sub: diag ? `from ${formatNumber(diag.total_providers)} providers, ${formatNumber(diag.total_consumers)} consumers` : undefined,
- hint: "Consumer calls matched to the provider that serves them, across services.",
+ sub: diag
+ ? t("ribbon.contractLinksSub", {
+ providers: formatNumber(diag.total_providers),
+ consumers: formatNumber(diag.total_consumers),
+ })
+ : undefined,
+ hint: t("ribbon.contractLinksHint"),
},
{
- label: "Unmatched consumers",
+ label: t("ribbon.unmatched"),
value: diag ? formatNumber(diag.unmatched_consumers.length) : "–",
- sub: "calls with no provider in the workspace",
- hint: "Consumer contracts that matched no provider: missing, a third-party host, or inside the same service.",
+ sub: t("ribbon.unmatchedSub"),
+ hint: t("ribbon.unmatchedHint"),
},
];
}
diff --git a/packages/web/src/components/architecture/dependencies-view.tsx b/packages/web/src/components/architecture/dependencies-view.tsx
index b108cb243..46c67df3a 100644
--- a/packages/web/src/components/architecture/dependencies-view.tsx
+++ b/packages/web/src/components/architecture/dependencies-view.tsx
@@ -20,6 +20,7 @@ import { ApiError } from "@repowise-dev/ui/shared/api-error";
import { fileEntityPath } from "@repowise-dev/ui/shared/entity";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
import type {
ExternalSystemImportingFiles,
ExternalSystemRelationshipGraph,
@@ -48,6 +49,7 @@ interface ActiveRequest {
}
export function DependenciesView({ repoId }: { repoId: string }) {
+ const t = useTranslations("architecture");
const summaryAbortRef = useRef<AbortController | null>(null);
const relationshipsAbortRef = useRef<ActiveRequest | null>(null);
const filesAbortRef = useRef<ActiveRequest | null>(null);
@@ -225,10 +227,10 @@ export function DependenciesView({ repoId }: { repoId: string }) {
<div className="min-w-0">
<h1 className="mb-1 flex items-center gap-2 text-xl font-semibold text-[var(--color-text-primary)]">
<Package className="h-5 w-5 text-[var(--color-accent-primary)]" />
- External dependencies
+ {t("dependencies.title")}
</h1>
<p className="max-w-3xl text-sm text-[var(--color-text-secondary)]">
- Declared third-party packages, joined to persisted import-graph evidence. Select a package to inspect declaration counts, versions, and importing files.
+ {t("dependencies.description")}
</p>
</div>
{(scope === "all" || (data?.excluded_declarations ?? 0) > 0) ? <div className="shrink-0">
@@ -245,24 +247,29 @@ export function DependenciesView({ repoId }: { repoId: string }) {
}}
className="h-4 w-4 rounded border-[var(--color-border-default)] accent-[var(--color-accent-primary)]"
/>
- Include auxiliary declarations
+ {t("dependencies.includeAuxiliary")}
</label>
<p className="mt-1 max-w-xs text-right text-2xs text-[var(--color-text-tertiary)]">
{scope === "primary"
- ? `${data?.excluded_declarations ?? 0} declarations from auxiliary directories excluded`
- : "Showing primary and auxiliary directories present in this indexed checkout"}
+ ? t("dependencies.auxiliaryExcluded", {
+ count: data?.excluded_declarations ?? 0,
+ })
+ : t("dependencies.showingAll")}
</p>
</div> : null}
</div>
{error && !data ? (
<ApiError
- title="Couldn't load external dependencies"
+ title={t("dependencies.loadFailed")}
message={toFriendlyMessage(error)}
onRetry={() => void mutate()}
/>
) : isLoading || !data ? (
- <div className="space-y-4" aria-label="Loading external dependencies">
+ <div
+ className="space-y-4"
+ aria-label={t("dependencies.loading")}
+ >
<Skeleton className="h-20 w-full" />
<Skeleton className="h-9 w-full" />
{Array.from({ length: 8 }).map((_, index) => (
diff --git a/packages/web/src/components/architecture/graph-view.tsx b/packages/web/src/components/architecture/graph-view.tsx
index 40bf477f5..800a78056 100644
--- a/packages/web/src/components/architecture/graph-view.tsx
+++ b/packages/web/src/components/architecture/graph-view.tsx
@@ -16,6 +16,7 @@ import { getGraph } from "@/lib/api/graph";
import { useCommunities } from "@/lib/hooks/use-graph";
import type { GraphExportResponse } from "@/lib/api/types";
import { PRODUCTION_ONLY, type GraphPopulation } from "@repowise-dev/types/graph";
+import { useTranslations } from "next-intl";
type ViewMode = "full" | "architecture" | "dead" | "hotfiles" | "unified";
type ColorMode = "language" | "community";
@@ -63,6 +64,7 @@ export function GraphView({
scope: Scope;
onScopeChange: (scope: Scope) => void;
}) {
+ const t = useTranslations("architecture");
const searchParams = useSearchParams();
const initialNode = searchParams.get("node");
@@ -290,8 +292,8 @@ export function GraphView({
// zoom you are at; the one line left is what to do with what you see.
description={
isCommunities
- ? "Files that depend on each other more than on the rest of the repo, detected automatically. Circle size is how much code a group holds, and the nearer the centre, the nearer an entry point. Double-click a group to see the files inside it and what they depend on."
- : "Every file, grouped into the communities it depends on most, with a band for each strong link between communities. Hover or select a file to see exactly what it imports and what imports it."
+ ? t("graph.communitiesDescription")
+ : t("graph.filesDescription")
}
headerActions={headerControls}
banner={
diff --git a/packages/web/src/components/chat/chat-interface.tsx b/packages/web/src/components/chat/chat-interface.tsx
index 7a54622d2..114b355a6 100644
--- a/packages/web/src/components/chat/chat-interface.tsx
+++ b/packages/web/src/components/chat/chat-interface.tsx
@@ -14,6 +14,7 @@ import type { ChatArtifact, ChatUIMessage } from "@repowise-dev/types/chat";
import { ModelSelector } from "./model-selector";
import { ConversationHistory } from "./conversation-history";
import { useRepositoryChat } from "./repository-chat-provider";
+import { useTranslations } from "next-intl";
interface ChatInterfaceProps {
repoId: string;
@@ -33,6 +34,7 @@ export function ChatInterface({
headCommit,
initialQuestion,
}: ChatInterfaceProps) {
+ const t = useTranslations("chat");
const {
messages,
conversationId,
@@ -219,14 +221,16 @@ export function ChatInterface({
sendDisabled={!anyConfigured}
sendDisabledReason={
<span>
- No chat provider is configured. Add an API key in{" "}
- <Link
- href="/settings"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- settings
- </Link>{" "}
- to start asking questions.
+ {t.rich("noProvider", {
+ link: (chunks) => (
+ <Link
+ href="/settings"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })}
</span>
}
historySlot={
diff --git a/packages/web/src/components/chat/repository-chat-dock.tsx b/packages/web/src/components/chat/repository-chat-dock.tsx
index 51a0e432f..52bd3a1cb 100644
--- a/packages/web/src/components/chat/repository-chat-dock.tsx
+++ b/packages/web/src/components/chat/repository-chat-dock.tsx
@@ -13,6 +13,7 @@ import { ConversationHistory } from "./conversation-history";
import { useRepositoryChat } from "./repository-chat-provider";
import { useChatDockHidden } from "./use-chat-dock-hidden";
import { config, setChatDockHidden } from "@/lib/config";
+import { useTranslations } from "next-intl";
// Sigma's worst-case bottom-right stack is ~197px tall (layout status plus
// five controls and spacing). Keep a small measured clearance above it.
@@ -63,6 +64,7 @@ export function RepositoryChatDock() {
type RepositoryChatValue = ReturnType<typeof useRepositoryChat>;
function ConnectedRepositoryChatDock({ chat }: { chat: RepositoryChatValue }) {
+ const t = useTranslations("chat");
const router = useRouter();
const searchParams = useSearchParams();
// Read after mount so SSR and the first client render agree.
@@ -121,14 +123,16 @@ function ConnectedRepositoryChatDock({ chat }: { chat: RepositoryChatValue }) {
sendDisabled={!anyConfigured}
sendDisabledReason={
<span>
- No chat provider is configured. Add an API key in{" "}
- <Link
- href="/settings"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- settings
- </Link>
- .
+ {t.rich("noProviderShort", {
+ link: (chunks) => (
+ <Link
+ href="/settings"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </Link>
+ ),
+ })}
</span>
}
modelSelectorSlot={<ModelSelector repoId={chat.repoId} activeProvider={chat.selectedProvider} activeModel={chat.selectedModel} onSelect={chat.selectModel} />}
diff --git a/packages/web/src/components/code-health/hotspots-section.tsx b/packages/web/src/components/code-health/hotspots-section.tsx
index 668522579..a805570b4 100644
--- a/packages/web/src/components/code-health/hotspots-section.tsx
+++ b/packages/web/src/components/code-health/hotspots-section.tsx
@@ -29,6 +29,7 @@ import { OverviewSection, SectionLink } from "@repowise-dev/ui/overview";
import { HotspotTable } from "@repowise-dev/ui/git/hotspot-table";
import { AiPromptModal, buildHotspotAiPrompt, fileChatContext } from "@repowise-dev/ui/health";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
+import { useTranslations } from "next-intl";
import { hotspotToFileCard } from "@repowise-dev/ui/shared/file-card";
import type { Hotspot } from "@repowise-dev/types/git";
import Link from "next/link";
@@ -42,6 +43,7 @@ const PAGE_SIZE = 100;
const PAGE_MAX = 500;
export function HotspotsSection({ repoId }: { repoId: string }) {
+ const t = useTranslations("codeHealth");
const { showFile, dialog } = useFileCardHost(repoId);
const [pageLimit, setPageLimit] = useState(PAGE_SIZE);
const [drawerSymbol, setDrawerSymbol] = useState<SymbolResponse | null>(null);
@@ -67,17 +69,17 @@ export function HotspotsSection({ repoId }: { repoId: string }) {
return (
<OverviewSection
- title="Hotspots"
- description="Ranked by change frequency and prior bug fixes, mined from full git history. The danger is not churn on its own. It is a file that changes constantly and only one person understands."
+ title={t("hotspots.title")}
+ description={t("hotspots.description")}
action={
<SectionLink href={`/repos/${repoId}/commits`} LinkComponent={Link}>
- Commit history
+ {t("hotspots.commitHistory")}
</SectionLink>
}
>
{error && list.length === 0 ? (
<p className="text-sm text-[var(--color-text-secondary)]">
- Couldn&apos;t load hotspots. Run a sync to mine git history for this repo.
+ {t("hotspots.loadFailed")}
</p>
) : isLoading && list.length === 0 ? (
<Skeleton className="h-72 w-full rounded-xl" />
@@ -134,8 +136,8 @@ export function HotspotsSection({ repoId }: { repoId: string }) {
}
filePath={promptHotspot?.file_path}
chatContext={fileChatContext(promptHotspot?.file_path)}
- title="AI stabilization prompt"
- description="A ready-to-paste prompt that has your AI agent diagnose why this file churns and propose changes that make it cheaper to maintain."
+ title={t("hotspots.promptTitle")}
+ description={t("hotspots.promptDescription")}
/>
</OverviewSection>
);
diff --git a/packages/web/src/components/commits/commit-detail-sheet.tsx b/packages/web/src/components/commits/commit-detail-sheet.tsx
index 5f2057eab..fb4a25d39 100644
--- a/packages/web/src/components/commits/commit-detail-sheet.tsx
+++ b/packages/web/src/components/commits/commit-detail-sheet.tsx
@@ -14,6 +14,7 @@ import { CommitDetailCard } from "@repowise-dev/ui/commits/commit-detail-card";
import { AiPromptButton, AiPromptModal, buildCommitAiPrompt } from "@repowise-dev/ui/health";
import { getCommit } from "@/lib/api/git";
import { getRiskRange } from "@/lib/api/risk";
+import { useTranslations } from "next-intl";
/**
* The commit detail drawer, driven entirely by `?commit=`.
@@ -24,6 +25,7 @@ import { getRiskRange } from "@/lib/api/risk";
* pages land here with the sheet already open, and it survives a refresh.
*/
export function CommitDetailSheet({ repoId }: { repoId: string }) {
+ const t = useTranslations("commits");
const [selectedSha, setSelectedSha] = useQueryState("commit");
const [promptOpen, setPromptOpen] = useState(false);
@@ -53,7 +55,7 @@ export function CommitDetailSheet({ repoId }: { repoId: string }) {
>
<SheetContent side="right" className="w-[440px] max-w-[92vw] sm:w-[560px]">
<SheetHeader>
- <SheetTitle>Review this commit</SheetTitle>
+ <SheetTitle>{t("detail.title")}</SheetTitle>
</SheetHeader>
<div className="flex-1 overflow-y-auto px-4 pb-6">
{isLoading || !detail ? (
@@ -65,7 +67,7 @@ export function CommitDetailSheet({ repoId }: { repoId: string }) {
<>
<div className="flex justify-end pt-1 pb-3">
<AiPromptButton
- label="AI review prompt"
+ label={t("detail.promptLabel")}
onClick={() => setPromptOpen(true)}
/>
</div>
@@ -116,8 +118,8 @@ export function CommitDetailSheet({ repoId }: { repoId: string }) {
? { kind: "commit", label: detail.short_sha, target: detail.sha, targetKind: "commit" }
: undefined
}
- title="AI commit review"
- description="A ready-to-paste prompt that has your AI agent review this commit's change-risk, flag what to scrutinize, and suggest reviewers."
+ title={t("detail.promptTitle")}
+ description={t("detail.promptDescription")}
/>
</>
);
diff --git a/packages/web/src/components/coupling/coupling-tab.tsx b/packages/web/src/components/coupling/coupling-tab.tsx
index 9791fddd1..c019bbd40 100644
--- a/packages/web/src/components/coupling/coupling-tab.tsx
+++ b/packages/web/src/components/coupling/coupling-tab.tsx
@@ -10,6 +10,7 @@ import { CouplingExplorer } from "@repowise-dev/ui/coupling";
import { getCoupling } from "@/lib/api/coupling";
import { useRepo } from "@/lib/hooks/use-repo";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
/** The route's own ceiling. Asking beyond it is rejected, not clamped. */
const MAX_LIMIT = 1000;
@@ -27,6 +28,7 @@ const INITIAL_LIMIT = 200;
* ceiling, so the "showing N of M" line is never a dead end.
*/
export function CouplingTab({ repoId }: { repoId: string }) {
+ const t = useTranslations("coupling");
const [limit, setLimit] = useState(INITIAL_LIMIT);
const { data, error, isLoading, isValidating, mutate } = useSWR(
`coupling:${repoId}:${limit}`,
@@ -41,7 +43,7 @@ export function CouplingTab({ repoId }: { repoId: string }) {
<div className="space-y-6">
{error ? (
<ApiError
- title="Couldn't load change coupling"
+ title={t("loadFailed")}
message={toFriendlyMessage(error)}
onRetry={() => void mutate()}
/>
diff --git a/packages/web/src/components/coverage/freshness-table-wrapper.tsx b/packages/web/src/components/coverage/freshness-table-wrapper.tsx
index 6b42fec06..a2ca6c536 100644
--- a/packages/web/src/components/coverage/freshness-table-wrapper.tsx
+++ b/packages/web/src/components/coverage/freshness-table-wrapper.tsx
@@ -10,11 +10,13 @@ import {
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
import { GenerationProgressWrapper } from "@/components/jobs/generation-progress-wrapper";
import { regeneratePage } from "@/lib/api/pages";
+import { useTranslations } from "next-intl";
export function FreshnessTableWithRegenerate({
pages,
repoId,
}: Pick<FreshnessTableProps, "pages"> & { repoId: string }) {
+ const t = useTranslations("coverage");
const router = useRouter();
// A single active job (a per-row regenerate) shown above the table. On
// completion we revalidate the (server-rendered) page list.
@@ -25,18 +27,20 @@ export function FreshnessTableWithRegenerate({
const handleRegenerate = useCallback(
async (pageId: string) => {
if (busy) {
- toast.info("A generation job is already running. Wait for it to finish.");
+ toast.info(t("jobRunning"));
return;
}
try {
const res = await regeneratePage(pageId, { cascade: "none", repoId });
setActiveJobId(res.job_id);
- toast.info("Regeneration started");
+ toast.info(t("regenStarted"));
} catch (e) {
- toast.error("Couldn't start regeneration", { description: toFriendlyMessage(e) });
+ toast.error(t("regenFailed"), {
+ description: toFriendlyMessage(e),
+ });
}
},
- [busy],
+ [busy, t],
);
return (
diff --git a/packages/web/src/components/dashboard/quick-actions-wrapper.tsx b/packages/web/src/components/dashboard/quick-actions-wrapper.tsx
index e5ef7e45c..2ef19894d 100644
--- a/packages/web/src/components/dashboard/quick-actions-wrapper.tsx
+++ b/packages/web/src/components/dashboard/quick-actions-wrapper.tsx
@@ -13,6 +13,7 @@ import { listJobs } from "@/lib/api/jobs";
import { analyzeDeadCode } from "@/lib/api/dead-code";
import { GenerationProgressWrapper } from "@/components/jobs/generation-progress-wrapper";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface Props {
repoId: string;
@@ -40,7 +41,17 @@ export function QuickActionsWrapper({
lastResyncAt,
variant,
}: Props) {
+ const t = useTranslations("dashboard");
const router = useRouter();
+ /** Action labels in the active locale, for toast copy. */
+ const actionLabel = (key: QuickActionKey): string =>
+ key === "sync"
+ ? t("quickActions.sync")
+ : key === "resync"
+ ? t("quickActions.resync")
+ : key === "dead-code"
+ ? t("quickActions.deadCode")
+ : labelFor(key);
const [activeJobId, setActiveJobId] = useState<string | null>(null);
// Which action started the job on screen, so its completion can be reported
// and refreshed in its own terms rather than as a generic doc generation.
@@ -77,8 +88,8 @@ export function QuickActionsWrapper({
setActiveJobId(null);
setActiveKey(null);
if (key === "dead-code") {
- if (status === "completed") toast.success("Dead code scan finished");
- else if (status === "failed") toast.error("Dead code scan failed");
+ if (status === "completed") toast.success(t("quickActions.deadCodeFinished"));
+ else if (status === "failed") toast.error(t("quickActions.deadCodeFailed"));
}
// This page is server-rendered: without a refresh the "Dead Exports" tile
// the scan exists to move keeps showing its pre-scan number, and the same
@@ -91,15 +102,23 @@ export function QuickActionsWrapper({
if (key === "sync") {
const job = await syncRepo(repoId);
startWatching(job.id, key);
- toast.info(`Sync started${repoName ? ` — ${repoName}` : ""}`);
+ toast.info(
+ t("quickActions.syncStarted", {
+ name: repoName ? ` — ${repoName}` : "",
+ }),
+ );
} else if (key === "resync") {
const job = await fullResyncRepo(repoId);
startWatching(job.id, key);
- toast.info(`Full resync started${repoName ? ` — ${repoName}` : ""}`);
+ toast.info(
+ t("quickActions.resyncStarted", {
+ name: repoName ? ` — ${repoName}` : "",
+ }),
+ );
} else if (key === "dead-code") {
const { job_id } = await analyzeDeadCode(repoId);
startWatching(job_id, key);
- toast.info("Dead code analysis started");
+ toast.info(t("quickActions.deadCodeStarted"));
}
} catch (e) {
const msg = toFriendlyMessage(e);
@@ -113,16 +132,16 @@ export function QuickActionsWrapper({
if (inflight) {
// Someone else's job: watch it, but do not claim it as this action.
startWatching(inflight.id, null);
- toast.info(
- "Showing progress for the in-flight job. Cancel it from the panel to start a new one.",
- );
+ toast.info(t("quickActions.inFlight"));
return;
}
} catch {
// fall through
}
}
- toast.error(`${labelFor(key)} failed`, { description: msg });
+ toast.error(t("quickActions.actionFailed", { action: actionLabel(key) }), {
+ description: msg,
+ });
}
}
diff --git a/packages/web/src/components/decisions/add-decision-button.tsx b/packages/web/src/components/decisions/add-decision-button.tsx
index e79a16f5d..90232c214 100644
--- a/packages/web/src/components/decisions/add-decision-button.tsx
+++ b/packages/web/src/components/decisions/add-decision-button.tsx
@@ -14,6 +14,7 @@ import {
import { Button } from "@repowise-dev/ui/ui/button";
import type { DecisionCreateInput } from "@repowise-dev/types/decisions";
import { createDecision } from "@/lib/api/decisions";
+import { useTranslations } from "next-intl";
/**
* The host half of recording a decision: the entry point, the POST, and the
@@ -21,6 +22,7 @@ import { createDecision } from "@/lib/api/decisions";
* its own client.
*/
export function AddDecisionButton({ repoId }: { repoId: string }) {
+ const t = useTranslations("decisions");
const [open, setOpen] = React.useState(false);
const router = useRouter();
@@ -35,17 +37,13 @@ export function AddDecisionButton({ repoId }: { repoId: string }) {
<>
<Button variant="outline" size="sm" onClick={() => setOpen(true)}>
<Plus className="h-3.5 w-3.5" />
- Record a decision
+ {t("add.trigger")}
</Button>
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent className="max-h-[90vh] max-w-2xl overflow-y-auto">
<DialogHeader>
- <DialogTitle>Record a decision</DialogTitle>
- <DialogDescription>
- Something the team has settled on. Name the files it governs and
- it is recorded as confirmed, because you are the person
- confirming it.
- </DialogDescription>
+ <DialogTitle>{t("add.title")}</DialogTitle>
+ <DialogDescription>{t("add.description")}</DialogDescription>
</DialogHeader>
<DecisionCreateForm
onSubmit={handleSubmit}
diff --git a/packages/web/src/components/decisions/decision-capture-settings-wrapper.tsx b/packages/web/src/components/decisions/decision-capture-settings-wrapper.tsx
index ef8abcda0..e6038a8e0 100644
--- a/packages/web/src/components/decisions/decision-capture-settings-wrapper.tsx
+++ b/packages/web/src/components/decisions/decision-capture-settings-wrapper.tsx
@@ -9,6 +9,7 @@ import {
getDecisionSettings,
updateDecisionSettings,
} from "@/lib/api/decisions";
+import { useTranslations } from "next-intl";
/**
* The host half of the capture settings: the fetch, the write, and the
@@ -26,6 +27,8 @@ export function DecisionCaptureSettingsWrapper({ repoId }: { repoId: string }) {
() => getDecisionSettings(repoId),
);
+ const t = useTranslations("decisions");
+
const onChange = React.useCallback(
async (update: DecisionSettingsUpdate) => {
try {
@@ -44,14 +47,14 @@ export function DecisionCaptureSettingsWrapper({ repoId }: { repoId: string }) {
if (!/409|conflict/i.test(message)) {
toast.error(
message
- ? `Couldn't save capture settings: ${message}`
- : "Couldn't save capture settings.",
+ ? t("capture.saveFailedWithMessage", { message })
+ : t("capture.saveFailed"),
);
}
throw err;
}
},
- [repoId, mutate],
+ [repoId, mutate, t],
);
return (
diff --git a/packages/web/src/components/decisions/decision-review-wrapper.tsx b/packages/web/src/components/decisions/decision-review-wrapper.tsx
index dad86d8e7..e2395605d 100644
--- a/packages/web/src/components/decisions/decision-review-wrapper.tsx
+++ b/packages/web/src/components/decisions/decision-review-wrapper.tsx
@@ -14,6 +14,7 @@ import {
listDecisions,
patchDecision,
} from "@/lib/api/decisions";
+import { useTranslations } from "next-intl";
interface Props {
repoId: string;
@@ -30,6 +31,7 @@ interface Props {
* a repository with a hundred rules in it.
*/
export function DecisionReviewWrapper({ repoId, pageSize = 50 }: Props) {
+ const t = useTranslations("decisions");
const [lane, setLane] = React.useState<DecisionLane>("active");
// A set, not one id: two accepts can be in flight, and a single value let
// the first to resolve re-enable the second row's buttons while its own
@@ -83,8 +85,8 @@ export function DecisionReviewWrapper({ repoId, pageSize = 50 }: Props) {
await patchDecision(repoId, d.id, { status });
toast.success(
status === "active"
- ? "Accepted. It governs the files it names."
- : "Dismissed. Reindexing will not propose it again.",
+ ? t("review.accepted")
+ : t("review.dismissed"),
);
// Both, and in parallel: a review action moves a record between lanes,
// so refreshing the rows without the badges leaves every tab count
@@ -96,8 +98,10 @@ export function DecisionReviewWrapper({ repoId, pageSize = 50 }: Props) {
// generic failure: it is the whole instruction for what to do next.
toast.error(
err instanceof Error
- ? `Couldn't ${status === "active" ? "accept" : "dismiss"}: ${err.message}`
- : "The review action failed.",
+ ? status === "active"
+ ? t("review.acceptFailed", { message: err.message })
+ : t("review.dismissFailed", { message: err.message })
+ : t("review.actionFailed"),
);
} finally {
setPending((prev) => {
@@ -107,7 +111,7 @@ export function DecisionReviewWrapper({ repoId, pageSize = 50 }: Props) {
});
}
},
- [repoId, mutate, mutateCounts],
+ [repoId, mutate, mutateCounts, t],
);
const rows = data ?? [];
@@ -153,13 +157,13 @@ export function DecisionReviewWrapper({ repoId, pageSize = 50 }: Props) {
onClick={() => setPage((p) => Math.max(0, p - 1))}
disabled={page === 0 || isLoading}
>
- Previous
+ {t("review.previous")}
</PageButton>
<PageButton
onClick={() => setPage((p) => p + 1)}
disabled={!hasNext || isLoading}
>
- Next
+ {t("review.next")}
</PageButton>
</div>
</div>
diff --git a/packages/web/src/components/docs/bulk-generate-button.tsx b/packages/web/src/components/docs/bulk-generate-button.tsx
index 8b3c09ea8..64e96be5e 100644
--- a/packages/web/src/components/docs/bulk-generate-button.tsx
+++ b/packages/web/src/components/docs/bulk-generate-button.tsx
@@ -11,6 +11,7 @@ import {
import { GenerationProgressWrapper } from "@/components/jobs/generation-progress-wrapper";
import { BulkGenerateConfirm } from "./bulk-generate-confirm";
import { useBulkGenerate } from "@/lib/hooks/use-bulk-generate";
+import { useTranslations } from "next-intl";
/**
* The one bulk generation action, mounted in the docs header. Writes every
@@ -26,6 +27,7 @@ export function BulkGenerateButton({
/** Called once a run completes so the host can refresh the page list. */
onGenerated?: () => void;
}) {
+ const t = useTranslations("docs");
const bulk = useBulkGenerate(repoId);
return (
@@ -38,10 +40,14 @@ export function BulkGenerateButton({
className="h-7 gap-1.5 border-[var(--color-accent-primary)]/40 bg-[var(--color-accent-muted)] text-xs text-[var(--color-accent-primary)] hover:bg-[var(--color-accent-muted)] hover:text-[var(--color-accent-hover)]"
>
<Sparkles className="h-3.5 w-3.5" />
- <span className="hidden sm:inline">Write subsystem pages</span>
+ <span className="hidden sm:inline">{t("bulk.button")}</span>
</Button>
- <BulkGenerateConfirm flow={bulk} repoId={repoId} title="Write the subsystem pages" />
+ <BulkGenerateConfirm
+ flow={bulk}
+ repoId={repoId}
+ title={t("bulk.title")}
+ />
<Dialog
open={bulk.jobId != null}
@@ -51,7 +57,7 @@ export function BulkGenerateButton({
>
<DialogContent className="sm:max-w-md">
<DialogHeader>
- <DialogTitle>Writing the subsystem pages</DialogTitle>
+ <DialogTitle>{t("bulk.writing")}</DialogTitle>
</DialogHeader>
{bulk.jobId != null && (
<GenerationProgressWrapper
diff --git a/packages/web/src/components/docs/bulk-generate-confirm.tsx b/packages/web/src/components/docs/bulk-generate-confirm.tsx
index 19e0f37e8..00d3f2462 100644
--- a/packages/web/src/components/docs/bulk-generate-confirm.tsx
+++ b/packages/web/src/components/docs/bulk-generate-confirm.tsx
@@ -3,6 +3,7 @@
import { GenerateConfirmDialog } from "@repowise-dev/ui/wiki/regenerate-button";
import { formatEstimateCost } from "@/lib/generate-format";
import { type useBulkGenerate } from "@/lib/hooks/use-bulk-generate";
+import { useTranslations } from "next-intl";
/**
* Maps a `useBulkGenerate` flow onto the shared, presentational
@@ -19,6 +20,7 @@ export function BulkGenerateConfirm({
/** Dialog title, e.g. "Write the subsystem pages". */
title?: string;
}) {
+ const t = useTranslations("docs");
const { estimate, noProvider } = flow;
const pages = estimate?.total_pages ?? 0;
@@ -27,10 +29,14 @@ export function BulkGenerateConfirm({
open={flow.confirmOpen}
onOpenChange={flow.setConfirmOpen}
mode="write"
- title={title ?? "Write the subsystem pages"}
+ title={title ?? t("bulk.title")}
cascadeScope="selection"
- description="Write every subsystem page still generated from structure, with your configured model."
- confirmLabel={pages > 0 ? `Write ${pages} ${pages === 1 ? "page" : "pages"}` : "Write with AI"}
+ description={t("bulkConfirm.description")}
+ confirmLabel={
+ pages > 0
+ ? t("bulkConfirm.writePages", { count: pages })
+ : t("bulkConfirm.writeWithAi")
+ }
cascade={flow.cascade}
onCascadeChange={flow.changeCascade}
estimate={
diff --git a/packages/web/src/components/docs/docs-explorer.tsx b/packages/web/src/components/docs/docs-explorer.tsx
index 29c4cc81d..b2397f465 100644
--- a/packages/web/src/components/docs/docs-explorer.tsx
+++ b/packages/web/src/components/docs/docs-explorer.tsx
@@ -37,6 +37,7 @@ import { search as searchPages } from "@/lib/api/search";
import { getPageById, listAllPages } from "@/lib/api/pages";
import { downloadTextFile } from "@/lib/utils/download";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
+import { useTranslations } from "next-intl";
import type { DocPage, DocPageSummary } from "@repowise-dev/types/docs";
import type { PageSummary } from "@/lib/api/types";
@@ -45,6 +46,8 @@ interface DocsExplorerProps {
}
export function DocsExplorer({ repoId }: DocsExplorerProps) {
+ const t = useTranslations("docs");
+ const tc = useTranslations("common");
const { pages, isLoading, mutate } = usePages(repoId);
// The list carries no bodies, so the reader's page is fetched on its own.
// Only the id is state; the page itself is whatever that id resolves to,
@@ -287,10 +290,10 @@ export function DocsExplorer({ repoId }: DocsExplorerProps) {
</div>
<div className="space-y-1">
<h3 className="text-sm font-semibold text-[var(--color-text-primary)]">
- No documentation yet
+ {t("explorer.emptyTitle")}
</h3>
<p className="text-xs text-[var(--color-text-secondary)] max-w-sm">
- Run a generation job to create AI-powered documentation for this codebase.
+ {t("explorer.emptyBody")}
</p>
</div>
</div>
@@ -332,7 +335,7 @@ export function DocsExplorer({ repoId }: DocsExplorerProps) {
<button
onClick={() => setTreePanelOpen((o) => !o)}
- aria-label={treePanelOpen ? "Hide pages tree" : "Show pages tree"}
+ aria-label={treePanelOpen ? t("explorer.hideTree") : t("explorer.showTree")}
aria-expanded={treePanelOpen}
className={cn(
"absolute top-3.5 z-20 rounded-md p-1 text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-elevated)] transition-colors",
@@ -364,8 +367,8 @@ export function DocsExplorer({ repoId }: DocsExplorerProps) {
target: selectedPage.id,
targetKind: "documentation",
}}
- question={`Explain "${selectedPage.title}" using the source code, and name the files it rests on.`}
- label={`Ask about ${selectedPage.title}`}
+ question={t("explorer.askQuestion", { title: selectedPage.title })}
+ label={t("explorer.askLabel", { title: selectedPage.title })}
className="shrink-0"
/>
)}
@@ -382,7 +385,7 @@ export function DocsExplorer({ repoId }: DocsExplorerProps) {
className="flex items-center gap-2 rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] px-2.5 py-1.5 text-xs text-[var(--color-text-tertiary)] transition-colors hover:text-[var(--color-text-secondary)]"
>
<Search className="h-3.5 w-3.5" />
- <span className="hidden sm:inline">Search</span>
+ <span className="hidden sm:inline">{tc("search")}</span>
<kbd className="hidden rounded border border-[var(--color-border-default)] px-1 py-0.5 text-[10px] sm:inline">
⌘K
</kbd>
diff --git a/packages/web/src/components/docs/docs-viewer.tsx b/packages/web/src/components/docs/docs-viewer.tsx
index 29d9f0e8b..b252b33a5 100644
--- a/packages/web/src/components/docs/docs-viewer.tsx
+++ b/packages/web/src/components/docs/docs-viewer.tsx
@@ -19,8 +19,10 @@ import { useGraphMetrics, useCallersCallees } from "@/lib/hooks/use-graph";
import type { ReaderPersona } from "@repowise-dev/ui/docs/reader-persona";
import type { DocPage, DocPageSummary } from "@repowise-dev/types/docs";
import type { PageResponse, PageSummary } from "@/lib/api/types";
+import { useTranslations } from "next-intl";
function PercentileBar({ value, label }: { value: number; label: string }) {
+ const t = useTranslations("docs");
const pct = 100 - value;
return (
<div className="flex items-center justify-between gap-2">
@@ -39,7 +41,7 @@ function PercentileBar({ value, label }: { value: number; label: string }) {
"text-[10px] font-mono tabular-nums w-10 text-right",
value >= 75 ? "text-[var(--color-success)]" : value >= 50 ? "text-[var(--color-warning)]" : "text-[var(--color-text-tertiary)]",
)}>
- Top {pct}%
+ {t("viewer.topPercent", { pct })}
</span>
</div>
</div>
@@ -47,6 +49,7 @@ function PercentileBar({ value, label }: { value: number; label: string }) {
}
function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: string }) {
+ const t = useTranslations("docs");
const nodeId = targetPath;
const { metrics, isLoading: metricsLoading } = useGraphMetrics(repoId, nodeId);
const symbolNodeId = targetPath.includes("::") ? targetPath : null;
@@ -76,20 +79,34 @@ function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: strin
{metrics.betweenness_scored === false ? (
// Never measured, so a percentile bar would draw a rank it does not have.
<div className="flex items-center justify-between">
- <span className="text-xs text-[var(--color-text-tertiary)]">Centrality</span>
- <span className="text-xs text-[var(--color-text-tertiary)]">Not scored yet</span>
+ <span className="text-xs text-[var(--color-text-tertiary)]">
+ {t("viewer.centrality")}
+ </span>
+ <span className="text-xs text-[var(--color-text-tertiary)]">
+ {t("viewer.notScored")}
+ </span>
</div>
) : (
- <PercentileBar value={metrics.betweenness_percentile} label="Centrality" />
+ <PercentileBar
+ value={metrics.betweenness_percentile}
+ label={t("viewer.centrality")}
+ />
)}
<div className="flex items-center justify-between">
- <span className="text-xs text-[var(--color-text-tertiary)]">Degree</span>
+ <span className="text-xs text-[var(--color-text-tertiary)]">
+ {t("viewer.degree")}
+ </span>
<span className="text-xs font-mono text-[var(--color-text-secondary)]">
- {metrics.in_degree} in &middot; {metrics.out_degree} out
+ {t("viewer.degreeValue", {
+ inbound: metrics.in_degree,
+ outbound: metrics.out_degree,
+ })}
</span>
</div>
{metrics.is_entry_point && (
- <Badge variant="accent" className="text-[10px]">Entry Point</Badge>
+ <Badge variant="accent" className="text-[10px]">
+ {t("viewer.entryPoint")}
+ </Badge>
)}
</div>
</div>
@@ -98,7 +115,9 @@ function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: strin
rest rather than as its own titled section. */}
{metrics.community_label && (
<div className="flex items-center justify-between gap-2">
- <span className="text-xs text-[var(--color-text-tertiary)]">Community</span>
+ <span className="text-xs text-[var(--color-text-tertiary)]">
+ {t("viewer.community")}
+ </span>
<Link
href={`/repos/${repoId}/architecture?view=communities`}
className="inline-flex items-center gap-1 truncate text-xs text-[var(--color-accent)] hover:underline"
@@ -114,7 +133,9 @@ function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: strin
<div>
{callData.caller_count > 0 && (
<div className="mb-2">
- <p className="text-[10px] text-[var(--color-text-tertiary)] mb-1">Called by ({callData.caller_count})</p>
+ <p className="text-[10px] text-[var(--color-text-tertiary)] mb-1">
+ {t("viewer.calledBy", { count: callData.caller_count })}
+ </p>
{callData.callers.slice(0, 5).map((c) => (
<p key={c.symbol_id} className="text-xs font-mono text-[var(--color-text-secondary)] truncate pl-2" title={c.symbol_id}>
{c.name}
@@ -124,7 +145,9 @@ function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: strin
)}
{callData.callee_count > 0 && (
<div>
- <p className="text-[10px] text-[var(--color-text-tertiary)] mb-1">Calls ({callData.callee_count})</p>
+ <p className="text-[10px] text-[var(--color-text-tertiary)] mb-1">
+ {t("viewer.calls", { count: callData.callee_count })}
+ </p>
{callData.callees.slice(0, 5).map((c) => (
<p key={c.symbol_id} className="text-xs font-mono text-[var(--color-text-secondary)] truncate pl-2" title={c.symbol_id}>
{c.name}
@@ -145,6 +168,7 @@ function DocsSidebar({ repoId, targetPath }: { repoId: string; targetPath: strin
* Renders nothing for non-file pages or files without git history.
*/
function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string }) {
+ const t = useTranslations("docs");
const isFile =
!!targetPath &&
!targetPath.includes("::") &&
@@ -172,15 +196,17 @@ function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string
{data.is_hotspot && (
<Badge variant="outline" className="text-[10px] border-[var(--color-warning)]/40 text-[var(--color-warning)]">
<Flame className="h-2.5 w-2.5 mr-1" />
- Hotspot · top {churnTop}%
+ {t("viewer.hotspot", { pct: churnTop })}
</Badge>
)}
{data.is_stable && !data.is_hotspot && (
- <Badge variant="outline" className="text-[10px]">Stable</Badge>
+ <Badge variant="outline" className="text-[10px]">
+ {t("viewer.stable")}
+ </Badge>
)}
{data.bus_factor === 1 && (
<Badge variant="outline" className="text-[10px] border-[var(--color-warning)]/40 text-[var(--color-warning)]">
- Bus factor 1
+ {t("viewer.busFactorOne")}
</Badge>
)}
{/* Plain outline, like every other chip in this row. It used to carry
@@ -190,17 +216,19 @@ function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string
<Badge
variant="outline"
className="text-[10px]"
- title={`Repeatedly bug-fixed, most recently ${fix.age}.`}
+ title={t("viewer.bugMagnetTitle", { age: fix.age ?? "" })}
>
<Bug className="h-2.5 w-2.5 mr-1" />
- Bug magnet
+ {t("viewer.bugMagnet")}
</Badge>
)}
</div>
<div className="mt-2 space-y-1 text-xs text-[var(--color-text-secondary)]">
{data.primary_owner_name && (
<div className="flex items-center justify-between gap-2">
- <span className="text-[var(--color-text-tertiary)]">Owner</span>
+ <span className="text-[var(--color-text-tertiary)]">
+ {t("viewer.owner")}
+ </span>
<span className="truncate" title={data.primary_owner_name}>
{data.primary_owner_name}
{data.primary_owner_commit_pct != null &&
@@ -209,20 +237,29 @@ function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string
</div>
)}
<div className="flex items-center justify-between gap-2">
- <span className="text-[var(--color-text-tertiary)]">Commits (90d)</span>
+ <span className="text-[var(--color-text-tertiary)]">
+ {t("viewer.commits90d")}
+ </span>
<span className="font-mono">{data.commit_count_90d}</span>
</div>
{fix && (
<div className="flex items-center justify-between gap-2">
- <span className="text-[var(--color-text-tertiary)]">Bug fixes</span>
- <span className="font-mono" title="Bug-fix commits that touched this file in the trailing defect window.">
+ <span className="text-[var(--color-text-tertiary)]">
+ {t("viewer.bugFixes")}
+ </span>
+ <span
+ className="font-mono"
+ title={t("viewer.bugFixesTitle")}
+ >
{fix.count}
{fix.age && ` · last ${fix.age}`}
</span>
</div>
)}
<div className="flex items-center justify-between gap-2">
- <span className="text-[var(--color-text-tertiary)]">Contributors</span>
+ <span className="text-[var(--color-text-tertiary)]">
+ {t("viewer.contributors")}
+ </span>
<span className="font-mono">{data.contributor_count}</span>
</div>
{data.agent_authored_pct != null && (data.agent_commit_count ?? 0) > 0 && (
@@ -235,7 +272,9 @@ function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string
)}
{data.original_path && (
<div className="flex items-center justify-between gap-2">
- <span className="shrink-0 text-[var(--color-text-tertiary)]">Renamed from</span>
+ <span className="shrink-0 text-[var(--color-text-tertiary)]">
+ {t("viewer.renamedFrom")}
+ </span>
<span className="truncate font-mono" title={data.original_path}>
{data.original_path}
</span>
@@ -243,7 +282,7 @@ function AtAGlance({ repoId, targetPath }: { repoId: string; targetPath: string
)}
{data.commit_count_capped && (
<p className="text-[10px] text-[var(--color-text-tertiary)]">
- History capped during indexing, so older commits are not counted above.
+ {t("viewer.historyCapped")}
</p>
)}
</div>
@@ -285,6 +324,7 @@ export function DocsViewer({
onGenerated,
missingPageId,
}: DocsViewerProps) {
+ const t = useTranslations("docs");
const buildPageHref = useCallback(
(pageId: string) => docsPagePath(`/repos/${repoId}`, pageId),
[repoId],
@@ -358,7 +398,7 @@ export function DocsViewer({
// about this code before I touch it — so they read as one list.
<div>
<p className="mb-2.5 font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
- Signals
+ {t("viewer.signals")}
</p>
<div className="flex flex-col gap-4">
<AtAGlance repoId={repoId} targetPath={targetPath} />
diff --git a/packages/web/src/components/docs/page-generate-button.tsx b/packages/web/src/components/docs/page-generate-button.tsx
index 355e95387..31dddfaf0 100644
--- a/packages/web/src/components/docs/page-generate-button.tsx
+++ b/packages/web/src/components/docs/page-generate-button.tsx
@@ -14,6 +14,7 @@ import { regeneratePage } from "@/lib/api/pages";
import { generateEstimate } from "@/lib/api/repos";
import { formatEstimateCost } from "@/lib/generate-format";
import type { PageResponse, GenerateEstimate } from "@/lib/api/types";
+import { useTranslations } from "next-intl";
/**
* Reader-side "Write with AI" / "Regenerate" for a single page. Owns the
@@ -37,6 +38,7 @@ export function PageGenerateButton({
// "Write" on a stub concept page, "Regenerate" on a written one. Callers only
// mount this on the model-written page types, so a stub here is genuinely a
// page awaiting its first prose, never a structural file page.
+ const t = useTranslations("docs");
const mode = isStubPage(page) ? "write" : "regenerate";
const settingsHref = `/repos/${repoId}/settings#provider`;
@@ -105,7 +107,9 @@ export function PageGenerateButton({
setJobId(res.job_id);
setConfirmOpen(false);
} catch (e) {
- toast.error("Couldn't start generation", { description: toFriendlyMessage(e) });
+ toast.error(t("pageGenerate.failed"), {
+ description: toFriendlyMessage(e),
+ });
} finally {
setLaunching(false);
}
diff --git a/packages/web/src/components/files/file-health-panel.tsx b/packages/web/src/components/files/file-health-panel.tsx
index 941531265..bf36a90aa 100644
--- a/packages/web/src/components/files/file-health-panel.tsx
+++ b/packages/web/src/components/files/file-health-panel.tsx
@@ -10,6 +10,7 @@ import {
refactoringOpportunityHref,
} from "@/lib/api/file-opportunity";
import type { FileDetailHealth, FunctionBlameRow } from "@repowise-dev/types/files";
+import { useTranslations } from "next-intl";
interface FileHealthPanelProps {
repoId: string;
@@ -33,14 +34,17 @@ export function FileHealthPanel({
health,
functionBlame,
}: FileHealthPanelProps) {
+ const t = useTranslations("files");
const prefix = `/repos/${repoId}`;
const onFindingStatusChange = async (findingId: string, status: FindingStatus) => {
try {
await updateFindingStatus(repoId, findingId, status);
- toast.success(`Finding marked ${status.replace("_", " ")}`);
+ toast.success(
+ t("health.findingMarked", { status: status.replace("_", " ") }),
+ );
} catch (err) {
- toast.error("Couldn't update finding status");
+ toast.error(t("health.statusFailed"));
throw err;
}
};
diff --git a/packages/web/src/components/files/files-explorer.tsx b/packages/web/src/components/files/files-explorer.tsx
index 623b769ff..83879f81a 100644
--- a/packages/web/src/components/files/files-explorer.tsx
+++ b/packages/web/src/components/files/files-explorer.tsx
@@ -7,8 +7,10 @@ import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
import { FilesIndex } from "@repowise-dev/ui/files";
import { fileEntityPath } from "@repowise-dev/ui/shared/entity";
import { getFilesIndex } from "@/lib/api/files";
+import { useTranslations } from "next-intl";
export function FilesExplorer({ repoId }: { repoId: string }) {
+ const t = useTranslations("files");
const { data, error, isLoading } = useSWR(
`files-index:${repoId}`,
() => getFilesIndex(repoId),
@@ -53,7 +55,7 @@ export function FilesExplorer({ repoId }: { repoId: string }) {
return (
<div className="flex items-center gap-2 rounded-lg border border-[var(--color-border-default)] p-4 text-sm text-[var(--color-text-secondary)]">
<AlertTriangle className="h-4 w-4 text-[var(--color-warning)]" />
- Couldn&apos;t load the file index for this repository.
+ {t("explorer.loadFailed")}
</div>
);
}
diff --git a/packages/web/src/components/health/health-file-drawer-host.tsx b/packages/web/src/components/health/health-file-drawer-host.tsx
index b72a92ed0..6cce00f8a 100644
--- a/packages/web/src/components/health/health-file-drawer-host.tsx
+++ b/packages/web/src/components/health/health-file-drawer-host.tsx
@@ -16,6 +16,7 @@ import {
} from "@/lib/api/file-opportunity";
import { getRelatedWork, relatedWorkHref } from "@/lib/api/related-work";
import { useFileBreakdown } from "./use-file-breakdown";
+import { useTranslations } from "next-intl";
import type { HealthCounts } from "@repowise-dev/types/health";
/** Causes listed for one file. A file with more than this is its own queue. */
@@ -36,6 +37,7 @@ export function HealthFileDrawerHost({
/** The surface the file was opened from; drives what the drawer leads with. */
lens?: string;
}) {
+ const t = useTranslations("health");
const router = useRouter();
const { data, isLoading } = useFileBreakdown(repoId, filePath, counts);
const prefix = `/repos/${repoId}`;
@@ -117,9 +119,11 @@ export function HealthFileDrawerHost({
findingId,
status as Parameters<typeof updateFindingStatus>[2],
);
- toast.success(`Finding marked ${status.replace("_", " ")}`);
+ toast.success(
+ t("findingMarked", { status: status.replace("_", " ") }),
+ );
} catch (err) {
- toast.error("Couldn't update finding status");
+ toast.error(t("findingStatusFailed"));
throw err;
}
}}
diff --git a/packages/web/src/components/jobs/generation-progress-wrapper.tsx b/packages/web/src/components/jobs/generation-progress-wrapper.tsx
index a8f2bfd5b..187a2a867 100644
--- a/packages/web/src/components/jobs/generation-progress-wrapper.tsx
+++ b/packages/web/src/components/jobs/generation-progress-wrapper.tsx
@@ -8,6 +8,7 @@ import { cancelJob } from "@/lib/api/jobs";
import { formatNumber } from "@repowise-dev/ui/lib/format";
import { computeElapsedMs } from "@/lib/jobs/progress";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface Props {
jobId: string;
@@ -25,6 +26,7 @@ interface Props {
const PENDING_STUCK_THRESHOLD_MS = 30_000;
export function GenerationProgressWrapper({ jobId, repoName, onDone, onRetry, quiet }: Props) {
+ const t = useTranslations("jobs");
const { job, sse, messages, phase } = useJob(jobId);
const [elapsed, setElapsed] = useState(0);
const [actualCost, setActualCost] = useState<number | null>(null);
@@ -53,29 +55,42 @@ export function GenerationProgressWrapper({ jobId, repoName, onDone, onRetry, qu
if (job?.status === "completed") {
notifiedRef.current = true;
if (!quiet) {
- toast.success(`Documentation updated${repoName ? ` — ${repoName}` : ""}`, {
- description: `${formatNumber(job.completed_pages)} pages generated`,
- });
+ toast.success(
+ t("completed", { name: repoName ? ` — ${repoName}` : "" }),
+ {
+ description: t("pagesGenerated", {
+ count: formatNumber(job.completed_pages),
+ }),
+ },
+ );
}
onDone?.("completed");
} else if (job?.status === "failed") {
notifiedRef.current = true;
if (!quiet) {
- toast.error("Generation failed", {
- description: job.error_message ?? "Unknown error",
+ toast.error(t("failed"), {
+ description: job.error_message ?? t("unknownError"),
});
}
onDone?.("failed");
} else if (job?.status === "cancelled") {
notifiedRef.current = true;
if (!quiet) {
- toast.info("Job cancelled", {
- description: "The pipeline was stopped before completion.",
+ toast.info(t("cancelled"), {
+ description: t("cancelledDescription"),
});
}
onDone?.("cancelled");
}
- }, [job?.status, job?.completed_pages, job?.error_message, repoName, onDone, quiet]);
+ }, [
+ job?.status,
+ job?.completed_pages,
+ job?.error_message,
+ repoName,
+ onDone,
+ quiet,
+ t,
+ ]);
const isPending = job?.status === "pending";
const stuckPending =
@@ -91,7 +106,7 @@ export function GenerationProgressWrapper({ jobId, repoName, onDone, onRetry, qu
// The stream/poll flips the job to "cancelled"; the status effect above
// owns the toast so cancel-from-button and cancel-from-elsewhere match.
} catch (e) {
- toast.error("Couldn't cancel job", {
+ toast.error(t("cancelFailed"), {
description: toFriendlyMessage(e),
});
} finally {
diff --git a/packages/web/src/components/jobs/live-job-progress.tsx b/packages/web/src/components/jobs/live-job-progress.tsx
index d19c6403d..1f8bf5a90 100644
--- a/packages/web/src/components/jobs/live-job-progress.tsx
+++ b/packages/web/src/components/jobs/live-job-progress.tsx
@@ -1,6 +1,7 @@
"use client";
import { useJob } from "@/lib/hooks/use-job";
+import { useTranslations } from "next-intl";
/**
* Live progress text for a running/pending generation job. Subscribes to the
@@ -16,6 +17,7 @@ export function LiveJobProgress({
initialCompleted: number;
initialTotal: number;
}) {
+ const t = useTranslations("jobs");
const { job, sse } = useJob(jobId);
const completed =
sse.data?.completed_pages ?? job?.completed_pages ?? initialCompleted;
@@ -25,7 +27,7 @@ export function LiveJobProgress({
return (
<span className="inline-flex items-center gap-2 text-[var(--color-model)]">
<span className="tabular-nums">
- {completed}/{total} pages
+ {t("progressCount", { completed, total })}
</span>
<span className="h-1 w-16 overflow-hidden rounded-full bg-[var(--color-bg-inset)]">
<span
diff --git a/packages/web/src/components/layout/app-shell-skeleton.tsx b/packages/web/src/components/layout/app-shell-skeleton.tsx
index 66e4ac162..2753205ac 100644
--- a/packages/web/src/components/layout/app-shell-skeleton.tsx
+++ b/packages/web/src/components/layout/app-shell-skeleton.tsx
@@ -1,4 +1,5 @@
import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
+import { getTranslations } from "next-intl/server";
/**
* The shell itself, waiting. This is the one place with no page layout to
@@ -9,11 +10,13 @@ import { SkeletonRegion, Skeleton } from "@repowise-dev/ui/ui/skeleton";
* suspended, so a slow first paint looked like a blank app rather than a
* loading one.
*/
-export function AppShellSkeleton() {
+export async function AppShellSkeleton() {
+ const t = await getTranslations("shell");
+
return (
<SkeletonRegion
className="flex h-screen overflow-hidden"
- label="Loading Repowise"
+ label={t("skeleton.loading")}
>
{/* Matches Sidebar's expanded width (`w-[280px]`). */}
<div className="hidden w-[280px] shrink-0 flex-col gap-2 border-r border-[var(--color-border-default)] p-4 md:flex">
diff --git a/packages/web/src/components/layout/feedback-button.tsx b/packages/web/src/components/layout/feedback-button.tsx
index 6e3256631..b19fe756c 100644
--- a/packages/web/src/components/layout/feedback-button.tsx
+++ b/packages/web/src/components/layout/feedback-button.tsx
@@ -13,22 +13,39 @@ import {
import { Button } from "@repowise-dev/ui/ui/button";
import { toast } from "sonner";
import { submitFeedback, type FeedbackCategory } from "@/lib/api/feedback";
+import { useTranslations } from "next-intl";
-const CATEGORIES: { value: FeedbackCategory; label: string }[] = [
- { value: "ui_ux", label: "UI / UX" },
- { value: "bug", label: "Bug" },
- { value: "feature_request", label: "Feature request" },
- { value: "other", label: "Other" },
+/** The categories in the order they are offered. The labels are read from the
+ * active locale inside the component, so the list is built there. */
+const CATEGORY_VALUES: FeedbackCategory[] = [
+ "ui_ux",
+ "bug",
+ "feature_request",
+ "other",
];
const MAX_LENGTH = 4000;
+/** Suffix per category, so the label keys stay greppable and typed. */
+const CATEGORY_KEYS: Record<FeedbackCategory, string> = {
+ ui_ux: "UiUx",
+ bug: "Bug",
+ feature_request: "Feature",
+ other: "Other",
+};
+
/**
* Sidebar-footer feedback entry point for the self-hosted dashboard. Opens a
* categorised dialog; submissions POST to the local server's `/api/feedback`,
* which forwards them to the Repowise maintainers. Works without an account.
*/
export function FeedbackButton() {
+ const t = useTranslations("shell");
+ const tc = useTranslations("common");
+ const categories = CATEGORY_VALUES.map((value) => ({
+ value,
+ label: t(`feedback.category${CATEGORY_KEYS[value]}`),
+ }));
const [open, setOpen] = useState(false);
const [category, setCategory] = useState<FeedbackCategory>("ui_ux");
const [message, setMessage] = useState("");
@@ -50,7 +67,7 @@ export function FeedbackButton() {
const handleSubmit = async () => {
const trimmed = message.trim();
if (!trimmed) {
- toast.error("Please enter your feedback.");
+ toast.error(t("feedback.empty"));
return;
}
setSubmitting(true);
@@ -61,11 +78,11 @@ export function FeedbackButton() {
...(email.trim() && { email: email.trim() }),
...(typeof window !== "undefined" && { pageUrl: window.location.href }),
});
- toast.success("Thanks for the feedback!");
+ toast.success(t("feedback.thanks"));
setOpen(false);
reset();
} catch {
- toast.error("Couldn't send feedback. Please try again.");
+ toast.error(t("feedback.failed"));
} finally {
setSubmitting(false);
}
@@ -76,31 +93,28 @@ export function FeedbackButton() {
<button
type="button"
onClick={() => setOpen(true)}
- aria-label="Help us improve Repowise"
+ aria-label={t("feedback.title")}
className="flex w-full items-center gap-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 py-2 text-xs font-medium text-[var(--color-text-secondary)] transition-colors hover:border-[var(--color-accent-primary)]/50 hover:bg-[var(--color-accent-muted)] hover:text-[var(--color-text-primary)]"
>
<MessageSquarePlus className="h-4 w-4 shrink-0 text-[var(--color-accent-primary)]" />
- <span>Help us improve Repowise</span>
+ <span>{t("feedback.title")}</span>
</button>
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogContent className="max-w-md">
<DialogHeader>
- <DialogTitle>Help us improve Repowise</DialogTitle>
- <DialogDescription>
- Found a bug or have an idea? It goes straight to the maintainers, and we read every
- message. It&apos;s anonymous by default — no account needed.
- </DialogDescription>
+ <DialogTitle>{t("feedback.title")}</DialogTitle>
+ <DialogDescription>{t("feedback.description")}</DialogDescription>
</DialogHeader>
<div className="space-y-4">
{/* Category */}
<div>
<label className="mb-1.5 block text-xs font-medium text-[var(--color-text-tertiary)]">
- Category
+ {t("feedback.category")}
</label>
<div className="flex flex-wrap gap-2">
- {CATEGORIES.map((option) => (
+ {categories.map((option) => (
<button
key={option.value}
type="button"
@@ -123,7 +137,7 @@ export function FeedbackButton() {
htmlFor="feedback-message"
className="mb-1.5 block text-xs font-medium text-[var(--color-text-tertiary)]"
>
- Your feedback
+ {t("feedback.messageLabel")}
</label>
<textarea
id="feedback-message"
@@ -132,7 +146,7 @@ export function FeedbackButton() {
maxLength={MAX_LENGTH}
value={message}
onChange={(e) => setMessage(e.target.value)}
- placeholder="Tell us what's working, what's broken, or what you'd love to see..."
+ placeholder={t("feedback.messagePlaceholder")}
className="w-full resize-none rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] px-3 py-2.5 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus:border-[var(--color-accent-primary)] focus:outline-none focus:ring-1 focus:ring-[var(--color-accent-primary)]"
/>
<p className="mt-1 text-right text-[11px] text-[var(--color-text-tertiary)]">
@@ -146,9 +160,9 @@ export function FeedbackButton() {
htmlFor="feedback-email"
className="mb-1.5 block text-xs font-medium text-[var(--color-text-tertiary)]"
>
- Email{" "}
+ {t("feedback.emailLabel")}{" "}
<span className="font-normal text-[var(--color-text-tertiary)]">
- (optional, if you&apos;d like a reply)
+ {t("feedback.emailOptional")}
</span>
</label>
<input
@@ -164,17 +178,15 @@ export function FeedbackButton() {
<div className="flex items-start gap-1.5 text-[11px] text-[var(--color-text-tertiary)]">
<Lock className="mt-0.5 h-3 w-3 shrink-0" aria-hidden="true" />
- <span>
- Submitted anonymously. We only see your email if you add one above.
- </span>
+ <span>{t("feedback.anonymous")}</span>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => handleOpenChange(false)} disabled={submitting}>
- Cancel
+ {tc("cancel")}
</Button>
<Button onClick={handleSubmit} disabled={submitting || !message.trim()}>
- {submitting ? "Sending…" : "Send feedback"}
+ {submitting ? t("feedback.sending") : t("feedback.send")}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/packages/web/src/components/layout/mobile-nav.tsx b/packages/web/src/components/layout/mobile-nav.tsx
index f8d420941..545a47db6 100644
--- a/packages/web/src/components/layout/mobile-nav.tsx
+++ b/packages/web/src/components/layout/mobile-nav.tsx
@@ -3,6 +3,7 @@
import * as React from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
+import { useTranslations } from "next-intl";
import { BrandLogo } from "./brand-logo";
import {
Menu,
@@ -34,6 +35,8 @@ interface MobileNavProps {
}
export function MobileNav({ repos = [], workspace }: MobileNavProps) {
+ const t = useTranslations("nav");
+ const ts = useTranslations("shell");
const isWorkspace = workspace?.is_workspace ?? false;
const [open, setOpen] = React.useState(false);
const pathname = usePathname();
@@ -75,7 +78,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
variant="ghost"
size="icon"
onClick={() => setOpen(true)}
- aria-label="Open navigation menu"
+ aria-label={ts("openNavMenu")}
className="h-11 w-11"
>
<Menu className="h-5 w-5" />
@@ -92,7 +95,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
onClick={() => {
window.dispatchEvent(new CustomEvent("repowise:open-command-palette"));
}}
- aria-label="Open search"
+ aria-label={ts("openSearch")}
className="h-11 w-11"
>
<Search className="h-5 w-5" />
@@ -130,7 +133,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
)}
/>
</span>
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{t(item.labelKey)}</span>
</Link>
);
})}
@@ -139,7 +142,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
{isWorkspace && (
<>
<p className="mb-1 mt-4 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- Workspace
+ {ts("workspace")}
</p>
{/* Children of the Workspace group, same as on desktop:
indented, ruled, and at the nested size. */}
@@ -168,7 +171,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
)}
/>
</span>
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{t(item.labelKey)}</span>
</Link>
);
})}
@@ -180,7 +183,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
<>
<Separator className="my-4" />
<p className="mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- Repositories
+ {ts("repositories")}
</p>
<div className="space-y-0.5">
{repos.map((repo) => {
@@ -212,7 +215,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
<React.Fragment key={group.label ?? gi}>
{group.label ? (
<p className="px-2 pt-2 pb-0.5 text-[10px] font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- {group.label}
+ {group.labelKey ? t(group.labelKey) : group.label}
</p>
) : gi > 0 ? (
<div className="pt-1.5" />
@@ -239,7 +242,7 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
)}
/>
</span>
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{t(item.labelKey)}</span>
</Link>
);
})}
@@ -275,7 +278,9 @@ export function MobileNav({ repos = [], workspace }: MobileNavProps) {
version row, same as the desktop footer. */}
<div className="flex items-center justify-between gap-2">
<VersionFooter />
- <ThemeToggle compact />
+ <div className="flex items-center gap-1">
+ <ThemeToggle compact />
+ </div>
</div>
</div>
</SheetContent>
diff --git a/packages/web/src/components/layout/nav-items.ts b/packages/web/src/components/layout/nav-items.ts
index b21b25ca8..da956b439 100644
--- a/packages/web/src/components/layout/nav-items.ts
+++ b/packages/web/src/components/layout/nav-items.ts
@@ -33,7 +33,14 @@ import {
} from "lucide-react";
export interface NavItem {
+ /**
+ * English label. Kept as the canonical value for non-visual uses — command
+ * palette keyword matching and the `title`/aria fallback — so a translated
+ * UI never changes what a search query has to match.
+ */
label: string;
+ /** Message key under the `nav` namespace; what the UI actually renders. */
+ labelKey: string;
href: string;
icon: React.ComponentType<{ className?: string }>;
exact?: boolean;
@@ -42,20 +49,22 @@ export interface NavItem {
export interface NavGroup {
/** Optional section label rendered above the items. */
label?: string;
+ /** Message key under `nav` for the group label. */
+ labelKey?: string;
items: NavItem[];
}
export const GLOBAL_NAV: NavItem[] = [
- { label: "Dashboard", href: "/", icon: LayoutDashboard },
- { label: "Settings", href: "/settings", icon: Settings },
+ { label: "Dashboard", labelKey: "dashboard", href: "/", icon: LayoutDashboard },
+ { label: "Settings", labelKey: "settings", href: "/settings", icon: Settings },
];
export const WORKSPACE_NAV: NavItem[] = [
- { label: "Overview", href: "/workspace", icon: Layers, exact: true },
- { label: "System Map", href: "/workspace/system-map", icon: Waypoints },
- { label: "Conformance", href: "/workspace/conformance", icon: ShieldCheck },
- { label: "Contracts", href: "/workspace/contracts", icon: Link2 },
- { label: "Co-Changes", href: "/workspace/co-changes", icon: GitMerge },
+ { label: "Overview", labelKey: "overview", href: "/workspace", icon: Layers, exact: true },
+ { label: "System Map", labelKey: "systemMap", href: "/workspace/system-map", icon: Waypoints },
+ { label: "Conformance", labelKey: "conformance", href: "/workspace/conformance", icon: ShieldCheck },
+ { label: "Contracts", labelKey: "contracts", href: "/workspace/contracts", icon: Link2 },
+ { label: "Co-Changes", labelKey: "coChanges", href: "/workspace/co-changes", icon: GitMerge },
];
export function repoNavGroups(repoId: string): NavGroup[] {
@@ -63,30 +72,32 @@ export function repoNavGroups(repoId: string): NavGroup[] {
return [
{
items: [
- { label: "Overview", href: `${base}/overview`, icon: Activity },
- { label: "Chat", href: `${base}/chat`, icon: MessageSquare },
- { label: "Docs", href: `${base}/docs`, icon: BookOpen },
- { label: "Architecture", href: `${base}/architecture`, icon: Boxes },
- { label: "Knowledge Graph", href: `${base}/knowledge-graph`, icon: ScanSearch },
- { label: "Code Health", href: `${base}/code-health`, icon: HeartPulse },
- { label: "Refactoring", href: `${base}/refactoring`, icon: Wrench },
- { label: "Files", href: `${base}/files`, icon: FolderTree },
+ { label: "Overview", labelKey: "overview", href: `${base}/overview`, icon: Activity },
+ { label: "Chat", labelKey: "chat", href: `${base}/chat`, icon: MessageSquare },
+ { label: "Docs", labelKey: "docs", href: `${base}/docs`, icon: BookOpen },
+ { label: "Architecture", labelKey: "architecture", href: `${base}/architecture`, icon: Boxes },
+ { label: "Knowledge Graph", labelKey: "knowledgeGraph", href: `${base}/knowledge-graph`, icon: ScanSearch },
+ { label: "Code Health", labelKey: "codeHealth", href: `${base}/code-health`, icon: HeartPulse },
+ { label: "Refactoring", labelKey: "refactoring", href: `${base}/refactoring`, icon: Wrench },
+ { label: "Files", labelKey: "files", href: `${base}/files`, icon: FolderTree },
],
},
{
label: "People & History",
+ labelKey: "groupPeopleAndHistory",
items: [
- { label: "Commits", href: `${base}/commits`, icon: GitCommitHorizontal },
- { label: "Contributors", href: `${base}/owners`, icon: Users },
- { label: "Decisions", href: `${base}/decisions`, icon: Lightbulb },
+ { label: "Commits", labelKey: "commits", href: `${base}/commits`, icon: GitCommitHorizontal },
+ { label: "Contributors", labelKey: "contributors", href: `${base}/owners`, icon: Users },
+ { label: "Decisions", labelKey: "decisions", href: `${base}/decisions`, icon: Lightbulb },
],
},
{
label: "Settings",
+ labelKey: "groupSettings",
items: [
- { label: "Stats", href: `${base}/stats`, icon: BarChart3 },
- { label: "Usage & savings", href: `${base}/costs`, icon: DollarSign },
- { label: "Settings", href: `${base}/settings`, icon: Settings },
+ { label: "Stats", labelKey: "stats", href: `${base}/stats`, icon: BarChart3 },
+ { label: "Usage & savings", labelKey: "usageAndSavings", href: `${base}/costs`, icon: DollarSign },
+ { label: "Settings", labelKey: "settings", href: `${base}/settings`, icon: Settings },
],
},
];
diff --git a/packages/web/src/components/layout/reindex-hint-banner.tsx b/packages/web/src/components/layout/reindex-hint-banner.tsx
index 4586890a4..ced1cc430 100644
--- a/packages/web/src/components/layout/reindex-hint-banner.tsx
+++ b/packages/web/src/components/layout/reindex-hint-banner.tsx
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import { AlertTriangle, X } from "lucide-react";
import useSWR from "swr";
import { getMetaVersion } from "@/lib/api/meta";
+import { useTranslations } from "next-intl";
const STORAGE_PREFIX = "repowise:reindex-hint-dismissed:";
@@ -18,6 +19,8 @@ export interface ReindexHintBannerProps {
* case (store compatible) or if the check fails.
*/
export function ReindexHintBanner({ repoId }: ReindexHintBannerProps) {
+ const t = useTranslations("shell");
+ const tc = useTranslations("common");
const { data: meta } = useSWR(
["meta-version", repoId],
() => getMetaVersion(repoId),
@@ -58,8 +61,7 @@ export function ReindexHintBanner({ repoId }: ReindexHintBannerProps) {
aria-hidden="true"
/>
<div className="flex-1 text-[var(--color-text-primary)]">
- This index was built by an older repowise. It still works, but a reindex is
- recommended to pick up the latest format.
+ {t("reindexHint.body")}
{command && (
<>
{" "}
@@ -72,7 +74,7 @@ export function ReindexHintBanner({ repoId }: ReindexHintBannerProps) {
<button
type="button"
onClick={dismiss}
- aria-label="Dismiss"
+ aria-label={tc("dismiss")}
className="rounded p-1 text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]"
>
<X className="h-4 w-4" />
diff --git a/packages/web/src/components/layout/repo-breadcrumb-label.ts b/packages/web/src/components/layout/repo-breadcrumb-label.ts
index 51a15168e..834f0cb26 100644
--- a/packages/web/src/components/layout/repo-breadcrumb-label.ts
+++ b/packages/web/src/components/layout/repo-breadcrumb-label.ts
@@ -29,6 +29,45 @@ const SEGMENT_LABELS: Record<string, string> = {
files: "Files",
};
+/**
+ * Message keys under the `breadcrumb` namespace for the configured segments.
+ *
+ * Kept beside the English labels so the two cannot drift: every key here has
+ * a matching entry in `messages/en.json` under `breadcrumb`, and a segment
+ * with no key (a dynamic id, an unknown route) falls back to the decoded
+ * segment itself.
+ */
+export const SEGMENT_MESSAGE_KEYS: Record<string, string> = {
+ overview: "overview",
+ docs: "docs",
+ chat: "chat",
+ architecture: "architecture",
+ "code-health": "codeHealth",
+ coverage: "coverage",
+ "refactoring-targets": "refactoringTargets",
+ trend: "trend",
+ search: "search",
+ graph: "graph",
+ symbols: "symbols",
+ ownership: "ownership",
+ hotspots: "hotspots",
+ "dead-code": "deadCode",
+ "blast-radius": "blastRadius",
+ decisions: "decisions",
+ commits: "commits",
+ owners: "owners",
+ modules: "modules",
+ wiki: "wiki",
+ health: "health",
+ costs: "costs",
+ risk: "risk",
+ security: "security",
+ settings: "settings",
+ "knowledge-graph": "knowledgeGraph",
+ zoom: "zoom",
+ files: "files",
+};
+
export function getRepoBreadcrumbSegmentLabel(segment: string): string {
if (SEGMENT_LABELS[segment]) return SEGMENT_LABELS[segment];
diff --git a/packages/web/src/components/layout/repo-breadcrumb.tsx b/packages/web/src/components/layout/repo-breadcrumb.tsx
index 7c29cdfdf..314e6eadb 100644
--- a/packages/web/src/components/layout/repo-breadcrumb.tsx
+++ b/packages/web/src/components/layout/repo-breadcrumb.tsx
@@ -2,11 +2,12 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
+import { useTranslations } from "next-intl";
import { MessageSquare } from "lucide-react";
import { Breadcrumb } from "@repowise-dev/ui/shared/breadcrumb";
import type { BreadcrumbSegment } from "@repowise-dev/ui/shared/breadcrumb";
import { DocsModeBadge, type DocsMode } from "@repowise-dev/ui/docs/docs-mode-badge";
-import { getRepoBreadcrumbSegmentLabel } from "./repo-breadcrumb-label";
+import { getRepoBreadcrumbSegmentLabel, SEGMENT_MESSAGE_KEYS } from "./repo-breadcrumb-label";
import { showsRouteBreadcrumb } from "./repo-breadcrumb-route";
export function RepoBreadcrumb({
@@ -17,6 +18,9 @@ export function RepoBreadcrumb({
/** Provenance of the repo's wiki, from the repos API `docs_mode`. */
docsMode?: DocsMode;
}) {
+ const t = useTranslations("nav");
+ const tb = useTranslations("breadcrumb");
+ const ts = useTranslations("shell");
const pathname = usePathname();
const match = pathname.match(/^\/repos\/([^/]+)(.*)/);
if (!match) {
@@ -31,15 +35,18 @@ export function RepoBreadcrumb({
const rest = match[2]?.replace(/^\//, "").split("/").filter(Boolean) ?? [];
const segments: BreadcrumbSegment[] = [
- { label: "Dashboard", href: "/" },
+ { label: t("dashboard"), href: "/" },
{ label: repoName, href: `/repos/${repoId}` },
];
let currentPath = `/repos/${repoId}`;
for (const seg of rest) {
currentPath += `/${seg}`;
+ const messageKey = SEGMENT_MESSAGE_KEYS[seg];
segments.push({
- label: getRepoBreadcrumbSegmentLabel(seg),
+ // A configured segment is translated; anything else (a dynamic id, a
+ // path we do not know) keeps the decoded value it always had.
+ label: messageKey ? tb(messageKey) : getRepoBreadcrumbSegmentLabel(seg),
href: currentPath,
});
}
@@ -63,7 +70,7 @@ export function RepoBreadcrumb({
className="inline-flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent-primary)]"
>
<MessageSquare className="h-3.5 w-3.5" aria-hidden />
- Ask
+ {ts("ask")}
</Link>
)}
</div>
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index d4248a99f..9969188fc 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -3,6 +3,7 @@
import * as React from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
+import { useTranslations } from "next-intl";
import { BrandLogo } from "./brand-logo";
import {
ChevronDown,
@@ -46,6 +47,8 @@ export function Sidebar({
workspace,
reposUnavailable = false,
}: SidebarProps) {
+ const t = useTranslations("nav");
+ const ts = useTranslations("shell");
const isWorkspace = workspace?.is_workspace ?? false;
const pathname = usePathname();
const derivedActiveRepoId = React.useMemo(() => {
@@ -139,7 +142,7 @@ export function Sidebar({
"shrink-0 rounded-md p-2.5 text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)] transition-colors",
!isIconOnly && "ml-auto",
)}
- aria-label={isIconOnly ? "Expand sidebar" : "Collapse sidebar"}
+ aria-label={isIconOnly ? ts("expandSidebar") : ts("collapseSidebar")}
aria-expanded={!isIconOnly}
aria-controls="sidebar-nav"
>
@@ -180,7 +183,7 @@ export function Sidebar({
aria-controls="sidebar-workspace-nav"
className="mb-1 mt-4 flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)]"
>
- <span className="flex-1 truncate text-left">Workspace</span>
+ <span className="flex-1 truncate text-left">{ts("workspace")}</span>
{workspaceNavOpen ? (
<ChevronDown className="h-3.5 w-3.5 shrink-0 opacity-60" />
) : (
@@ -228,7 +231,7 @@ export function Sidebar({
heading plus the brand block above them stacked ~150px
of chrome in front of the first repo row. */}
<p className="mb-2 mt-4 px-2 text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- Repositories
+ {ts("repositories")}
</p>
</>
)}
@@ -260,7 +263,7 @@ export function Sidebar({
<Link
href={indexHref}
className="flex w-full items-center justify-center rounded-md p-2 text-[var(--color-text-tertiary)] opacity-60 transition-colors hover:bg-[var(--color-bg-elevated)]"
- aria-label={`${repo.name} (${isMissing ? "missing" : "needs index"})`}
+ aria-label={`${repo.name} (${isMissing ? ts("statusDirectoryMissing") : ts("statusNeedsIndexing")})`}
>
<Circle className="h-2.5 w-2.5 stroke-current" />
</Link>
@@ -268,7 +271,7 @@ export function Sidebar({
<TooltipContent side="right">
{repo.workspace_alias ?? repo.name}
{" — "}
- {isMissing ? "directory missing" : "needs indexing"}
+ {isMissing ? ts("statusDirectoryMissing") : ts("statusNeedsIndexing")}
</TooltipContent>
</Tooltip>
);
@@ -280,10 +283,10 @@ export function Sidebar({
className={cn(ROW, ROW_L1, "text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)]")}
title={
isMissing
- ? "Directory missing — open Workspace to remove or fix"
+ ? ts("titleDirectoryMissing")
: isSynthetic
- ? "Not indexed yet. Open Workspace to index."
- : "Not indexed yet. Open the repo to index."
+ ? ts("titleNotIndexedSynthetic")
+ : ts("titleNotIndexedRepo")
}
>
<RowGlyph>
@@ -293,7 +296,7 @@ export function Sidebar({
{repo.workspace_alias ?? repo.name}
</span>
<span className="shrink-0 rounded-full bg-[var(--color-bg-elevated)] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--color-text-tertiary)]">
- {isMissing ? "missing" : "index"}
+ {isMissing ? ts("pillMissing") : ts("pillIndex")}
</span>
</Link>
);
@@ -389,7 +392,7 @@ export function Sidebar({
<React.Fragment key={group.label ?? gi}>
{group.label ? (
<p className="px-2 pt-2 pb-0.5 text-[10px] font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">
- {group.label}
+ {group.labelKey ? t(group.labelKey) : group.label}
</p>
) : gi > 0 ? (
<div className="pt-1.5" />
@@ -429,11 +432,10 @@ export function Sidebar({
// unactionable.
<div className="space-y-1 px-2">
<p className="text-xs font-medium text-[var(--color-text-primary)]">
- Can&apos;t reach the API
+ {ts("cantReachApiTitle")}
</p>
<p className="text-xs text-[var(--color-text-secondary)]">
- Your repositories could not be loaded. Check that the
- Repowise server is running, then reload.
+ {ts("cantReachApiBody")}
</p>
</div>
) : (
@@ -452,18 +454,20 @@ export function Sidebar({
at 56px the whole footer used to disappear, so theme, feedback, and
version were unreachable without expanding first. */}
{isIconOnly ? (
- <div className="flex flex-col items-center border-t border-[var(--color-border-default)] py-1.5">
+ <div className="flex flex-col items-center gap-1 border-t border-[var(--color-border-default)] py-1.5">
<ThemeToggle compact />
</div>
) : (
<div className="flex flex-col gap-2 border-t border-[var(--color-border-default)] px-3 py-2">
<FeedbackButton />
- {/* Version and theme share a row. The toggle was a full-width
- bordered track stacked on its own line, which made a
+ {/* Version, language and theme share a row. The toggle was a
+ full-width bordered track stacked on its own line, which made a
once-per-session control the tallest thing in the footer. */}
<div className="flex items-center justify-between gap-2">
<VersionFooter />
- <ThemeToggle compact />
+ <div className="flex items-center gap-1">
+ <ThemeToggle compact />
+ </div>
</div>
</div>
)}
@@ -472,6 +476,7 @@ export function Sidebar({
}
function SidebarSearchButton({ iconOnly }: { iconOnly: boolean }) {
+ const ts = useTranslations("shell");
const openPalette = () =>
window.dispatchEvent(new CustomEvent("repowise:open-command-palette"));
@@ -481,13 +486,13 @@ function SidebarSearchButton({ iconOnly }: { iconOnly: boolean }) {
<TooltipTrigger asChild>
<button
onClick={openPalette}
- aria-label="Search"
+ aria-label={ts("openSearch")}
className="flex w-full items-center justify-center rounded-lg p-2.5 text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]"
>
<Search className="h-[18px] w-[18px] shrink-0" />
</button>
</TooltipTrigger>
- <TooltipContent side="right">Search</TooltipContent>
+ <TooltipContent side="right">{ts("openSearch")}</TooltipContent>
</Tooltip>
);
}
@@ -497,7 +502,7 @@ function SidebarSearchButton({ iconOnly }: { iconOnly: boolean }) {
<RowGlyph>
<Search className="h-4 w-4" />
</RowGlyph>
- <span className="flex-1 truncate text-left">Search</span>
+ <span className="flex-1 truncate text-left">{ts("openSearch")}</span>
<kbd className="rounded border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] px-1.5 py-0.5 text-[10px] text-[var(--color-text-tertiary)]">
⌘K
</kbd>
@@ -547,6 +552,8 @@ function SidebarNavItem({
size?: "default" | "sm";
iconOnly?: boolean;
}) {
+ const t = useTranslations("nav");
+ const label = t(item.labelKey);
const Icon = item.icon;
if (iconOnly) {
@@ -555,7 +562,7 @@ function SidebarNavItem({
<TooltipTrigger asChild>
<Link
href={item.href}
- aria-label={item.label}
+ aria-label={label}
className={cn(
"flex items-center justify-center rounded-lg p-2.5 transition-colors",
isActive
@@ -566,7 +573,7 @@ function SidebarNavItem({
<Icon className="h-[18px] w-[18px] shrink-0" />
</Link>
</TooltipTrigger>
- <TooltipContent side="right">{item.label}</TooltipContent>
+ <TooltipContent side="right">{label}</TooltipContent>
</Tooltip>
);
}
@@ -574,7 +581,7 @@ function SidebarNavItem({
return (
<Link
href={item.href}
- title={item.label}
+ title={label}
className={cn(ROW, size === "sm" ? ROW_L2 : ROW_L1, isActive ? ROW_ACTIVE : ROW_IDLE)}
>
<RowGlyph>
@@ -585,7 +592,7 @@ function SidebarNavItem({
)}
/>
</RowGlyph>
- <span className="truncate">{item.label}</span>
+ <span className="truncate">{label}</span>
</Link>
);
}
diff --git a/packages/web/src/components/layout/upgrade-banner.tsx b/packages/web/src/components/layout/upgrade-banner.tsx
index 67566bae1..51f8b4745 100644
--- a/packages/web/src/components/layout/upgrade-banner.tsx
+++ b/packages/web/src/components/layout/upgrade-banner.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import { ArrowUpCircle, X } from "lucide-react";
+import { useTranslations } from "next-intl";
import { useMetaVersion } from "@/lib/hooks/use-meta-version";
import { WhatsNewModal } from "./whats-new-modal";
@@ -13,6 +14,8 @@ const STORAGE_PREFIX = "repowise:upgrade-banner-dismissed:v";
* check fails - it simply renders nothing.
*/
export function UpgradeBanner() {
+ const t = useTranslations("shell");
+ const tc = useTranslations("common");
const { meta } = useMetaVersion();
const [dismissed, setDismissed] = useState(true);
const [showWhatsNew, setShowWhatsNew] = useState(false);
@@ -51,28 +54,40 @@ export function UpgradeBanner() {
aria-hidden="true"
/>
<p className="flex-1 text-[var(--color-text-primary)]">
- repowise <span className="font-medium">v{latest}</span> is available
+ {t.rich("updateBanner", {
+ latest,
+ b: (chunks) => <span className="font-medium">{chunks}</span>,
+ })}
{meta?.server_version ? (
- <span className="text-[var(--color-text-tertiary)]"> (you have v{meta.server_version})</span>
+ <span className="text-[var(--color-text-tertiary)]">
+ {t("updateBannerCurrent", { current: meta.server_version })}
+ </span>
) : null}
- .{" "}
{meta?.upgrade_command && (
- <code className="rounded bg-[var(--color-bg-elevated)] px-1.5 py-0.5 text-xs">
- {meta.upgrade_command}
- </code>
+ <>
+ {" "}
+ {t.rich("updateBannerCommand", {
+ command: meta.upgrade_command,
+ code: (chunks) => (
+ <code className="rounded bg-[var(--color-bg-elevated)] px-1.5 py-0.5 text-xs">
+ {chunks}
+ </code>
+ ),
+ })}
+ </>
)}{" "}
<button
type="button"
onClick={() => setShowWhatsNew(true)}
className="text-[var(--color-accent-primary)] underline underline-offset-2 hover:opacity-80"
>
- What&apos;s new
+ {t("whatsNew")}
</button>
</p>
<button
type="button"
onClick={dismiss}
- aria-label="Dismiss"
+ aria-label={tc("dismiss")}
className="rounded p-1 text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)]"
>
<X className="h-4 w-4" />
diff --git a/packages/web/src/components/layout/version-footer.tsx b/packages/web/src/components/layout/version-footer.tsx
index a47cbc2ba..0655cb2f9 100644
--- a/packages/web/src/components/layout/version-footer.tsx
+++ b/packages/web/src/components/layout/version-footer.tsx
@@ -1,6 +1,7 @@
"use client";
import { useState } from "react";
+import { useTranslations } from "next-intl";
import { useMetaVersion } from "@/lib/hooks/use-meta-version";
import { WhatsNewModal } from "./whats-new-modal";
@@ -10,6 +11,7 @@ import { WhatsNewModal } from "./whats-new-modal";
* "update available" dot that opens the what's-new view.
*/
export function VersionFooter() {
+ const t = useTranslations("shell");
const { meta } = useMetaVersion();
const [showWhatsNew, setShowWhatsNew] = useState(false);
@@ -27,7 +29,7 @@ export function VersionFooter() {
{updateAvailable && (
<span
className="h-1.5 w-1.5 rounded-full bg-[var(--color-accent-primary)]"
- aria-label="Update available"
+ aria-label={t("updateAvailable")}
/>
)}
</button>
diff --git a/packages/web/src/components/layout/whats-new-modal.tsx b/packages/web/src/components/layout/whats-new-modal.tsx
index 7dca6c387..2422d2376 100644
--- a/packages/web/src/components/layout/whats-new-modal.tsx
+++ b/packages/web/src/components/layout/whats-new-modal.tsx
@@ -7,6 +7,7 @@ import {
DialogTitle,
} from "@repowise-dev/ui/ui/dialog";
import { useChangelog } from "@/lib/hooks/use-meta-version";
+import { useTranslations } from "next-intl";
export interface WhatsNewModalProps {
open: boolean;
@@ -15,6 +16,7 @@ export interface WhatsNewModalProps {
/** Renders repowise's recent release notes from the bundled changelog. */
export function WhatsNewModal({ open, onOpenChange }: WhatsNewModalProps) {
+ const t = useTranslations("shell");
// Only fetch once the modal is opened.
const { entries, error, isLoading } = useChangelog(open);
@@ -22,23 +24,28 @@ export function WhatsNewModal({ open, onOpenChange }: WhatsNewModalProps) {
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-h-[80vh] overflow-y-auto sm:max-w-2xl">
<DialogHeader>
- <DialogTitle>What&apos;s new in repowise</DialogTitle>
+ <DialogTitle>{t("whatsNewModal.title")}</DialogTitle>
</DialogHeader>
{isLoading && (
- <p className="text-sm text-[var(--color-text-tertiary)]">Loading release notes...</p>
+ <p className="text-sm text-[var(--color-text-tertiary)]">
+ {t("whatsNewModal.loading")}
+ </p>
)}
{error && (
<p className="text-sm text-[var(--color-text-tertiary)]">
- Release notes unavailable.{" "}
- <a
- href="https://github.com/repowise-dev/repowise/releases"
- target="_blank"
- rel="noreferrer"
- className="text-[var(--color-accent-primary)] underline"
- >
- View on GitHub
- </a>
+ {t.rich("whatsNewModal.unavailable", {
+ link: (chunks) => (
+ <a
+ href="https://github.com/repowise-dev/repowise/releases"
+ target="_blank"
+ rel="noreferrer"
+ className="text-[var(--color-accent-primary)] underline"
+ >
+ {chunks}
+ </a>
+ ),
+ })}
</p>
)}
diff --git a/packages/web/src/components/overview/ask-anything-row.tsx b/packages/web/src/components/overview/ask-anything-row.tsx
index 31ff0fbf4..97dc8c4ea 100644
--- a/packages/web/src/components/overview/ask-anything-row.tsx
+++ b/packages/web/src/components/overview/ask-anything-row.tsx
@@ -3,16 +3,18 @@
import { useState } from "react";
import { useRouter } from "next/navigation";
import { ArrowRight, Sparkles } from "lucide-react";
+import { useTranslations } from "next-intl";
-const PLACEHOLDER = "How does the incremental pipeline decide what to re-index?";
+/** Copy keys, resolved inside the component so the row follows the locale. */
+const PLACEHOLDER_KEY = "ask.placeholder";
/** Openers that show what this is good at: tracing behaviour, locating a
* concern, and asking for rationale. Concrete beats "Ask me anything" — most
* people stall at a blank box because they cannot tell what it can answer. */
-const SUGGESTIONS = [
- "How does authentication work?",
- "Where is the retry logic?",
- "Why is this module structured this way?",
+const SUGGESTION_KEYS = [
+ "ask.suggestion1",
+ "ask.suggestion2",
+ "ask.suggestion3",
];
/**
@@ -28,6 +30,8 @@ const SUGGESTIONS = [
* something, and it needs to look different enough to be found.
*/
export function AskAnythingRow({ repoId }: { repoId: string }) {
+ const t = useTranslations("overview");
+ const suggestions = SUGGESTION_KEYS.map((key) => t(key));
const router = useRouter();
const [question, setQuestion] = useState("");
@@ -61,13 +65,13 @@ export function AskAnythingRow({ repoId }: { repoId: string }) {
className="h-3.5 w-3.5 shrink-0 text-[var(--color-model)] transition-transform group-focus-within:scale-110"
/>
<label htmlFor="overview-ask" className="sr-only">
- Ask a question about this codebase
+ {t("ask.label")}
</label>
<input
id="overview-ask"
value={question}
onChange={(e) => setQuestion(e.target.value)}
- placeholder={PLACEHOLDER}
+ placeholder={t(PLACEHOLDER_KEY)}
className="min-w-0 flex-1 bg-transparent text-xs text-[var(--color-text-primary)] placeholder:text-[var(--color-text-tertiary)] focus:outline-none"
/>
<button
@@ -75,13 +79,13 @@ export function AskAnythingRow({ repoId }: { repoId: string }) {
disabled={!question.trim()}
className="inline-flex shrink-0 items-center gap-1 rounded-md bg-[var(--color-model)] px-2.5 py-1 text-xs font-medium text-[var(--color-text-on-model)] transition hover:bg-[var(--color-model-hover)] disabled:opacity-40"
>
- Ask
+ {t("ask.submit")}
<ArrowRight className="h-3 w-3" />
</button>
</form>
<div className="flex flex-wrap gap-1.5">
- {SUGGESTIONS.map((s) => (
+ {suggestions.map((s) => (
<button
key={s}
type="button"
diff --git a/packages/web/src/components/repos/add-repo-dialog.tsx b/packages/web/src/components/repos/add-repo-dialog.tsx
index fa7f25002..3e7ed6b1b 100644
--- a/packages/web/src/components/repos/add-repo-dialog.tsx
+++ b/packages/web/src/components/repos/add-repo-dialog.tsx
@@ -12,6 +12,7 @@ import {
AddRepoWizard,
type AddRepoWizardAdapter,
} from "@repowise-dev/ui/onboarding/add-repo-wizard";
+import { useTranslations } from "next-intl";
interface Props {
/** Render as a sidebar button (icon + label) vs standalone button */
@@ -31,6 +32,7 @@ export function AddRepoDialog({
}: Props) {
const { mutate } = useSWRConfig();
const router = useRouter();
+ const t = useTranslations("repos");
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
const open = controlledOpen ?? uncontrolledOpen;
const setOpen = onOpenChange ?? setUncontrolledOpen;
@@ -59,12 +61,14 @@ export function AddRepoDialog({
},
settingsHref: "/settings",
onDone: (repoId, jobId) => {
- toast.success(jobId ? "Repository added, indexing started" : "Repository added");
+ toast.success(
+ jobId ? t("addDialog.toastStarted") : t("addDialog.toastAdded"),
+ );
router.push(`/repos/${repoId}/overview`);
router.refresh();
},
}),
- [mutate, router],
+ [mutate, router, t],
);
return (
@@ -76,12 +80,12 @@ export function AddRepoDialog({
className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-secondary)] transition-colors"
>
<Plus className="h-3.5 w-3.5 shrink-0" />
- <span>Add Repository</span>
+ <span>{t("addDialog.trigger")}</span>
</button>
) : (
<Button variant="default" size="sm" onClick={() => setOpen(true)}>
<Plus className="h-4 w-4 mr-1" />
- Add Repository
+ {t("addDialog.trigger")}
</Button>
)}
diff --git a/packages/web/src/components/repos/coordinator-health-panel.tsx b/packages/web/src/components/repos/coordinator-health-panel.tsx
index 8a1c42314..295371b12 100644
--- a/packages/web/src/components/repos/coordinator-health-panel.tsx
+++ b/packages/web/src/components/repos/coordinator-health-panel.tsx
@@ -5,6 +5,7 @@ import { RefreshCw } from "lucide-react";
import { Button } from "@repowise-dev/ui/ui/button";
import { getCoordinatorHealth, type CoordinatorHealth } from "@/lib/api/health";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface Props {
repoId: string;
@@ -34,6 +35,7 @@ function StatRow({ label, value, help }: { label: string; value: string; help?:
}
export function CoordinatorHealthPanel({ repoId, initial }: Props) {
+ const t = useTranslations("repos");
const [data, setData] = useState<CoordinatorHealth | null>(initial);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -59,7 +61,9 @@ export function CoordinatorHealthPanel({ repoId, initial }: Props) {
{data ? (
<>
<div className="flex items-center justify-between mb-1">
- <span className="text-xs text-[var(--color-text-secondary)]">Status</span>
+ <span className="text-xs text-[var(--color-text-secondary)]">
+ {t("coordinator.status")}
+ </span>
<span
className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_BADGE[data.status]}`}
>
@@ -67,33 +71,42 @@ export function CoordinatorHealthPanel({ repoId, initial }: Props) {
</span>
</div>
<StatRow
- label="Wiki Pages"
- value={`${fmt(data.sql_pages)} SQL / ${fmt(data.vector_page_count)} vectors`}
- help="Generated wiki pages in SQL vs the matching page vectors in the vector store."
+ label={t("coordinator.wikiPages")}
+ value={t("coordinator.sqlVsVectors", {
+ sql: fmt(data.sql_pages),
+ vectors: fmt(data.vector_page_count),
+ })}
+ help={t("coordinator.wikiPagesHelp")}
/>
<StatRow
- label="Page Drift"
+ label={t("coordinator.pageDrift")}
value={fmtPct(data.page_drift_pct)}
- help="How far the wiki-page count disagrees with the page-vector count. 0% means every page is embedded; high drift usually means an interrupted index — run a sync to reconcile."
+ help={t("coordinator.pageDriftHelp")}
/>
<StatRow
- label="Decisions"
- value={`${fmt(data.sql_decisions)} SQL / ${fmt(data.vector_decision_count)} vectors`}
- help="Decision records in SQL vs the matching decision vectors. Decision vectors are counted separately from page vectors."
+ label={t("coordinator.decisions")}
+ value={t("coordinator.sqlVsVectors", {
+ sql: fmt(data.sql_decisions),
+ vectors: fmt(data.vector_decision_count),
+ })}
+ help={t("coordinator.decisionsHelp")}
/>
<StatRow
- label="Decision Drift"
+ label={t("coordinator.decisionDrift")}
value={fmtPct(data.decision_drift_pct)}
- help="How far the decision-record count disagrees with the decision-vector count."
+ help={t("coordinator.decisionDriftHelp")}
+ />
+ <StatRow
+ label={t("coordinator.graphNodes")}
+ value={fmt(data.graph_nodes)}
/>
- <StatRow label="Graph Nodes" value={fmt(data.graph_nodes)} />
{data.detail && (
<p className="text-xs text-[var(--color-text-secondary)] pt-1.5">{data.detail}</p>
)}
</>
) : (
<p className="text-xs text-[var(--color-text-secondary)]">
- {error ?? "No data — click Refresh to load."}
+ {error ?? t("coordinator.noData")}
</p>
)}
{error && (
@@ -107,7 +120,7 @@ export function CoordinatorHealthPanel({ repoId, initial }: Props) {
disabled={loading}
>
<RefreshCw className={`h-3.5 w-3.5 mr-1.5 ${loading ? "motion-safe:animate-spin" : ""}`} />
- {loading ? "Checking…" : "Refresh"}
+ {loading ? t("coordinator.checking") : t("coordinator.refresh")}
</Button>
</div>
);
diff --git a/packages/web/src/components/repos/delete-repo-button.tsx b/packages/web/src/components/repos/delete-repo-button.tsx
index 79f483c59..b923b762f 100644
--- a/packages/web/src/components/repos/delete-repo-button.tsx
+++ b/packages/web/src/components/repos/delete-repo-button.tsx
@@ -14,6 +14,7 @@ import {
DialogFooter,
} from "@repowise-dev/ui/ui/dialog";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface DeleteRepoButtonProps {
repoId: string;
@@ -31,12 +32,19 @@ export function DeleteRepoButton({
const [open, setOpen] = useState(false);
const [deleting, setDeleting] = useState(false);
const router = useRouter();
+ const t = useTranslations("repos");
+ const tc = useTranslations("common");
async function handleDelete() {
setDeleting(true);
try {
const result = await deleteRepo(repoId);
- toast.success(`Deleted ${repoName} — ${result.deleted_pages} pages removed`);
+ toast.success(
+ t("delete.toastDeleted", {
+ name: repoName,
+ pages: result.deleted_pages,
+ }),
+ );
setOpen(false);
if (redirectTo) {
router.push(redirectTo);
@@ -44,7 +52,7 @@ export function DeleteRepoButton({
router.refresh();
}
} catch (err) {
- toast.error(`Failed to delete: ${toFriendlyMessage(err)}`);
+ toast.error(t("delete.toastFailed", { error: toFriendlyMessage(err) }));
} finally {
setDeleting(false);
}
@@ -59,7 +67,7 @@ export function DeleteRepoButton({
onClick={() => setOpen(true)}
>
<Trash2 className="h-3.5 w-3.5 mr-1.5" />
- Delete Repository
+ {t("delete.button")}
</Button>
) : (
<button
@@ -69,8 +77,8 @@ export function DeleteRepoButton({
setOpen(true);
}}
className="p-1 text-[var(--color-text-tertiary)] hover:text-[var(--color-error)] transition-all md:opacity-0 md:group-hover:opacity-100 md:focus-visible:opacity-100"
- title="Delete repository"
- aria-label={`Delete ${repoName}`}
+ title={t("delete.title")}
+ aria-label={t("delete.aria", { name: repoName })}
>
<Trash2 className="h-3.5 w-3.5" />
</button>
@@ -81,20 +89,25 @@ export function DeleteRepoButton({
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<AlertTriangle className="h-4 w-4 text-[var(--color-stale)]" />
- Delete Repository
+ {t("delete.button")}
</DialogTitle>
</DialogHeader>
<p className="text-sm text-[var(--color-text-secondary)]">
- This will permanently delete{" "}
- <span className="font-medium text-[var(--color-text-primary)]">{repoName}</span>{" "}
- and all its generated pages, symbols, and history.
+ {t.rich("delete.confirm", {
+ name: repoName,
+ repo: (chunks) => (
+ <span className="font-medium text-[var(--color-text-primary)]">
+ {chunks}
+ </span>
+ ),
+ })}
</p>
<DialogFooter>
<Button variant="ghost" onClick={() => setOpen(false)}>
- Cancel
+ {tc("cancel")}
</Button>
<Button variant="destructive" onClick={handleDelete} disabled={deleting}>
- {deleting ? "Deleting..." : "Delete Repository"}
+ {deleting ? t("delete.deleting") : t("delete.button")}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/packages/web/src/components/repos/empty-repos-state.tsx b/packages/web/src/components/repos/empty-repos-state.tsx
index d6887e152..bab64b9b7 100644
--- a/packages/web/src/components/repos/empty-repos-state.tsx
+++ b/packages/web/src/components/repos/empty-repos-state.tsx
@@ -4,33 +4,38 @@ import { useState } from "react";
import { FolderGit2 } from "lucide-react";
import { EmptyState } from "@repowise-dev/ui/shared/empty-state";
import { AddRepoDialog } from "@/components/repos/add-repo-dialog";
+import { useTranslations } from "next-intl";
/**
* First-run state for the dashboard's repository list: a one-click path into
* the add-repository dialog, with the CLI and docs as secondary routes.
*/
export function EmptyReposState() {
+ const t = useTranslations("repos");
const [open, setOpen] = useState(false);
return (
<div className="space-y-2">
<EmptyState
- title="No repositories yet"
- description="Point repowise at a local git repository to build its index, docs, and health signals."
+ title={t("empty.title")}
+ description={t("empty.description")}
icon={<FolderGit2 className="h-8 w-8" />}
- action={{ label: "Add repository", onClick: () => setOpen(true) }}
+ action={{ label: t("empty.action"), onClick: () => setOpen(true) }}
/>
<p className="text-center text-xs text-[var(--color-text-tertiary)]">
- Prefer the terminal? Run <code className="font-mono">repowise init</code> in a repo, or see the{" "}
- <a
- href="https://github.com/repowise-dev/repowise#quick-start"
- target="_blank"
- rel="noreferrer"
- className="text-[var(--color-accent-primary)] hover:underline"
- >
- setup guide
- </a>
- .
+ {t.rich("empty.terminalHint", {
+ code: (chunks) => <code className="font-mono">{chunks}</code>,
+ link: (chunks) => (
+ <a
+ href="https://github.com/repowise-dev/repowise#quick-start"
+ target="_blank"
+ rel="noreferrer"
+ className="text-[var(--color-accent-primary)] hover:underline"
+ >
+ {chunks}
+ </a>
+ ),
+ })}
</p>
<AddRepoDialog showTrigger={false} open={open} onOpenChange={setOpen} />
</div>
diff --git a/packages/web/src/components/repos/first-index-experience.tsx b/packages/web/src/components/repos/first-index-experience.tsx
index 4e76de0c4..f112382ea 100644
--- a/packages/web/src/components/repos/first-index-experience.tsx
+++ b/packages/web/src/components/repos/first-index-experience.tsx
@@ -12,6 +12,7 @@ import { startIndexJob } from "@/lib/api/repos";
import { listJobs, getJob } from "@/lib/api/jobs";
import { getOverviewSummary } from "@/lib/api/overview";
import { GenerationProgressWrapper } from "@/components/jobs/generation-progress-wrapper";
+import { useTranslations } from "next-intl";
interface Props {
repoId: string;
@@ -25,6 +26,7 @@ interface Props {
* Hydrates from any in-flight job so a page refresh mid-index rejoins it.
*/
export function FirstIndexExperience({ repoId, repoName }: Props) {
+ const t = useTranslations("repos");
const router = useRouter();
const [jobId, setJobId] = useState<string | null>(null);
const [starting, setStarting] = useState(false);
@@ -76,11 +78,11 @@ export function FirstIndexExperience({ repoId, repoName }: Props) {
// fall through
}
}
- toast.error("Couldn't start indexing", { description: msg });
+ toast.error(t("firstIndex.startFailed"), { description: msg });
} finally {
setStarting(false);
}
- }, [repoId]);
+ }, [repoId, t]);
const handleJobDone = useCallback(async () => {
if (!jobId) return;
@@ -118,7 +120,7 @@ export function FirstIndexExperience({ repoId, repoName }: Props) {
{startHere.length > 0 && (
<FirstFiveFiles
files={startHere}
- title="Start here"
+ title={t("firstIndex.startHere")}
// Targets can be symbol pages ("calc.py::add"); link to the file.
hrefFor={(f) => fileEntityPath(`/repos/${repoId}`, f.file_path.split("::")[0]!)}
/>
@@ -144,10 +146,10 @@ export function FirstIndexExperience({ repoId, repoName }: Props) {
return (
<EmptyState
icon={<Sparkles className="h-8 w-8" />}
- title="This repo hasn't been indexed yet"
- description="One click builds the code index, health signals, and documentation. You can watch it happen live."
+ title={t("firstIndex.title")}
+ description={t("firstIndex.description")}
action={{
- label: starting ? "Starting…" : "Index this repo",
+ label: starting ? t("firstIndex.starting") : t("firstIndex.action"),
onClick: () => {
if (!starting) void startIndex();
},
diff --git a/packages/web/src/components/repos/operations-panel.tsx b/packages/web/src/components/repos/operations-panel.tsx
index d56b86d18..5440e6b7e 100644
--- a/packages/web/src/components/repos/operations-panel.tsx
+++ b/packages/web/src/components/repos/operations-panel.tsx
@@ -15,6 +15,7 @@ import {
} from "@repowise-dev/ui/ui/dialog";
import { GenerationProgressWrapper as GenerationProgress } from "@/components/jobs/generation-progress-wrapper";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface Props {
repoId: string;
@@ -22,6 +23,8 @@ interface Props {
}
export function OperationsPanel({ repoId, repoName }: Props) {
+ const t = useTranslations("repos");
+ const tc = useTranslations("common");
const [activeJobId, setActiveJobId] = useState<string | null>(null);
const [confirmResync, setConfirmResync] = useState(false);
const [loading, setLoading] = useState<"sync" | "resync" | null>(null);
@@ -31,9 +34,9 @@ export function OperationsPanel({ repoId, repoName }: Props) {
try {
const job = await syncRepo(repoId);
setActiveJobId(job.id);
- toast.info(`Sync started — ${repoName}`);
+ toast.info(t("ops.syncStarted", { name: repoName }));
} catch (e) {
- toast.error("Sync failed", {
+ toast.error(t("ops.syncFailed"), {
description: toFriendlyMessage(e),
});
} finally {
@@ -47,9 +50,9 @@ export function OperationsPanel({ repoId, repoName }: Props) {
try {
const job = await fullResyncRepo(repoId);
setActiveJobId(job.id);
- toast.info(`Full resync started — ${repoName}`);
+ toast.info(t("ops.resyncStarted", { name: repoName }));
} catch (e) {
- toast.error("Resync failed", {
+ toast.error(t("ops.resyncFailed"), {
description: toFriendlyMessage(e),
});
} finally {
@@ -65,7 +68,7 @@ export function OperationsPanel({ repoId, repoName }: Props) {
<>
<Card>
<CardHeader className="pb-2">
- <CardTitle className="text-sm">Operations</CardTitle>
+ <CardTitle className="text-sm">{t("ops.title")}</CardTitle>
</CardHeader>
<CardContent id="operations-panel-content" className="space-y-4">
@@ -89,7 +92,7 @@ export function OperationsPanel({ repoId, repoName }: Props) {
className="flex-1"
>
<Zap className="h-3.5 w-3.5 mr-1.5" />
- {loading === "sync" ? "Starting…" : "Sync"}
+ {loading === "sync" ? t("ops.starting") : t("ops.sync")}
</Button>
<Button
variant="outline"
@@ -99,7 +102,7 @@ export function OperationsPanel({ repoId, repoName }: Props) {
className="flex-1"
>
<RefreshCw className="h-3.5 w-3.5 mr-1.5" />
- {loading === "resync" ? "Starting…" : "Full Resync"}
+ {loading === "resync" ? t("ops.starting") : t("ops.resync")}
</Button>
<Button
variant="ghost"
@@ -108,7 +111,7 @@ export function OperationsPanel({ repoId, repoName }: Props) {
>
<a href={`/api/repos/${repoId}/export`} download>
<Download className="h-3.5 w-3.5 mr-1.5" />
- Export
+ {t("ops.export")}
</a>
</Button>
</div>
@@ -122,20 +125,25 @@ export function OperationsPanel({ repoId, repoName }: Props) {
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<AlertTriangle className="h-4 w-4 text-[var(--color-stale)]" />
- Full Resync
+ {t("ops.resync")}
</DialogTitle>
</DialogHeader>
<p className="text-sm text-[var(--color-text-secondary)]">
- This regenerates every page for{" "}
- <span className="font-medium text-[var(--color-text-primary)]">{repoName}</span>{" "}
- from scratch. All existing pages will be overwritten.
+ {t.rich("ops.resyncConfirm", {
+ name: repoName,
+ repo: (chunks) => (
+ <span className="font-medium text-[var(--color-text-primary)]">
+ {chunks}
+ </span>
+ ),
+ })}
</p>
<DialogFooter>
<Button variant="ghost" onClick={() => setConfirmResync(false)}>
- Cancel
+ {tc("cancel")}
</Button>
<Button variant="destructive" onClick={handleResync}>
- Resync Everything
+ {t("ops.resyncConfirmAction")}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/packages/web/src/components/repos/repo-settings-form-wrapper.tsx b/packages/web/src/components/repos/repo-settings-form-wrapper.tsx
index 746049bae..3044e7cd8 100644
--- a/packages/web/src/components/repos/repo-settings-form-wrapper.tsx
+++ b/packages/web/src/components/repos/repo-settings-form-wrapper.tsx
@@ -9,12 +9,14 @@ import type { RepoResponse } from "@/lib/api/types";
import { DEFAULT_WIKI_STYLE } from "@repowise-dev/types";
import type { RepoSettingsValue, WikiStyle } from "@repowise-dev/types/settings";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
interface Props {
repo: RepoResponse;
}
export function RepoSettingsFormWrapper({ repo }: Props) {
+ const t = useTranslations("repos");
const currentStyle =
(repo.settings?.wiki_style as WikiStyle | undefined) ?? DEFAULT_WIKI_STYLE;
@@ -44,13 +46,13 @@ export function RepoSettingsFormWrapper({ repo }: Props) {
wiki_style: nextStyle,
},
});
- toast.success("Repository settings saved");
+ toast.success(t("settings.toastSaved"));
if (nextStyle !== currentStyle) {
setPendingStyle(nextStyle);
setRegenOpen(true);
}
} catch (err) {
- toast.error(toFriendlyMessage(err, "Failed to save settings"));
+ toast.error(toFriendlyMessage(err, t("settings.saveFailed")));
throw err;
}
}
@@ -59,11 +61,11 @@ export function RepoSettingsFormWrapper({ repo }: Props) {
setRegenLoading(true);
try {
await fullResyncRepo(repo.id);
- toast.info("Wiki regeneration queued");
+ toast.info(t("settings.regenQueued"));
setRegenOpen(false);
} catch (err) {
toast.error(
- toFriendlyMessage(err, "Failed to queue regeneration"),
+ toFriendlyMessage(err, t("settings.regenFailed")),
);
} finally {
setRegenLoading(false);
@@ -81,10 +83,12 @@ export function RepoSettingsFormWrapper({ repo }: Props) {
<ConfirmDialog
open={regenOpen}
onOpenChange={setRegenOpen}
- title="Regenerate the wiki now?"
- description={`The documentation style was changed to "${pendingStyle ?? ""}". Regenerate the whole wiki now to apply it? This runs LLM generation (a cost). You can also do it later from Sync.`}
- confirmLabel="Regenerate now"
- cancelLabel="Later"
+ title={t("settings.regenTitle")}
+ description={t("settings.regenDescription", {
+ style: pendingStyle ?? "",
+ })}
+ confirmLabel={t("settings.regenConfirm")}
+ cancelLabel={t("settings.regenCancel")}
loading={regenLoading}
onConfirm={() => void handleRegenerate()}
/>
diff --git a/packages/web/src/components/risk/dead-code-tab.tsx b/packages/web/src/components/risk/dead-code-tab.tsx
index 628b2a710..47f77f689 100644
--- a/packages/web/src/components/risk/dead-code-tab.tsx
+++ b/packages/web/src/components/risk/dead-code-tab.tsx
@@ -18,6 +18,7 @@ import {
patchDeadCodeFinding,
} from "@/lib/api/dead-code";
import { getJob } from "@/lib/api/jobs";
+import { useTranslations } from "next-intl";
const POLL_INTERVAL_MS = 3_000;
/** Give up watching after this long; the job may still be running server-side. */
@@ -28,7 +29,7 @@ const POLL_TIMEOUT_MS = 15 * 60_000;
* only needs the terminal state to know when to refetch, and a plain promise
* keeps the shared view free of any streaming dependency.
*/
-async function waitForJob(jobId: string): Promise<void> {
+async function waitForJob(jobId: string, timeoutMessage: string): Promise<void> {
const deadline = Date.now() + POLL_TIMEOUT_MS;
for (;;) {
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
@@ -38,12 +39,13 @@ async function waitForJob(jobId: string): Promise<void> {
throw new Error(job.error_message || `Analysis ${job.status}`);
}
if (Date.now() > deadline) {
- throw new Error("Analysis is taking longer than expected. Reload to see the results.");
+ throw new Error(timeoutMessage);
}
}
}
export function DeadCodeTab({ repoId }: { repoId: string }) {
+ const t = useTranslations("risk");
const router = useRouter();
const prefix = `/repos/${repoId}`;
@@ -53,7 +55,7 @@ export function DeadCodeTab({ repoId }: { repoId: string }) {
getSummary: () => getDeadCodeSummary(repoId),
listFindings: (opts) => listDeadCode(repoId, opts),
analyze: () => analyzeDeadCode(repoId),
- waitForAnalysis: waitForJob,
+ waitForAnalysis: (jobId) => waitForJob(jobId, t("analysisTimeout")),
patchFinding: (findingId, patch) => patchDeadCodeFinding(findingId, patch),
fileHref: (path) => fileEntityPath(prefix, path),
graphHref: (path) =>
diff --git a/packages/web/src/components/risk/security-tab.tsx b/packages/web/src/components/risk/security-tab.tsx
index 5da48b480..6e3266a15 100644
--- a/packages/web/src/components/risk/security-tab.tsx
+++ b/packages/web/src/components/risk/security-tab.tsx
@@ -16,8 +16,10 @@ import { syncRepo } from "@/lib/api/repos";
import { useFileCardHost } from "@/components/shared/file-card-host";
import type { FileCardData } from "@repowise-dev/ui/shared/file-card";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
export function SecurityTab({ repoId }: { repoId: string }) {
+ const t = useTranslations("risk");
const { data: findings, isLoading, error } = useSWR<SecurityFinding[]>(
`security:${repoId}`,
() => listSecurityFindings(repoId, { limit: 500 }),
@@ -30,9 +32,9 @@ export function SecurityTab({ repoId }: { repoId: string }) {
setRescanning(true);
try {
await syncRepo(repoId);
- toast.success("Sync started — findings refresh when it completes");
+ toast.success(t("syncStarted"));
} catch (err) {
- toast.error(toFriendlyMessage(err, "Couldn't start a sync"));
+ toast.error(toFriendlyMessage(err, t("syncFailed")));
} finally {
setRescanning(false);
}
@@ -58,8 +60,7 @@ export function SecurityTab({ repoId }: { repoId: string }) {
<div className="space-y-6">
<div className="flex flex-wrap items-center gap-2">
<p className="text-sm text-[var(--color-text-secondary)] mr-auto">
- Secrets, dangerous patterns, and policy hits detected while indexing.
- Findings refresh on every sync.
+ {t("description")}
</p>
<Button size="sm" variant="outline" onClick={handleRescan} disabled={rescanning}>
<RotateCw
@@ -74,10 +75,10 @@ export function SecurityTab({ repoId }: { repoId: string }) {
) : error ? (
<Card>
<CardHeader className="pb-2">
- <CardTitle className="text-sm">Couldn&apos;t load findings</CardTitle>
+ <CardTitle className="text-sm">{t("loadFailed")}</CardTitle>
</CardHeader>
<CardContent className="pt-0 text-xs text-[var(--color-text-secondary)]">
- The security endpoint returned an error. Try re-running ingestion.
+ {t("loadFailedBody")}
</CardContent>
</Card>
) : (
@@ -86,8 +87,8 @@ export function SecurityTab({ repoId }: { repoId: string }) {
filter pills below, not in a separate distribution card. */}
<SeverityDirectoryMatrix findings={findings ?? []} />
<CollapsibleSection
- title="All findings"
- hint={`${(findings ?? []).length} findings`}
+ title={t("allFindings")}
+ hint={t("findingsCount", { count: (findings ?? []).length })}
defaultOpen={false}
>
<SecurityFindingsTable
@@ -109,8 +110,8 @@ export function SecurityTab({ repoId }: { repoId: string }) {
}
filePath={promptFinding?.file_path}
chatContext={fileChatContext(promptFinding?.file_path)}
- title="AI fix prompt"
- description="A ready-to-paste prompt that walks your AI agent through confirming and remediating this security finding."
+ title={t("promptTitle")}
+ description={t("promptDescription")}
/>
{dialog}
diff --git a/packages/web/src/components/search/command-palette.tsx b/packages/web/src/components/search/command-palette.tsx
index c231e0887..1bca39f31 100644
--- a/packages/web/src/components/search/command-palette.tsx
+++ b/packages/web/src/components/search/command-palette.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState, useCallback, useMemo } from "react";
import { usePathname, useRouter } from "next/navigation";
+import { useTranslations } from "next-intl";
import { Command } from "cmdk";
import useSWR from "swr";
import { Search, LayoutDashboard, Settings, BookOpen, FileCode, Layers, Link2, GitMerge, MessageSquare } from "lucide-react";
@@ -20,6 +21,8 @@ interface CommandPaletteProps {
}
export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
+ const t = useTranslations("shell.commandPalette");
+ const tn = useTranslations("nav");
const isWorkspace = workspace?.is_workspace ?? false;
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
@@ -101,7 +104,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
<Command.Dialog
open={open}
onOpenChange={setOpen}
- label="Command palette"
+ label={t("label")}
className="fixed inset-0 z-[calc(var(--z-modal)+1)] flex items-start justify-center pt-[10vh] sm:pt-[20vh] px-4"
>
<div
@@ -114,7 +117,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
<Command.Input
value={query}
onValueChange={setQuery}
- placeholder="Jump to a file, search pages, navigate repos…"
+ placeholder={t("placeholder")}
className="flex-1 bg-transparent text-sm text-[var(--color-text-primary)] outline-none placeholder:text-[var(--color-text-tertiary)]"
/>
<kbd className="hidden sm:inline-flex items-center rounded border border-[var(--color-border-default)] px-1.5 py-0.5 text-xs text-[var(--color-text-tertiary)] font-mono">
@@ -124,12 +127,12 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
<Command.List className="max-h-[60dvh] overflow-y-auto py-2">
<Command.Empty className="px-4 py-8 text-center text-sm text-[var(--color-text-tertiary)]">
- {isLoading ? "Searching…" : "No results found."}
+ {isLoading ? t("searching") : t("noResults")}
</Command.Empty>
{/* Quick-ask — always available when a repo is in scope */}
{activeRepo && (
- <Command.Group heading="Ask" className="px-2 pb-1">
+ <Command.Group heading={t("askGroup")} className="px-2 pb-1">
<Command.Item
value={`ask-repowise ${query}`}
onSelect={() =>
@@ -145,10 +148,10 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
<span className="truncate">
{query.trim() ? (
<>
- Ask repowise: <span className="text-[var(--color-text-primary)]">“{query.trim()}”</span>
+ {t("askWithQuery", { query: query.trim() })}
</>
) : (
- "Ask repowise…"
+ t("askEmpty")
)}
</span>
</Command.Item>
@@ -157,7 +160,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
{/* Per-repo page navigation */}
{activeRepo && repoPages.length > 0 && (
- <Command.Group heading={`Go to — ${activeRepo.name}`} className="px-2 pb-1">
+ <Command.Group heading={t("goTo", { repo: activeRepo.name })} className="px-2 pb-1">
{repoPages.map((item) => {
const Icon = item.icon;
return (
@@ -168,7 +171,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<Icon className="h-4 w-4" />
- {item.label}
+ {tn(item.labelKey)}
</Command.Item>
);
})}
@@ -177,7 +180,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
{/* Quick navigation */}
<Command.Group
- heading="Navigate"
+ heading={t("navigate")}
className="px-2 pb-1"
>
<Command.Item
@@ -186,7 +189,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<LayoutDashboard className="h-4 w-4" />
- Dashboard
+ {tn("dashboard")}
</Command.Item>
<Command.Item
value="settings"
@@ -194,20 +197,20 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<Settings className="h-4 w-4" />
- Settings
+ {tn("settings")}
</Command.Item>
</Command.Group>
{/* Workspace */}
{isWorkspace && (
- <Command.Group heading="Workspace" className="px-2 pb-1">
+ <Command.Group heading={t("workspace")} className="px-2 pb-1">
<Command.Item
value="workspace-overview"
onSelect={() => navigate("/workspace")}
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<Layers className="h-4 w-4" />
- Workspace Overview
+ {t("workspaceOverview")}
</Command.Item>
<Command.Item
value="workspace-contracts"
@@ -215,7 +218,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<Link2 className="h-4 w-4" />
- Contracts
+ {tn("contracts")}
</Command.Item>
<Command.Item
value="workspace-co-changes"
@@ -223,14 +226,14 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
className="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm text-[var(--color-text-secondary)] cursor-pointer hover:bg-[var(--color-bg-elevated)] hover:text-[var(--color-text-primary)] data-[selected=true]:bg-[var(--color-bg-elevated)] data-[selected=true]:text-[var(--color-text-primary)]"
>
<GitMerge className="h-4 w-4" />
- Co-Changes
+ {tn("coChanges")}
</Command.Item>
</Command.Group>
)}
{/* Repos */}
{repos.length > 0 && (
- <Command.Group heading="Repositories" className="px-2 pb-1">
+ <Command.Group heading={t("repositories")} className="px-2 pb-1">
{repos.map((repo) => (
<Command.Item
key={repo.id}
@@ -247,7 +250,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
{/* File jump */}
{activeRepo && fileMatches.length > 0 && (
- <Command.Group heading="Files" className="px-2 pb-1">
+ <Command.Group heading={t("files")} className="px-2 pb-1">
{fileMatches.map((path) => {
const name = path.split("/").pop() ?? path;
const dir = path.slice(0, path.length - name.length);
@@ -277,7 +280,7 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
{/* Search results */}
{results.length > 0 && (
- <Command.Group heading="Pages" className="px-2 pb-1">
+ <Command.Group heading={t("pages")} className="px-2 pb-1">
{results.map((r) => (
<Command.Item
key={r.page_id}
@@ -302,9 +305,9 @@ export function CommandPalette({ repos, workspace }: CommandPaletteProps) {
</Command.List>
<div className="border-t border-[var(--color-border-default)] px-4 py-2 flex items-center gap-4 text-xs text-[var(--color-text-tertiary)]">
- <span>↑↓ navigate</span>
- <span>↵ select</span>
- <span>esc close</span>
+ <span>{t("hintNavigate")}</span>
+ <span>{t("hintSelect")}</span>
+ <span>{t("hintClose")}</span>
</div>
</div>
</Command.Dialog>
diff --git a/packages/web/src/components/settings/connection-section.tsx b/packages/web/src/components/settings/connection-section.tsx
index 6741a1dd8..5e3b8ef7a 100644
--- a/packages/web/src/components/settings/connection-section.tsx
+++ b/packages/web/src/components/settings/connection-section.tsx
@@ -16,6 +16,7 @@ import {
} from "@repowise-dev/ui/settings";
import type { HealthResponse } from "@/lib/api/types";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
+import { useTranslations } from "next-intl";
/**
* Server connection, and the page's only connection test.
@@ -26,6 +27,7 @@ import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
* not exist. This one reports more (version and DB), so that one went.
*/
export function ConnectionSection() {
+ const t = useTranslations("settings");
const [apiUrl, setApiUrl] = useState("");
const [apiKey, setApiKey] = useState("");
const [testing, setTesting] = useState(false);
@@ -82,16 +84,16 @@ export function ConnectionSection() {
return (
<OverviewSection
- title="Server"
- description="How this dashboard reaches your repowise server. Stored in this browser, not on the server."
+ title={t("connection.title")}
+ description={t("connection.description")}
flush
action={<SaveIndicator state={saveState} />}
>
<SettingsRows>
<SettingsRow
- label="Server URL"
+ label={t("connection.urlLabel")}
htmlFor="api-url"
- hint="Leave blank to use the same origin, which is what a Next.js proxy setup wants."
+ hint={t("connection.urlHint")}
>
<Input
id="api-url"
@@ -104,14 +106,14 @@ export function ConnectionSection() {
</SettingsRow>
<SettingsRow
- label="API key"
+ label={t("connection.apiKeyLabel")}
htmlFor="api-key"
- hint="Only needed when REPOWISE_API_KEY is set on the server."
+ hint={t("connection.apiKeyHint")}
>
<Input
id="api-key"
type="password"
- placeholder="Optional"
+ placeholder={t("connection.apiKeyPlaceholder")}
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
onBlur={save}
@@ -120,8 +122,8 @@ export function ConnectionSection() {
</SettingsRow>
<SettingsRow
- label="Connection"
- hint="Checks that the server answers and reports what it is running."
+ label={t("connection.testLabel")}
+ hint={t("connection.testHint")}
>
<div className="flex flex-wrap items-center gap-3">
<Button
@@ -133,17 +135,17 @@ export function ConnectionSection() {
{testing ? (
<>
<Spinner size="sm" />
- Testing
+ {t("connection.testing")}
</>
) : (
- "Test connection"
+ t("connection.test")
)}
</Button>
{health && (
<StatusLine status="ok">
<span className="tabular-nums">
- Connected · v{health.version} · DB {health.db}
+ {t("connection.status", { version: health.version, db: health.db })}
</span>
</StatusLine>
)}
diff --git a/packages/web/src/components/settings/display-section.tsx b/packages/web/src/components/settings/display-section.tsx
index ea730d78c..cb92b6a8a 100644
--- a/packages/web/src/components/settings/display-section.tsx
+++ b/packages/web/src/components/settings/display-section.tsx
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useRef, useState } from "react";
+import { useTranslations } from "next-intl";
import { OverviewSection } from "@repowise-dev/ui/overview";
import {
Select,
@@ -25,36 +26,32 @@ import {
setChatSelectionAskHidden,
} from "@/lib/config";
-/** The three chat switches, in the order a reader meets them: the dock first,
- * then the two controls it gates. Each hint names what switching off removes. */
-const CHAT_SWITCHES = [
- {
- key: "dock",
- label: "Ask Repowise",
- hint: "The chat pill in the bottom-right of every repository page. Hiding it also hides the two controls below, and does not affect the full chat page.",
- ariaLabel: "Show the Ask Repowise chat pill",
+/** Keys of the three chat switches, in the order a reader meets them: the dock
+ * first, then the two controls it gates. The copy lives under
+ * `settings.display.chat*` and is read inside the component, so the entries
+ * follow the active locale instead of being frozen at module load. */
+const CHAT_SWITCH_KEYS = ["dock", "ask", "selection"] as const;
+
+type ChatSwitchKey = (typeof CHAT_SWITCH_KEYS)[number];
+
+/** Storage behaviour per switch: how each reads and writes its hidden flag. */
+const CHAT_SWITCH_BEHAVIOUR: Record<
+ ChatSwitchKey,
+ { read: () => boolean; write: (shown: boolean) => void }
+> = {
+ dock: {
read: () => !config.getChatDockHidden(),
- write: (shown: boolean) => setChatDockHidden(!shown),
+ write: (shown) => setChatDockHidden(!shown),
},
- {
- key: "ask",
- label: "Ask about this",
- hint: "The small chat button beside a file, symbol, finding, decision or commit. Hiding it removes those buttons; the pill and the full chat page still work.",
- ariaLabel: "Show the Ask about this buttons",
+ ask: {
read: () => !config.getChatAskControlsHidden(),
- write: (shown: boolean) => setChatAskControlsHidden(!shown),
+ write: (shown) => setChatAskControlsHidden(!shown),
},
- {
- key: "selection",
- label: "Ask about a selection",
- hint: "The control that appears when you select text in code or documentation. Hiding it removes that control; selecting text behaves normally.",
- ariaLabel: "Show the Ask about selection control",
+ selection: {
read: () => !config.getChatSelectionAskHidden(),
- write: (shown: boolean) => setChatSelectionAskHidden(!shown),
+ write: (shown) => setChatSelectionAskHidden(!shown),
},
-] as const;
-
-type ChatSwitchKey = (typeof CHAT_SWITCHES)[number]["key"];
+};
/** Reader-local display preferences for the stats surfaces. */
export function DisplaySection() {
@@ -67,6 +64,38 @@ export function DisplaySection() {
const [tipsShown, setTipsShown] = useState(true);
const [saveState, setSaveState] = useState<SaveState>("idle");
const savedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const t = useTranslations("settings");
+ /** The three switches, with their copy taken from the active locale. */
+ const chatSwitches: {
+ key: ChatSwitchKey;
+ label: string;
+ hint: string;
+ ariaLabel: string;
+ read: () => boolean;
+ write: (shown: boolean) => void;
+ }[] = [
+ {
+ key: "dock",
+ label: t("display.chatDockLabel"),
+ hint: t("display.chatDockHint"),
+ ariaLabel: t("display.chatDockAria"),
+ ...CHAT_SWITCH_BEHAVIOUR.dock,
+ },
+ {
+ key: "ask",
+ label: t("display.chatAskLabel"),
+ hint: t("display.chatAskHint"),
+ ariaLabel: t("display.chatAskAria"),
+ ...CHAT_SWITCH_BEHAVIOUR.ask,
+ },
+ {
+ key: "selection",
+ label: t("display.chatSelectionLabel"),
+ hint: t("display.chatSelectionHint"),
+ ariaLabel: t("display.chatSelectionAria"),
+ ...CHAT_SWITCH_BEHAVIOUR.selection,
+ },
+ ];
// Read after mount so SSR and the first client render agree.
useEffect(() => {
@@ -80,9 +109,9 @@ export function DisplaySection() {
useEffect(() => {
const sync = () =>
setChatShown({
- dock: CHAT_SWITCHES[0].read(),
- ask: CHAT_SWITCHES[1].read(),
- selection: CHAT_SWITCHES[2].read(),
+ dock: CHAT_SWITCH_BEHAVIOUR.dock.read(),
+ ask: CHAT_SWITCH_BEHAVIOUR.ask.read(),
+ selection: CHAT_SWITCH_BEHAVIOUR.selection.read(),
});
sync();
window.addEventListener(CHAT_DOCK_VISIBILITY_EVENT, sync);
@@ -119,7 +148,7 @@ export function DisplaySection() {
}
function handleChatChange(
- entry: (typeof CHAT_SWITCHES)[number],
+ entry: { key: ChatSwitchKey; write: (shown: boolean) => void },
shown: boolean,
) {
// Goes through the helper, not `config` directly: the affordances are
@@ -132,14 +161,14 @@ export function DisplaySection() {
return (
<OverviewSection
- title="Display"
- description="What this browser shows and how it presents it. Nothing here changes the index."
+ title={t("display.title")}
+ description={t("display.description")}
action={<SaveIndicator state={saveState} />}
>
<SettingsRows>
<SettingsRow
- label="Weekend days"
- hint="Drives the “on weekends” share on the coding-rhythm heatmap."
+ label={t("display.weekendLabel")}
+ hint={t("display.weekendHint")}
>
<Select value={weekend} onValueChange={handleChange}>
<SelectTrigger className="w-full sm:w-64">
@@ -154,7 +183,7 @@ export function DisplaySection() {
</SelectContent>
</Select>
</SettingsRow>
- {CHAT_SWITCHES.map((entry) => {
+ {chatSwitches.map((entry) => {
// The dock gates the other two, so their switches cannot act while it
// is hidden. Say why rather than leaving a live-looking control.
const gated = entry.key !== "dock" && !chatShown.dock;
@@ -164,7 +193,7 @@ export function DisplaySection() {
label={entry.label}
hint={
gated
- ? `${entry.hint} Unavailable while Ask Repowise is hidden.`
+ ? t("display.chatGatedHint", { hint: entry.hint })
: entry.hint
}
>
diff --git a/packages/web/src/components/settings/mcp-section.tsx b/packages/web/src/components/settings/mcp-section.tsx
index 1f9958158..016cde181 100644
--- a/packages/web/src/components/settings/mcp-section.tsx
+++ b/packages/web/src/components/settings/mcp-section.tsx
@@ -2,6 +2,7 @@
import { OverviewSection } from "@repowise-dev/ui/overview";
import { CopyLine, SettingsRow, SettingsRows } from "@repowise-dev/ui/settings";
+import { useTranslations } from "next-intl";
const MCP_CONFIG = JSON.stringify(
{
@@ -17,15 +18,17 @@ const MCP_CONFIG = JSON.stringify(
);
export function McpSection() {
+ const t = useTranslations("settings");
+
return (
<OverviewSection
- title="Editor config"
- description="Paste this into Claude Code, Cursor or Cline to let the agent query this codebase. Replace the path with the repo you want served, and index it first so there is something to answer from."
+ title={t("mcp.title")}
+ description={t("mcp.description")}
>
<SettingsRows>
<SettingsRow
- label="MCP server"
- hint="Goes in your editor's MCP config file."
+ label={t("mcp.serverLabel")}
+ hint={t("mcp.serverHint")}
>
<CopyLine value={MCP_CONFIG} />
</SettingsRow>
diff --git a/packages/web/src/components/settings/mcp-tools-section.tsx b/packages/web/src/components/settings/mcp-tools-section.tsx
index eff733409..108878670 100644
--- a/packages/web/src/components/settings/mcp-tools-section.tsx
+++ b/packages/web/src/components/settings/mcp-tools-section.tsx
@@ -20,6 +20,7 @@ import { listRepos } from "@/lib/api/repos";
import { getMcpToolSurface, updateMcpTools } from "@/lib/api/mcp-tools";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
import type { McpToolSurface } from "@/lib/api/types";
+import { useTranslations } from "next-intl";
interface RepoOption {
id: string;
@@ -51,6 +52,7 @@ function toDeltas(surface: McpToolSurface, enabled: Set<string>): string[] {
* indicator.
*/
export function McpToolsSection() {
+ const t = useTranslations("settings");
const [repos, setRepos] = useState<RepoOption[]>([]);
const [repoId, setRepoId] = useState<string | null>(null);
const [surface, setSurface] = useState<McpToolSurface | null>(null);
@@ -141,33 +143,32 @@ export function McpToolsSection() {
);
const on = available.filter((t) => enabled.has(t.name)).length;
const mode = surface.is_workspace
- ? "Workspace mode, so workspace-only tools are available."
- : "Single-repo mode, so workspace-only tools are unavailable here.";
- return `${on} of ${available.length} tools exposed. ${mode}`;
- }, [surface, enabled]);
+ ? t("mcpTools.summaryWorkspace")
+ : t("mcpTools.summarySingleRepo");
+ return t("mcpTools.summary", { on, total: available.length, mode });
+ }, [surface, enabled, t]);
return (
<OverviewSection
- title="Tool surface"
+ title={t("mcpTools.title")}
// Rule 4: the figure is the point. "9 of 15 exposed" answers the question
// the list is there to answer, before you read fifteen rows.
description={
- summary ??
- "Which tools the MCP server offers an agent. Saved to the repo's .repowise/config.yaml and applied the next time you start repowise mcp for it."
+ summary ?? t("mcpTools.description")
}
action={<SaveIndicator state={saveState} error={error} />}
>
{repos.length === 0 && !loading && (
<p className="text-sm text-[var(--color-text-tertiary)]">
- Index a repository and its tool surface shows up here.
+ {t("mcpTools.empty")}
</p>
)}
{repos.length > 1 && (
<SettingsRows>
<SettingsRow
- label="Repository"
- hint="The surface is stored per repo."
+ label={t("mcpTools.repoLabel")}
+ hint={t("mcpTools.repoHint")}
>
<Select value={repoId ?? undefined} onValueChange={setRepoId}>
<SelectTrigger className="w-full sm:w-64">
@@ -213,7 +214,7 @@ export function McpToolsSection() {
the unavailable case needs a word. */}
{locked && (
<span className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
- workspace only
+ {t("mcpTools.workspaceOnly")}
</span>
)}
</div>
diff --git a/packages/web/src/components/settings/provider-section.tsx b/packages/web/src/components/settings/provider-section.tsx
index 4b0b041da..1672f3c0d 100644
--- a/packages/web/src/components/settings/provider-section.tsx
+++ b/packages/web/src/components/settings/provider-section.tsx
@@ -19,6 +19,7 @@ import {
EnvVarLine,
type SaveState,
} from "@repowise-dev/ui/settings";
+import { useTranslations } from "next-intl";
/**
* Fallback only, for a cold load and for an API that never answers. The server
@@ -88,6 +89,7 @@ const EMBEDDER_ENV_VARS: Record<string, string[]> = {
* here where it belongs.
*/
export function ProviderSection() {
+ const t = useTranslations("settings");
const [provider, setProvider] = useState("gemini");
const [model, setModel] = useState("");
const [embedder, setEmbedder] = useState("mock");
@@ -171,22 +173,25 @@ export function ProviderSection() {
return (
<OverviewSection
- title="Model defaults"
+ title={t("provider.title")}
description={
serverProvider
- ? `Used when you trigger init or sync from this dashboard. The server itself is currently configured with ${serverProvider}.`
- : "Used when you trigger init or sync from this dashboard."
+ ? t("provider.descriptionWithServer", { provider: serverProvider })
+ : t("provider.description")
}
action={<SaveIndicator state={saveState} />}
>
<SettingsRows>
<SettingsRow
- label="Provider"
+ label={t("provider.providerLabel")}
hint={providerInfo?.installHint}
>
<div className="space-y-2">
<Select value={provider} onValueChange={handleProviderChange}>
- <SelectTrigger aria-label="Provider" className="w-full sm:w-64">
+ <SelectTrigger
+ aria-label={t("provider.providerAria")}
+ className="w-full sm:w-64"
+ >
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -202,9 +207,9 @@ export function ProviderSection() {
</SettingsRow>
<SettingsRow
- label="Model"
+ label={t("provider.modelLabel")}
htmlFor="model"
- hint="Leave blank to use the provider's default."
+ hint={t("provider.modelHint")}
>
<Input
id="model"
@@ -220,12 +225,15 @@ export function ProviderSection() {
</SettingsRow>
<SettingsRow
- label="Embedder"
- hint="What semantic search is built from. The mock embedder disables it."
+ label={t("provider.embedderLabel")}
+ hint={t("provider.embedderHint")}
>
<div className="space-y-2">
<Select value={embedder} onValueChange={handleEmbedderChange}>
- <SelectTrigger aria-label="Embedder" className="w-full sm:w-64">
+ <SelectTrigger
+ aria-label={t("provider.embedderAria")}
+ className="w-full sm:w-64"
+ >
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -239,32 +247,17 @@ export function ProviderSection() {
{embedder === "mock" ? (
<EnvVarLine
vars={[]}
- note={
- <>
- Semantic search is off. Set{" "}
- <code className="font-mono text-[var(--color-text-secondary)]">
- REPOWISE_EMBEDDER=gemini
- </code>{" "}
- or{" "}
- <code className="font-mono text-[var(--color-text-secondary)]">
- REPOWISE_EMBEDDER=openai
- </code>{" "}
- on the server for real retrieval.
- </>
- }
+ note={t.rich("provider.embedderOffNote", {
+ code: (chunks) => <code className="font-mono text-[var(--color-text-secondary)]">{chunks}</code>,
+ })}
/>
) : (
<EnvVarLine
vars={embedderVars}
- note={
- <>
- Set{" "}
- <code className="font-mono text-[var(--color-text-secondary)]">
- REPOWISE_EMBEDDER={embedder}
- </code>{" "}
- on the server.
- </>
- }
+ note={t.rich("provider.embedderOnNote", {
+ code: (chunks) => <code className="font-mono text-[var(--color-text-secondary)]">{chunks}</code>,
+ env: `REPOWISE_EMBEDDER=${embedder}`,
+ })}
/>
)}
</div>
diff --git a/packages/web/src/components/settings/provider-settings-panel.tsx b/packages/web/src/components/settings/provider-settings-panel.tsx
index a5fb13495..5c3c39c1b 100644
--- a/packages/web/src/components/settings/provider-settings-panel.tsx
+++ b/packages/web/src/components/settings/provider-settings-panel.tsx
@@ -5,6 +5,7 @@ import { ProviderSettings } from "@repowise-dev/ui/settings/provider-settings";
import { Skeleton } from "@repowise-dev/ui/ui/skeleton";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
import { useProviders } from "@/lib/hooks/use-providers";
+import { useTranslations } from "next-intl";
/**
* Web data wrapper around the shared `ProviderSettings` shell. Owns the fetch,
@@ -23,6 +24,8 @@ export function ProviderSettingsPanel({ repoId }: { repoId: string }) {
validate,
} = useProviders(repoId);
+ const t = useTranslations("settings");
+
if (isLoading) {
return (
<div className="space-y-2.5">
@@ -36,20 +39,24 @@ export function ProviderSettingsPanel({ repoId }: { repoId: string }) {
async function handleAddKey(providerId: string, key: string) {
try {
await saveKey(providerId, key);
- toast.success("API key saved", {
- description: "Written to this repo. Test it to confirm it works.",
+ toast.success(t("providerPanel.keySaved"), {
+ description: t("providerPanel.keySavedDescription"),
});
} catch (e) {
- toast.error("Couldn't save the key", { description: toFriendlyMessage(e) });
+ toast.error(t("providerPanel.keySaveFailed"), {
+ description: toFriendlyMessage(e),
+ });
}
}
async function handleRemoveKey(providerId: string) {
try {
await removeKey(providerId);
- toast.info("API key removed");
+ toast.info(t("providerPanel.keyRemoved"));
} catch (e) {
- toast.error("Couldn't remove the key", { description: toFriendlyMessage(e) });
+ toast.error(t("providerPanel.keyRemoveFailed"), {
+ description: toFriendlyMessage(e),
+ });
}
}
@@ -57,7 +64,7 @@ export function ProviderSettingsPanel({ repoId }: { repoId: string }) {
try {
await activate(providerId, model);
} catch (e) {
- toast.error("Couldn't set the active provider", {
+ toast.error(t("providerPanel.activateFailed"), {
description: toFriendlyMessage(e),
});
}
diff --git a/packages/web/src/components/settings/webhook-section.tsx b/packages/web/src/components/settings/webhook-section.tsx
index f2d83722c..cfc24af8c 100644
--- a/packages/web/src/components/settings/webhook-section.tsx
+++ b/packages/web/src/components/settings/webhook-section.tsx
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import { OverviewSection } from "@repowise-dev/ui/overview";
import { CopyLine, SettingsRow, SettingsRows } from "@repowise-dev/ui/settings";
+import { useTranslations } from "next-intl";
/**
* Best-effort server URL for webhook registration: the configured API URL
@@ -17,6 +18,7 @@ export function resolveWebhookBaseUrl(): string {
}
export function WebhookSection() {
+ const t = useTranslations("settings");
const [serverUrl, setServerUrl] = useState("http://localhost:7337");
// Resolved in an effect so SSR and the first client render agree.
useEffect(() => {
@@ -25,21 +27,21 @@ export function WebhookSection() {
return (
<OverviewSection
- title="Webhooks"
- description="Register one of these in GitHub or GitLab and a push re-syncs the index. The URLs use this dashboard's address, so substitute a public hostname if the host cannot reach it."
+ title={t("webhook.title")}
+ description={t("webhook.description")}
>
<SettingsRows>
- <SettingsRow label="GitHub" hint="Content type: application/json.">
+ <SettingsRow label="GitHub" hint={t("webhook.githubHint")}>
<CopyLine value={`${serverUrl}/api/webhooks/github`} />
</SettingsRow>
- <SettingsRow label="GitLab" hint="Push events.">
+ <SettingsRow label="GitLab" hint={t("webhook.gitlabHint")}>
<CopyLine value={`${serverUrl}/api/webhooks/gitlab`} />
</SettingsRow>
<SettingsRow
- label="Signature verification"
- hint="Omit both to skip verification while developing locally."
+ label={t("webhook.signatureLabel")}
+ hint={t("webhook.signatureHint")}
>
<div className="space-y-1.5">
<p className="font-mono text-xs text-[var(--color-text-secondary)]">
@@ -49,7 +51,7 @@ export function WebhookSection() {
REPOWISE_GITLAB_WEBHOOK_TOKEN=your-token
</p>
<p className="text-xs text-[var(--color-text-tertiary)]">
- Set on the server, not here.
+ {t("webhook.serverOnly")}
</p>
</div>
</SettingsRow>
diff --git a/packages/web/src/components/symbols/symbol-table-wrapper.tsx b/packages/web/src/components/symbols/symbol-table-wrapper.tsx
index a9b354a43..39e39b5ba 100644
--- a/packages/web/src/components/symbols/symbol-table-wrapper.tsx
+++ b/packages/web/src/components/symbols/symbol-table-wrapper.tsx
@@ -9,6 +9,7 @@ import { SymbolDrawerWrapper } from "./symbol-drawer-wrapper";
import { listSymbolsPage, type SymbolSortKey } from "@/lib/api/symbols";
import { useDebounce } from "@/lib/hooks/use-debounce";
import type { Paginated, SymbolResponse } from "@/lib/api/types";
+import { useTranslations } from "next-intl";
const LIMIT = 50;
@@ -17,6 +18,7 @@ interface Props {
}
export function SymbolTableWrapper({ repoId }: Props) {
+ const t = useTranslations("symbols");
// `?file=` deep link (graph inspection panel "Symbols" action) scopes the
// table to one source file until dismissed.
const searchParams = useSearchParams();
@@ -87,14 +89,14 @@ export function SymbolTableWrapper({ repoId }: Props) {
<button
type="button"
onClick={() => setFileFilter(null)}
- aria-label="Clear file filter"
+ aria-label={t("clearFileFilter")}
className="hover:opacity-70"
>
<X className="h-3 w-3" />
</button>
</span>
<span className="text-xs text-[var(--color-text-tertiary)]">
- showing symbols in this file only
+ {t("fileOnly")}
</span>
</div>
)}
diff --git a/packages/web/src/components/zoom/zoom-breadcrumb.tsx b/packages/web/src/components/zoom/zoom-breadcrumb.tsx
index b01546200..56a5b00cd 100644
--- a/packages/web/src/components/zoom/zoom-breadcrumb.tsx
+++ b/packages/web/src/components/zoom/zoom-breadcrumb.tsx
@@ -8,6 +8,7 @@
import { ChevronRight, Home } from "lucide-react";
import type { ZoomNode } from "@repowise-dev/ui/zoom";
+import { useTranslations } from "next-intl";
interface ZoomBreadcrumbProps {
chain: ZoomNode[];
@@ -15,13 +16,15 @@ interface ZoomBreadcrumbProps {
}
export function ZoomBreadcrumb({ chain, onCrumb }: ZoomBreadcrumbProps) {
+ const t = useTranslations("zoom");
+
if (chain.length === 0) return null;
const root = chain[0]!;
const rest = chain.slice(1);
return (
<nav
- aria-label="Zoom location"
+ aria-label={t("breadcrumb.label")}
className="flex min-w-0 items-center gap-1 overflow-x-auto text-xs text-[var(--color-text-secondary)]"
>
<button
diff --git a/packages/web/src/components/zoom/zoom-detail-panel.tsx b/packages/web/src/components/zoom/zoom-detail-panel.tsx
index 8e3d1bc59..4e0a78d0a 100644
--- a/packages/web/src/components/zoom/zoom-detail-panel.tsx
+++ b/packages/web/src/components/zoom/zoom-detail-panel.tsx
@@ -32,6 +32,7 @@ import { bandForScore, formatScore } from "@repowise-dev/types/health";
import { fileEntityPath } from "@repowise-dev/ui/shared/entity";
import { pageHref } from "@/lib/utils/page-href";
import { healthBandTextColor } from "@repowise-dev/ui/health";
+import { useTranslations } from "next-intl";
interface ZoomDetailPanelProps {
node: ZoomNode;
@@ -98,6 +99,7 @@ export function ZoomDetailPanel({
onClose,
onZoom,
}: ZoomDetailPanelProps) {
+ const t = useTranslations("zoom");
const m = node.metrics;
const isFile = node.kind === "file";
// The shared bands, so the panel agrees with the dot on the card beside it.
@@ -147,7 +149,7 @@ export function ZoomDetailPanel({
<button
type="button"
onClick={onClose}
- aria-label="Close details"
+ aria-label={t("detail.close")}
className="shrink-0 rounded p-1 text-[var(--color-text-muted)] hover:bg-[var(--color-bg-wash-hover)] hover:text-[var(--color-text-primary)]"
>
<X className="h-4 w-4" />
@@ -165,8 +167,9 @@ export function ZoomDetailPanel({
</div>
{/* A figure alone is not readable. Say what it measures. */}
<p className="mt-1.5 text-[13px] leading-relaxed text-[var(--color-text-secondary)]">
- Code health out of 10
- {isFile ? "" : ", averaged across this subtree weighted by size"}.
+ {isFile
+ ? t("detail.healthOutOfTen")
+ : t("detail.healthOutOfTenSubtree")}
</p>
</div>
)}
@@ -178,26 +181,32 @@ export function ZoomDetailPanel({
)}
<div className="mt-3">
- {!isFile && <Row label="Files" value={m.file_count} />}
+ {!isFile && <Row label={t("detail.files")} value={m.file_count} />}
{m.hotspot_count > 0 && (
- <Row label="Hotspots" value={m.hotspot_count} tone="text-[var(--color-risk-high)]" />
+ <Row
+ label={t("detail.hotspots")}
+ value={m.hotspot_count}
+ tone="text-[var(--color-risk-high)]"
+ />
)}
{m.entry_point_count > 0 && (
<Row
- label="Entry points"
+ label={t("detail.entryPoints")}
value={m.entry_point_count}
tone="text-[var(--color-success)]"
/>
)}
- {m.on_flow_count > 0 && <Row label="On flow" value={m.on_flow_count} />}
- {m.dead_count > 0 && <Row label="Dead" value={m.dead_count} />}
+ {m.on_flow_count > 0 && (
+ <Row label={t("detail.onFlow")} value={m.on_flow_count} />
+ )}
+ {m.dead_count > 0 && <Row label={t("detail.dead")} value={m.dead_count} />}
</div>
{/* What the arrows mean. The verb was on the wire and drawn nowhere,
so nothing on this surface said whether a line meant "imports" or
"changes at the same time as". */}
<div className="mt-3 border-t border-[var(--color-border-default)] pt-3">
- <Micro>Relations</Micro>
+ <Micro>{t("detail.relations")}</Micro>
<p className="mt-1.5 text-[13px] leading-relaxed text-[var(--color-text-secondary)] tabular-nums">
{describeRelations(summary)}
</p>
@@ -205,14 +214,15 @@ export function ZoomDetailPanel({
/* A surface that bounds its own coverage has to say so, or the
partial view reads as the whole one. */
<p className="mt-1 text-[12px] text-[var(--color-text-tertiary)] tabular-nums">
- {cap} on the map.
+ {t("detail.capSuffix", { cap })}
</p>
)}
</div>
{node.language && (
<div className="mt-3 border-t border-[var(--color-border-default)] pt-3 text-[13px] text-[var(--color-text-secondary)]">
- <Micro>Language</Micro> <span className="ml-1">{node.language}</span>
+ <Micro>{t("detail.language")}</Micro>{" "}
+ <span className="ml-1">{node.language}</span>
</div>
)}
</div>
@@ -226,7 +236,7 @@ export function ZoomDetailPanel({
className="flex w-full items-center justify-center gap-1.5 rounded-md bg-[var(--color-accent-primary)] px-3 py-2 text-[13px] font-medium text-[var(--color-text-on-accent)] hover:opacity-90"
>
<ScanSearch className="h-3.5 w-3.5" />
- Zoom in
+ {t("detail.zoomIn")}
</button>
)}
{/* This card is named after a module page, so the page it is named
@@ -237,7 +247,7 @@ export function ZoomDetailPanel({
className="flex w-full items-center justify-center gap-1.5 rounded-md border border-[var(--color-border-default)] px-3 py-2 text-[13px] font-medium text-[var(--color-text-primary)] hover:bg-[var(--color-bg-wash-hover)]"
>
<BookOpen className="h-3.5 w-3.5" />
- Read the module page
+ {t("detail.readModule")}
</Link>
)}
{isFile && node.path && (
@@ -246,7 +256,7 @@ export function ZoomDetailPanel({
className="flex w-full items-center justify-center gap-1.5 rounded-md border border-[var(--color-border-default)] px-3 py-2 text-[13px] font-medium text-[var(--color-text-primary)] hover:bg-[var(--color-bg-wash-hover)]"
>
<FileCode className="h-3.5 w-3.5" />
- Open file page
+ {t("detail.openFile")}
</Link>
)}
</footer>
diff --git a/packages/web/src/components/zoom/zoom-export-button.tsx b/packages/web/src/components/zoom/zoom-export-button.tsx
index 0f46668f8..ab29e24cd 100644
--- a/packages/web/src/components/zoom/zoom-export-button.tsx
+++ b/packages/web/src/components/zoom/zoom-export-button.tsx
@@ -28,6 +28,7 @@ import { Spinner } from "@repowise-dev/ui/ui/spinner";
import { toast } from "sonner";
import { getStructurizrDsl } from "@repowise-dev/api-client/c4";
import { downloadTextFile } from "@/lib/utils/download";
+import { useTranslations } from "next-intl";
const WORKSPACE_FILENAME = "workspace.dsl";
const FRAGMENT_FILENAME = "repowise-model.dsl";
@@ -39,6 +40,7 @@ export function ZoomExportButton({
repoId: string;
disabled?: boolean;
}) {
+ const t = useTranslations("zoom");
const [working, setWorking] = useState(false);
const [open, setOpen] = useState(false);
// `working` is only true after a re-render, and `disabled` follows it, so two
@@ -73,19 +75,19 @@ export function ZoomExportButton({
try {
const dsl = await getStructurizrDsl(repoId, { standalone });
downloadTextFile(dsl, filename, "text/plain");
- toast.success(`Downloaded ${filename}`);
+ toast.success(t("export.downloaded", { filename }));
} catch (error) {
// The client throws with the status code, so a 404 (no such repo) and a
// 500 (built and failed) are different problems. Keep it out of the toast
// and in the console, where someone debugging will look.
console.error("Structurizr DSL export failed", error);
- toast.error("Couldn't build the Structurizr DSL");
+ toast.error(t("export.failed"));
} finally {
inFlight.current = false;
setWorking(false);
}
},
- [repoId],
+ [repoId, t],
);
return (
@@ -102,7 +104,7 @@ export function ZoomExportButton({
aria-busy={working}
aria-haspopup="menu"
aria-expanded={open}
- title="Download this repository's architecture as Structurizr DSL"
+ title={t("export.title")}
className="inline-flex items-center gap-1.5 rounded-lg border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs font-medium text-[var(--color-text-secondary)] transition-colors hover:text-[var(--color-text-primary)] disabled:cursor-not-allowed disabled:opacity-50"
>
{working ? (
@@ -113,7 +115,7 @@ export function ZoomExportButton({
{/* The label carries the state, not just the icon: lucide marks its
glyphs aria-hidden, so a spinner alone tells a screen-reader user
nothing happened. */}
- {working ? "Building…" : "Structurizr DSL"}
+ {working ? t("export.building") : "Structurizr DSL"}
{!working && <ChevronDown className="h-3 w-3" />}
</button>
{open && (
@@ -122,13 +124,13 @@ export function ZoomExportButton({
className="absolute right-0 top-[calc(100%+4px)] z-10 w-72 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-elevated)] p-1 shadow-lg"
>
<ExportOption
- label="Workspace (workspace.dsl)"
- hint="Complete file with default views. Opens as-is in Structurizr."
+ label={t("export.workspaceLabel")}
+ hint={t("export.workspaceHint")}
onClick={() => void download(true)}
/>
<ExportOption
- label="Model fragment (repowise-model.dsl)"
- hint="Model block only, to !include from a workspace.dsl you already have."
+ label={t("export.fragmentLabel")}
+ hint={t("export.fragmentHint")}
onClick={() => void download(false)}
/>
</div>
diff --git a/packages/web/src/components/zoom/zoom-hint.tsx b/packages/web/src/components/zoom/zoom-hint.tsx
index 8e82477e2..8a4ead624 100644
--- a/packages/web/src/components/zoom/zoom-hint.tsx
+++ b/packages/web/src/components/zoom/zoom-hint.tsx
@@ -10,10 +10,12 @@
import { useEffect, useState } from "react";
import { Move, MousePointerClick, X, ZoomIn } from "lucide-react";
+import { useTranslations } from "next-intl";
const DISMISS_KEY = "repowise:zoom-hint-dismissed";
export function ZoomHint() {
+ const t = useTranslations("zoom");
// Start hidden so SSR and the pre-hydration paint never flash the hint; reveal
// it only after we have checked localStorage on the client.
const [show, setShow] = useState(false);
@@ -43,22 +45,22 @@ export function ZoomHint() {
<div className="pointer-events-auto flex max-w-full items-center gap-3 overflow-x-auto rounded-full border border-[var(--color-border-subtle)] bg-[var(--color-bg-glass)] py-1.5 pl-4 pr-2 text-xs text-[var(--color-text-secondary)] shadow-sm backdrop-blur">
<span className="flex shrink-0 items-center gap-1.5">
<ZoomIn className="h-3.5 w-3.5 text-[var(--color-text-tertiary)]" />
- Scroll to zoom
+ {t("hint.scroll")}
</span>
<span className="text-[var(--color-border-default)]">·</span>
<span className="flex shrink-0 items-center gap-1.5">
<Move className="h-3.5 w-3.5 text-[var(--color-text-tertiary)]" />
- Drag to pan
+ {t("hint.drag")}
</span>
<span className="text-[var(--color-border-default)]">·</span>
<span className="flex shrink-0 items-center gap-1.5">
<MousePointerClick className="h-3.5 w-3.5 text-[var(--color-text-tertiary)]" />
- Double-click a card to dive in
+ {t("hint.doubleClick")}
</span>
<button
type="button"
onClick={dismiss}
- aria-label="Dismiss hint"
+ aria-label={t("hint.dismiss")}
className="ml-1 shrink-0 rounded-full p-1 text-[var(--color-text-muted)] hover:bg-[var(--color-bg-wash-hover)] hover:text-[var(--color-text-primary)]"
>
<X className="h-3.5 w-3.5" />
diff --git a/packages/web/src/components/zoom/zoom-map-key.tsx b/packages/web/src/components/zoom/zoom-map-key.tsx
index d1962eb69..937138452 100644
--- a/packages/web/src/components/zoom/zoom-map-key.tsx
+++ b/packages/web/src/components/zoom/zoom-map-key.tsx
@@ -36,6 +36,7 @@ import {
HEALTH_BAND_LABEL,
NEEDS_WORK_MIN,
} from "@repowise-dev/types/health";
+import { useTranslations } from "next-intl";
interface ZoomMapKeyProps {
/** Every verb present in the loaded map, descending by count. */
@@ -61,6 +62,7 @@ export function ZoomMapKey({
selected,
onSelectedChange,
}: ZoomMapKeyProps) {
+ const t = useTranslations("zoom");
const filtered = selected !== null;
return (
@@ -68,28 +70,21 @@ export function ZoomMapKey({
<div className="flex flex-col gap-2 sm:flex-row sm:items-baseline sm:justify-between">
<p className="min-w-0 text-[13px] leading-relaxed text-[var(--color-text-secondary)]">
{filtered ? (
- <>
- Showing{" "}
- <span className="text-[var(--color-text-primary)]">
- {[...selected].join(", ")}
- </span>{" "}
- only. Arrow weight is how many file pairs the relation covers.
- </>
+ t.rich("mapKey.showingFiltered", {
+ list: [...selected].join(", "),
+ verbs: (chunks) => (
+ <span className="text-[var(--color-text-primary)]">{chunks}</span>
+ ),
+ })
) : (
- <>
- Hover a card to see what it depends on. Arrow weight is how many file pairs the
- dependency covers.
- </>
+ t("mapKey.hoverHint")
)}
- {unclaimedFiles > 0 && (
+ {unclaimedFiles > 0 &&
/* Silence when nothing is missing: "0 not shown" is noise. */
- <>
- {" "}
- {unclaimedFiles.toLocaleString()} of{" "}
- {(totalFiles + unclaimedFiles).toLocaleString()} files are not on the map; they
- belong to no layer.
- </>
- )}
+ t("mapKey.unclaimed", {
+ shown: unclaimedFiles.toLocaleString(),
+ total: (totalFiles + unclaimedFiles).toLocaleString(),
+ })}
</p>
{verbs.length > 1 && (
/* Counts sit on the chips so you can tell whether one is worth a
@@ -113,7 +108,7 @@ export function ZoomMapKey({
onClick={() => onSelectedChange(null)}
className="rounded-md px-2 py-1 text-xs text-[var(--color-text-secondary)] underline-offset-2 transition-colors hover:text-[var(--color-text-primary)] hover:underline"
>
- Clear
+ {t("mapKey.clear")}
</button>
)}
</div>
@@ -126,20 +121,25 @@ export function ZoomMapKey({
<dl className="mt-2 flex flex-wrap items-center gap-x-5 gap-y-1 text-[12px] text-[var(--color-text-tertiary)]">
<div className="flex items-center gap-1.5">
<Dot className="bg-[var(--color-accent-primary)]" />
- <dt className="sr-only">Top-right dot</dt>
- <dd>Entry point, hotspot, dead code or on an execution flow. Hover for which.</dd>
+ <dt className="sr-only">{t("mapKey.topRightDot")}</dt>
+ <dd>{t("mapKey.entryDotHelp")}</dd>
</div>
<div className="flex items-center gap-1.5">
<Dot className="bg-[var(--color-success)]" />
<Dot className="bg-[var(--color-caution)]" />
<Dot className="bg-[var(--color-warning)]" />
<Dot className="bg-[var(--color-error)]" />
- <dt className="sr-only">Footer dot</dt>
+ <dt className="sr-only">{t("mapKey.footerDot")}</dt>
<dd>
- Code health: {HEALTH_BAND_LABEL.good} from {GOOD_MIN.toFixed(1)},{" "}
- {HEALTH_BAND_LABEL.fair} from {FAIR_MIN.toFixed(1)},{" "}
- {HEALTH_BAND_LABEL.needs_work} from {NEEDS_WORK_MIN.toFixed(1)},{" "}
- {HEALTH_BAND_LABEL.at_risk} below that.
+ {t("mapKey.healthBand", {
+ good: HEALTH_BAND_LABEL.good,
+ goodMin: GOOD_MIN.toFixed(1),
+ fair: HEALTH_BAND_LABEL.fair,
+ fairMin: FAIR_MIN.toFixed(1),
+ needsWork: HEALTH_BAND_LABEL.needs_work,
+ needsWorkMin: NEEDS_WORK_MIN.toFixed(1),
+ atRisk: HEALTH_BAND_LABEL.at_risk,
+ })}
</dd>
</div>
</dl>
diff --git a/packages/web/src/components/zoom/zoom-search.tsx b/packages/web/src/components/zoom/zoom-search.tsx
index 8085ca13c..28944d103 100644
--- a/packages/web/src/components/zoom/zoom-search.tsx
+++ b/packages/web/src/components/zoom/zoom-search.tsx
@@ -10,6 +10,7 @@
import { useMemo, useRef, useState } from "react";
import { Search, X } from "lucide-react";
import type { ZoomNode } from "@repowise-dev/ui/zoom";
+import { useTranslations } from "next-intl";
interface ZoomSearchProps {
nodes: ZoomNode[];
@@ -29,6 +30,7 @@ function rank(node: ZoomNode, q: string): number {
}
export function ZoomSearch({ nodes, onPick }: ZoomSearchProps) {
+ const t = useTranslations("zoom");
const [query, setQuery] = useState("");
const [open, setOpen] = useState(false);
const [active, setActive] = useState(0);
@@ -84,8 +86,8 @@ export function ZoomSearch({ nodes, onPick }: ZoomSearchProps) {
onFocus={() => setOpen(true)}
onBlur={() => setTimeout(() => setOpen(false), 120)}
onKeyDown={onKeyDown}
- placeholder="Search files…"
- aria-label="Search the system map"
+ placeholder={t("search.placeholder")}
+ aria-label={t("search.aria")}
className="w-full bg-transparent text-xs text-[var(--color-text-primary)] outline-none placeholder:text-[var(--color-text-muted)]"
/>
{query && (
@@ -95,7 +97,7 @@ export function ZoomSearch({ nodes, onPick }: ZoomSearchProps) {
setQuery("");
inputRef.current?.focus();
}}
- aria-label="Clear search"
+ aria-label={t("search.clear")}
className="shrink-0 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]"
>
<X className="h-3.5 w-3.5" />
diff --git a/packages/web/src/i18n/config.ts b/packages/web/src/i18n/config.ts
new file mode 100644
index 000000000..85d26ef3a
--- /dev/null
+++ b/packages/web/src/i18n/config.ts
@@ -0,0 +1,40 @@
+/**
+ * Locale registry for the Repowise Web UI.
+ *
+ * The UI is served from one URL space: no `/{locale}/...` prefix routing, so
+ * every existing link, bookmark and uptime probe keeps working. The active
+ * locale travels in a cookie (`NEXT_LOCALE`) that the server reads per
+ * request, plus a `localStorage` mirror the client writes so the choice
+ * survives a cookie clear.
+ *
+ * Adding a language is three steps — see `packages/web/I18N.md`.
+ */
+
+export const LOCALES = ["en"] as const;
+
+export type Locale = (typeof LOCALES)[number];
+
+/** English stays the default: an unset or unknown cookie renders English. */
+export const DEFAULT_LOCALE: Locale = "en";
+
+/** The cookie next-intl's docs use for the no-prefix (cookie) strategy. */
+export const LOCALE_COOKIE = "NEXT_LOCALE";
+
+/** Client-side mirror, written next to the cookie by the language switcher. */
+export const LOCALE_STORAGE_KEY = "repowise:locale";
+
+export function isLocale(value: unknown): value is Locale {
+ return (
+ typeof value === "string" && (LOCALES as readonly string[]).includes(value)
+ );
+}
+
+/** Never throws: an unknown or missing value falls back to the default. */
+export function resolveLocale(value: unknown): Locale {
+ return isLocale(value) ? value : DEFAULT_LOCALE;
+}
+
+/** Endonym labels, in each language's own script. Not translated. */
+export const LOCALE_LABELS: Record<Locale, string> = {
+ en: "English",
+};
diff --git a/packages/web/src/i18n/fallback.ts b/packages/web/src/i18n/fallback.ts
new file mode 100644
index 000000000..bb258a149
--- /dev/null
+++ b/packages/web/src/i18n/fallback.ts
@@ -0,0 +1,32 @@
+/**
+ * English is the source of truth for the message catalogs.
+ *
+ * A locale catalog only carries the keys its translator has reached. The rest
+ * must render the English string at runtime — not the raw key — so a catalog
+ * that lags behind `en.json` never breaks the UI. The rule is enforced here by
+ * layering every catalog on top of the English one, rather than by requiring
+ * every catalog to carry the identical key set.
+ */
+
+type Catalog = Record<string, unknown>;
+
+function isCatalog(value: unknown): value is Catalog {
+ return typeof value === "object" && value !== null && !Array.isArray(value);
+}
+
+/**
+ * Deep-merge `override` over `base`. Keys the override omits keep their base
+ * value; keys it carries (including nested namespaces) win.
+ */
+export function withFallback(base: Catalog, override?: Catalog): Catalog {
+ if (!override) return base;
+ const merged: Catalog = { ...base };
+ for (const [key, value] of Object.entries(override)) {
+ const baseValue = merged[key];
+ merged[key] =
+ isCatalog(baseValue) && isCatalog(value)
+ ? withFallback(baseValue, value)
+ : value;
+ }
+ return merged;
+}
diff --git a/packages/web/src/i18n/request.ts b/packages/web/src/i18n/request.ts
new file mode 100644
index 000000000..7bdecf1eb
--- /dev/null
+++ b/packages/web/src/i18n/request.ts
@@ -0,0 +1,45 @@
+import { cookies } from "next/headers";
+import { getRequestConfig } from "next-intl/server";
+import { DEFAULT_LOCALE, LOCALE_COOKIE, resolveLocale, type Locale } from "./config";
+import { withFallback } from "./fallback";
+import en from "../../messages/en.json";
+
+/**
+ * next-intl request config — the no-prefix (cookie) strategy.
+ *
+ * There is no i18n routing: the locale is never part of the URL. The server
+ * reads `NEXT_LOCALE` from the request cookies on every render, so a request
+ * carrying `Cookie: NEXT_LOCALE=<tag>` renders that language server-side and
+ * an unset cookie renders English.
+ *
+ * English is the source of truth: a locale catalog is layered on top of
+ * `en.json` (`withFallback`), so a key its translator has not reached yet
+ * renders the English string instead of the raw key or a `MISSING_MESSAGE`
+ * throw. That is what lets UI copy change without every locale being updated
+ * in the same commit.
+ *
+ * Messages are imported statically rather than read from disk at runtime: the
+ * build is `output: "standalone"`, and a `fs.readFile` on a computed path is
+ * not traced into the standalone bundle, so the JSON would be missing in a
+ * production container.
+ */
+const MESSAGES: Record<string, Record<string, unknown>> = {
+ en,
+};
+
+export default getRequestConfig(async ({ requestLocale }) => {
+ // `requestLocale` is the routing-provided locale; with no routing configured
+ // it is undefined, so the cookie is the authority. Kept in the chain so the
+ // config keeps working if prefix routing is ever turned on.
+ const fromRouting = await requestLocale;
+ const fromCookie = (await cookies()).get(LOCALE_COOKIE)?.value;
+ const locale: Locale = resolveLocale(fromRouting ?? fromCookie ?? DEFAULT_LOCALE);
+
+ return {
+ locale,
+ messages: withFallback(en, MESSAGES[locale]),
+ // A fixed zone keeps server and client formatting in agreement; the UI
+ // renders relative times from the API rather than formatting zones itself.
+ timeZone: "UTC",
+ };
+});
diff --git a/packages/web/src/lib/repo-attention.ts b/packages/web/src/lib/repo-attention.ts
index ff4e240a9..a60843298 100644
--- a/packages/web/src/lib/repo-attention.ts
+++ b/packages/web/src/lib/repo-attention.ts
@@ -1,4 +1,5 @@
import type { RepoSummaryRow } from "@repowise-dev/types/repos";
+import en from "../../messages/en.json";
/**
* Ordering and prose for the multi-repo dashboard.
@@ -7,8 +8,37 @@ import type { RepoSummaryRow } from "@repowise-dev/types/repos";
* handful of names the App Router recognises, and these two carry the
* decisions worth pinning — which repo the reader is steered to first, and
* what the page claims when nothing is wrong.
+ *
+ * The prose is translated. `t` is an optional parameter typed as the minimal
+ * translator next-intl's `t` satisfies; calling without it falls back to the
+ * English catalog, which keeps every caller that only wants the English
+ * sentence — and the unit tests with it — working unchanged.
*/
+export type AttentionTranslator = (
+ key: string,
+ values?: Record<string, string | number>,
+) => string;
+
+/** `{name}`-style substitution. Deliberately tiny: these are plain sentences,
+ * not ICU plurals, and keeping it local means the English fallback below has
+ * no dependency on the i18n runtime. */
+function interpolate(
+ template: string,
+ values?: Record<string, string | number>,
+): string {
+ if (!values) return template;
+ return template.replace(/\{(\w+)\}/g, (match, name: string) =>
+ name in values ? String(values[name]) : match,
+ );
+}
+
+const englishAttention: AttentionTranslator = (key, values) =>
+ interpolate(
+ (en.attention as Record<string, string>)[key] ?? key,
+ values,
+ );
+
/** Score to sort a never-analysed repo by. Mid-band on purpose: absent is not
* zero, and sorting it as zero would park every unanalysed repo above the
* genuinely unhealthy one. */
@@ -36,7 +66,10 @@ export function byAttention(a: RepoSummaryRow, b: RepoSummaryRow): number {
* an empty state that says "nothing is wrong" is worth more than one that says
* nothing at all.
*/
-export function attentionSentence(repos: RepoSummaryRow[]): string {
+export function attentionSentence(
+ repos: RepoSummaryRow[],
+ t: AttentionTranslator = englishAttention,
+): string {
const unindexed = repos.filter((r) => r.status !== "indexed");
const behind = repos.filter((r) => r.index_behind === true);
const parts: string[] = [];
@@ -44,16 +77,16 @@ export function attentionSentence(repos: RepoSummaryRow[]): string {
if (unindexed.length > 0) {
parts.push(
unindexed.length === 1
- ? `${unindexed[0].name} has not been indexed yet.`
- : `${unindexed.length} repositories have not been indexed yet.`,
+ ? t("unindexedOne", { name: unindexed[0].name })
+ : t("unindexedMany", { count: unindexed.length }),
);
}
if (behind.length > 0) {
parts.push(
behind.length === 1
- ? `${behind[0].name} is behind its working tree — run repowise update in it to catch up.`
- : `${behind.length} are behind their working trees — run repowise update in them to catch up.`,
+ ? t("behindOne", { name: behind[0].name })
+ : t("behindMany", { count: behind.length }),
);
}
@@ -66,15 +99,18 @@ export function attentionSentence(repos: RepoSummaryRow[]): string {
(a.average_health as number) <= (b.average_health as number) ? a : b,
);
parts.push(
- `Lowest health score is ${(worst.average_health as number).toFixed(1)} out of 10, in ${worst.name}.`,
+ t("lowestScore", {
+ score: (worst.average_health as number).toFixed(1),
+ name: worst.name,
+ }),
);
}
if (parts.length === 0) {
- return "None of them has been analysed yet, so there are no health scores to compare.";
+ return t("nothingAnalysed");
}
if (unindexed.length === 0 && behind.length === 0) {
- return `Every index is current with its checkout. ${parts.join(" ")}`;
+ return t("allCurrent", { parts: parts.join(" ") });
}
return parts.join(" ");
}
diff --git a/packages/web/src/test/rtl-real.d.ts b/packages/web/src/test/rtl-real.d.ts
new file mode 100644
index 000000000..51b964fb0
--- /dev/null
+++ b/packages/web/src/test/rtl-real.d.ts
@@ -0,0 +1,13 @@
+/**
+ * Types for the `@rtl-real` specifier.
+ *
+ * `vitest.config.ts` aliases `@testing-library/react` onto
+ * `src/test/testing-library.tsx`, so that wrapper cannot import the library by
+ * package name (it would resolve to itself). It imports `@rtl-real` instead,
+ * which the same config points at the library's real entry file. TypeScript
+ * does not read that config, so the specifier is declared here as an alias of
+ * the package it stands for.
+ */
+declare module "@rtl-real" {
+ export * from "@testing-library/react";
+}
diff --git a/packages/web/src/test/testing-library.tsx b/packages/web/src/test/testing-library.tsx
new file mode 100644
index 000000000..81ccc3da6
--- /dev/null
+++ b/packages/web/src/test/testing-library.tsx
@@ -0,0 +1,39 @@
+import * as React from "react";
+// Through a private specifier: `@testing-library/react` is aliased to this
+// very file by `vitest.config.ts`, so importing it by package name here would
+// be self-referential.
+import {
+ render as rtlRender,
+ type RenderOptions,
+ type RenderResult,
+} from "@rtl-real";
+import { NextIntlClientProvider } from "next-intl";
+import messages from "../../messages/en.json";
+
+/**
+ * `@testing-library/react` with next-intl wired in.
+ *
+ * Components read their copy through `useTranslations`, which throws when it
+ * is not inside a provider (next-intl "missing-context"). The app mounts
+ * `<NextIntlClientProvider>` in `app/layout.tsx`; a unit test that renders a
+ * component directly has to do the same, or every such suite fails for a
+ * reason that has nothing to do with the code under test.
+ *
+ * `vitest.config.ts` aliases `@testing-library/react` here, so every test gets
+ * the provider without each one repeating the wrapper. An explicit `wrapper`
+ * option is still honoured (it is nested inside the provider).
+ */
+export function render(
+ ui: React.ReactElement,
+ options?: Omit<RenderOptions, "wrapper"> & { wrapper?: React.ComponentType<{ children: React.ReactNode }> },
+): RenderResult {
+ const { wrapper: Outer, ...rest } = options ?? {};
+ const Providers = ({ children }: { children: React.ReactNode }) => (
+ <NextIntlClientProvider locale="en" messages={messages}>
+ {Outer ? <Outer>{children}</Outer> : children}
+ </NextIntlClientProvider>
+ );
+ return rtlRender(ui, { ...rest, wrapper: Providers });
+}
+
+export * from "@rtl-real";
diff --git a/packages/web/vitest.config.ts b/packages/web/vitest.config.ts
index 693d22a67..348a59da1 100644
--- a/packages/web/vitest.config.ts
+++ b/packages/web/vitest.config.ts
@@ -1,6 +1,14 @@
import { defineConfig } from "vitest/config";
+import { createRequire } from "node:module";
import path from "node:path";
+// Resolves to the library's real entry file. The alias below maps the bare
+// `@testing-library/react` specifier onto the wrapper, so the wrapper cannot
+// import it by package name (that would be self-referential) and needs the
+// file path instead. Resolved rather than hard-coded: npm may hoist the
+// package to the workspace root, so a relative path is not stable.
+const require = createRequire(import.meta.url);
+
export default defineConfig({
// `jsx: "preserve"` in tsconfig leaves esbuild on the classic transform, so
// any component that does not import React itself fails to render under
@@ -10,6 +18,21 @@ export default defineConfig({
include: ["src/**/*.{test,spec}.{ts,tsx}"],
},
resolve: {
- alias: { "@": path.resolve(__dirname, "src") },
+ alias: [
+ // Order matters: the wrapper's private specifier is matched before the
+ // generic "@/" entry, which would otherwise swallow it.
+ {
+ find: "@rtl-real",
+ replacement: require.resolve("@testing-library/react/dist/index.js"),
+ },
+ // Components read their copy through `useTranslations`, which throws
+ // outside a provider. Route every test's `render` through a wrapper that
+ // mounts the same `<NextIntlClientProvider>` `app/layout.tsx` does.
+ {
+ find: "@testing-library/react",
+ replacement: path.resolve(__dirname, "src/test/testing-library.tsx"),
+ },
+ { find: /^@\//, replacement: path.resolve(__dirname, "src") + "/" },
+ ],
},
});