Site translation
Generate new website locales locally with an OpenAI-compatible model.
Scope
The translation generator is a local development tool. It writes files into the repository so a developer can review, format, type-check and commit the new locale. It is not intended to run on Vercel or inside production runtime code.
It can translate:
packages/i18n/src/messages/<locale>.jsonapps/web/src/content/blog/<locale>/*.mdxapps/web/src/content/pages/<locale>/*.mdxapps/web/src/content/projects/<locale>/*.mdxapps/web/src/content/snippet/<locale>/*.mdx
Environment
Use placeholder values in shared docs and commit history. Real keys belong only in .env.local.
Dry run
Start with a dry run. It resolves locale aliases, counts batches and shows which registry files would be updated.
Useful aliases:
jp resolves to ja; cn and zh resolve to zh-CN.
Batch profiles
Use the smallest profile that keeps the provider stable. Context window is not the only limit; some OpenAI-compatible endpoints time out on large requests even when the model has enough context.
Profiles:
small: 4000 chars per batch. Best for slower models, proxy gateways and timeout-prone endpoints.medium: 12000 chars per batch. Good default for fast hosted models with stable latency.large: 32000 chars per batch. Use only for large-context models and providers that tolerate long requests.
For a precise override:
Narrowing work
Translate a subset when validating a new provider.
Supported collections are messages, blog, pages, projects and snippet.
Review checklist
- Run
pnpm build:mdxafter generating files. - Review translated MDX for frontmatter, links, code blocks and JSX.
- Run
pnpm check. - Run
pnpm test:unit. - Run the web build before deploy when route or content generation changed.