Skip to content

Add i18n foundation with next-intl and translate the sidebar - #1248

Open
sapatmohit wants to merge 1 commit into
HelpCode-ai:mainfrom
sapatmohit:feat/i18n-foundation
Open

sapatmohit wants to merge 1 commit into
HelpCode-ai:mainfrom
sapatmohit:feat/i18n-foundation

Conversation

@sapatmohit

Copy link
Copy Markdown

Summary

First part of #1008, split as suggested in the assignment comment: next-intl without i18n routing, locale resolution, <html lang>, the three message files with a key-parity test, and the sidebar. The sign-in form and the two language switchers follow in a second PR.

next-intl 4.14.9 (latest at the time of writing). Its peer range includes next ^16.0.0, and it runs on the repo's Next 16.4.2: build and the full e2e suite pass.

Changes

  • src/i18n/config.ts: supported locales (en, de, it) and the resolution order: amcp_locale cookie if it holds a supported locale, then the best Accept-Language match by quality (de-AT → de), then en. An unknown cookie value is ignored.
  • src/i18n/request.ts: next-intl request config. Non-English messages are laid over en.json, so a key missing in de/it shows the English text, never the raw key.
  • next.config.ts: createNextIntlPlugin, inside the existing Sentry wrapper. No middleware and no locale prefixes, so proxy.ts, the rewrites and ?redirect= links are unchanged.
  • app/layout.tsx: <html lang> follows the resolved locale; messages are passed once through NextIntlClientProvider around Providers. The layout was already force-dynamic, so reading the cookie per request adds nothing.
  • messages/{en,de,it}.json: nav.* (group titles, items, Settings, Switch workspace, Log out, the Workspace fallback, the Star on GitHub button).
  • lib/navigation.ts: each NAV group and item gets an id used as its message key. The English label stays because the command palette searches it; translating the palette is out of scope here.
  • app-sidebar.tsx and github-star-button.tsx: hard-coded strings replaced with useTranslations('nav'). Hrefs and the active-item logic are untouched.
  • .github/CONTRIBUTING.md: a short "Translating the UI" section.

next-intl 4.14 brings its own dependencies (@swc/core, @parcel/watcher, @formatjs/*), which is most of the package-lock.json diff. @parcel/watcher moves from dev-only to a runtime dependency because of that.

Self-hosted vs Cloud: identical. Frontend only, no backend, database or ee/ change. The language is a per-browser cookie, so members of one workspace can use different languages.

Translations

German and Italian aren't my native languages, so please review those strings. I followed the tone of content/guides/de (Sie, "Connectors", "Marktplatz", "Audit-Log") and content/guides/it (tu, "Connettori", "Impostazioni"). Two translations were shortened to fit the 248px sidebar without truncation: "Stern auf GitHub" / "Stella su GitHub", and "Setup e onboarding".

Light Dark
German
Italian

Type

  • New feature

Testing

New tests/e2e/i18n.spec.ts (7 tests): de-DE renders the sidebar in German with lang="de", it-IT in Italian, fr-FR falls back to English; the amcp_locale cookie wins over Accept-Language; an unsupported cookie value is ignored; de.json and it.json have exactly the keys of en.json.

Commands and results:

Directory Command Result
packages/frontend npm run lint 0 errors, 52 warnings (same 52 as main)
packages/frontend npx tsc --noEmit -p tsconfig.json pass
packages/frontend npm run build pass
packages/frontend npm run test:e2e 264 passed, incl. the 7 new ones and login-redirect-*
packages/backend npm test 22,422 passed, 5 failed

The 5 backend failures are baseline: the same 5 fail on a clean main checkout (database.engine.hana.spec.ts ×2, mcp-endpoint.controller.spec.ts ×2, first-success.service.spec.ts ×1). This PR doesn't touch the backend.

Also checked manually against a local backend: switching amcp_locale between en, de and it and reloading, navigating through the sidebar, the workspace menu, and log out.

  • Added/updated tests
  • Tested manually

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable)
  • All existing tests pass (npm test): frontend yes; backend has the 5 baseline failures above
  • This PR has a descriptive title

packages/frontend/AGENTS.md was rewritten by next dev locally and is left out, as AGENTS.md asks.

Related Issues

Part of #1008

…e-ai#1008)

Sets up next-intl without i18n routing, resolves the language from the
amcp_locale cookie, then Accept-Language, then English, sets <html lang>,
and adds en/de/it messages for the sidebar with a key-parity test.

Part 1 of HelpCode-ai#1008; the sign-in form and language switchers follow.
@github-actions

Copy link
Copy Markdown

👋 Welcome, @sapatmohit, and thanks for opening your first PR on AnythingMCP!

A few quick pointers:

  • Make sure CI is green before requesting review (Backend, Frontend, Playwright, CodeQL, Trivy).
  • If this is a new adapter, the parametrised catalog.spec.ts test will validate it automatically.
  • Sign off your commits if you can — it's not blocking, just nice to have.

Someone from the core team will look at this within ~48h. If you don't hear back, please ping us in Discussions / Q&A.

⭐ While you wait — if you find AnythingMCP useful, a star helps others discover it.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@sapatmohit

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant