Repository navigation
Conversation
…panese catalog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves every user-visible string in the app shell, product pages, object browser, uploader, analytics, settings, service accounts, data connections, admin tools and server-action responses into next-intl catalogs, with a Japanese translation for each. Dates and numbers that were pinned to en-US now format in the reader's locale. User content, brand names, API responses and log messages stay as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Claude finished @alukach's task in 20s —— View job ✅ No blocking issues — safe to merge. I read the locale plumbing ( Notes (non-blocking)
Simplify (ponytail)
Docs
💰 Estimated review cost: $0.16 · 0m20s · 6 turns |
A ?lang=ja query parameter on any URL sets the locale cookie the footer switcher writes and redirects to the same URL without the parameter, so a sender can choose the language a link opens in and the parameter isn't passed along when the page is shared again. Unsupported values are dropped without changing anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # jest.config.cjs # src/lib/actions/memberships.ts
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #650.
A user asked for the app in Japanese. This adds next-intl and translates the whole UI (1,056 strings in 139 namespaces) into Japanese, with a language switcher in the footer. It also lays the groundwork so that each additional language is just one more JSON file.
How the locale is chosen
There is no
/ja/...URL prefix. Accounts own the top level of the path (/{account}/{product}), so a locale prefix would collide with any account namedja,deorfr, and it would fight the redirects and rewrites insrc/middleware.ts. Instead,src/i18n/request.tsresolves the locale for each request:NEXT_LOCALEcookie, which the footer'sLocaleSwitcherwrites client-side before callingrouter.refresh(). No server action is involved.Accept-Languageheader.A link can choose the language too:
?lang=jaon any URL is handled insrc/middleware.ts. It sets the same cookie the switcher does and redirects to the same URL without the parameter, so the address bar stays clean and the parameter isn't passed along when the page is shared again. Unsupported values are dropped without changing anything. For example, https://source.coop/products?lang=ja opens the product listing in Japanese.<html lang>follows the chosen locale. Search engines only index the English pages; if localized search results ever matter,?hl=plushreflangcan be added then.What changed
src/i18n/locales.tsholds the locale list and the negotiation logic (unit-tested).src/i18n/request.tsis next-intl's request config.src/global.d.tstypes everyt()key againsten.json, so a typo or a missing key failsnpm run type-check. A test fails ifja.jsonanden.jsondon't have exactly the same keys.src/i18n/messages/{en,ja}.json: the app shell, marketing page, product pages, object browser, uploader, analytics, settings, memberships, service accounts, data connections, admin tools, page metadata, and the messages server actions return to forms. Sentences that used to be built from fragments are now single ICU messages, with placeholders, plurals and rich-text tags, because Japanese word order differs.en-USnow goes through next-intl's formatter in the reader's locale. Server and client format with the same locale and a fixed UTC time zone, so hydration stays deterministic.jest.setup.tsmocksnext-intlandnext-intl/serverwith translators built from the realen.json, so existing assertions on English text keep passing unchanged.Visible changes in English
enlocale default) instead of the hand-built "8 Oct 2026".Left untranslated on purpose
src/app/api, zod schema messages insrc/types(shared with the API), log messages, and OG images.serviceAccountGrantProblem()insrc/lib/accounts/service-accounts.tsis shared by the server actions and the HTTP API, so its two rare service-account grant errors stay English in both. Since feat(api): operations layer, generated OpenAPI docs, and the memberships API #642, membership errors (invite, accept, reject, revoke) also come from the operations layer the API shares, so they stay English as well; only the success messages for invite and revoke are translated.formatBytesunits (KB, MB) are unchanged.Costs to know about
Accept-Languageopts every route out of static rendering. Most app routes were already dynamic throughgetPageSession(). The marketing homepage and/productswere not.NextIntlClientProvidersends all messages for the active locale in the page payload, about 21 KB gzipped for Japanese. Passing each client subtree only the namespaces it uses is the upgrade path if that shows up in page weight.Translations
An LLM produced the Japanese against a fixed glossary (product = プロダクト, organization = 組織, data connection = データ接続, service account = サービスアカウント, restricted = 制限付き, …). It uses polite です/ます for sentences and concise noun forms for buttons and labels. A native speaker should review it before it's announced; the user who asked for Japanese is the obvious reviewer.
Stories
Language toolbar set to 日本語:
Testing
All checks were run against the current head of the branch.
npm run type-checkpasses.npx jest --forceExitpassed 85 suites and 862 tests at 44d2c1c, including the locale negotiation, en/ja key-parity and?lang=middleware tests. After mergingmain(feat(api): operations layer, generated OpenAPI docs, and the memberships API #642), I re-ran type-check plus the membership action and i18n suites, which pass. I haven't re-run the full suite since that merge.npm run lintreports no errors. Twelve touched files have warnings (unused vars, hook deps,no-explicit-any). I spot-checked the unused vars against main, and they were unused there too.storybook buildsucceeds. The stories above were rendered headless with the toolbar set to 日本語; those renders are the screenshots.?lang=ja, pick 日本語 in the footer, or set the browser's language to Japanese with no cookie.Docs and ADRs
docs/using-source/would be a natural follow-up once the translation has been reviewed.public/llms.txt: checked. It lists docs and API tools for agents, which use the English API, so it has no UI-language line to add.🤖 Generated with Claude Code