feat: localization support#9570
Conversation
e400735 to
d7d35f9
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1bc287c3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds Paraglide JS internationalization (i18n) scaffolding across the SvelteKit frontends (web-local, web-admin) and shared i18n assets/config under web-common, plus a lightweight guard script to prevent reintroducing hardcoded strings in already-migrated areas.
Changes:
- Integrate
@inlang/paraglide-jsvia Vite plugins and SvelteKit hooks; set HTMLlangdynamically at render time. - Introduce
web-common/src/lib/i18n/project scaffolding (inlang project config + initialen.jsonmessage). - Add
build:i18n+ CI quality-step wiring and ani18n-guardheuristic scanner.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| web-local/vite.config.ts | Adds Paraglide Vite plugin to compile i18n output during dev/build. |
| web-local/src/hooks.ts | Adds reroute hook for Paraglide URL delocalization. |
| web-local/src/hooks.server.ts | Adds server handle using Paraglide middleware and injects %lang%. |
| web-local/src/app.html | Switches <html lang> to a %lang% placeholder. |
| web-common/src/lib/i18n/README.md | Adds i18n documentation and conventions for message usage/keys. |
| web-common/src/lib/i18n/messages/en.json | Adds initial base-locale message catalog. |
| web-common/src/lib/i18n/project.inlang/settings.json | Adds inlang project settings for message-format plugin + locales. |
| web-common/src/lib/i18n/project.inlang/README.md | Documents the unpacked inlang project folder contents. |
| web-common/src/lib/i18n/project.inlang/.meta.json | Tracks inlang SDK version metadata. |
| web-common/src/lib/i18n/project.inlang/.gitignore | Adds inlang-generated ignore rules for cache/settings.json. |
| web-admin/vite.config.ts | Adds Paraglide Vite plugin to compile i18n output during dev/build. |
| web-admin/src/routes/[organization]/+page.svelte | Replaces a hardcoded <title> string with a Paraglide message call. |
| web-admin/src/hooks.server.ts | Adds server handle using Paraglide middleware and injects %lang%. |
| web-admin/src/app.html | Switches <html lang> to a %lang% placeholder. |
| scripts/web-test-code-quality.sh | Runs i18n compile + i18n guard as part of quality checks. |
| scripts/i18n-guard.js | Adds a warning-only heuristic scan for hardcoded strings in migrated areas. |
| package.json | Adds build:i18n script and makes root build depend on it; adds @inlang/paraglide-js. |
| package-lock.json | Locks @inlang/paraglide-js and its dependency graph. |
| .prettierignore | Ignores generated Paraglide output and inlang cache. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const reroute: Reroute = (request) => { | ||
| return deLocalizeUrl(request.url).pathname; | ||
| }; |
| See [`MIGRATION.md`](./MIGRATION.md) for the chunked plan to migrate existing | ||
| hardcoded strings. |
|
|
||
| ``` | ||
| lib/i18n/ | ||
| ├── messages/{en,de}.json # source translations (edit these) |
| ``` | ||
|
|
||
| - `messages/en.json` is the base locale and the source of truth for keys. | ||
| - `messages/de.json` is generated via machine translation; do not hand-maintain it. |
| Locale detection uses the `["preferredLanguage", "baseLocale"]` strategy: the | ||
| browser's preferred language, falling back to English. |
| # IF GIT SHOWED THAT THIS FILE CHANGED | ||
| # | ||
| # 1. RUN THE FOLLOWING COMMAND | ||
| # | ||
| # --- | ||
| # git rm --cached '**/*.inlang/.gitignore' | ||
| # --- |
| ```sh | ||
| npm run build:i18n # compile messages/ -> gen/ | ||
| npm run machine-translate # fill in non-English locales from en.json | ||
| ``` |
| "plugin.inlang.messageFormat": { | ||
| "pathPattern": "./messages/{locale}.json" | ||
| } |
Adds just the boilerplate for paraglide i18n integration. Actual string replacements have been reverted and separate PRs will be raised for it.
Checklist: