Repository navigation
CLI
📄 Mirrors
docs/cli.mdin the main repo — the repo version is canonical.
Status: planned / pre-release. This page documents the intended API of next-tongue. Nothing is published yet; names may change before v1.0. See ROADMAP.
Binary: tongue (via npx tongue or a package.json script). Every command reads tongue.config.ts, supports --config <path>, --cwd <dir>, --json (machine-readable output) and --quiet. Exit codes: 0 ok, 1 check failures, 2 usage/config error.
Runs codegen: compiles messages (files + build-time sources) into .tongue/ and writes types. The same step withTongue runs at next.config load; use it in CI before tsc/tests. Flags: --watch, --watch-sources <seconds>.
The CLI uses only Node built-ins (util.parseArgs, readline, fs, global fetch) (ADR 0012).
Scaffolds config, messages, proxy.ts, [locale] layout and withTongue (see Getting started).
Writes export const generateStaticParams = localeParams in the root [locale] layout.
Flags: --locales en,de, --default en, --prefix always|as-needed|never, --export (static-export setup, prefix: 'always'), --yes (non-interactive), --dry-run.
Refuses to overwrite existing files unless --force; prints a diff in --dry-run.
Scans source (app/, src/, components/ by default; --include glob) for t(), t.rich(), useT() and getT() calls and:
- adds keys found in code but missing from the default-locale file (value = key, or
--placeholder ''), - reports keys in files but unused in code (
--pruneremoves them, after confirmation), - regenerates
.tongue/types.d.ts(same astongue build).
CI gate. Reads messages + source, reports:
| Check | Meaning | Severity from |
|---|---|---|
missing |
Key in default locale but absent in another locale | strict.missing |
unused |
Key in messages, never referenced in code | strict.unused |
undefined |
Key referenced in code, absent in default locale | always error
|
mismatch |
ICU args, tags or plural categories differ from default locale | strict.mismatch |
syntax |
ICU parse error | always error
|
stale |
Source text changed since the target was translated (source hashes in tongue.lock) |
strict.stale (default warn) |
length (v0.4) |
Target longer than $meta.maxLength
|
strict.length (default warn) |
a11y (v0.4) |
Root layout <html> missing lang={locale} or dir={getDir(locale)}; RTL locales without dir
|
strict.a11y (default error) |
bidi (v0.4) |
RTL messages with unbalanced bidi controls, LTR-only punctuation around args, or args that need isolation (\u2068…\u2069) |
strict.bidi (default warn) |
Flags: --locale de, --reporter pretty|json|github (github emits workflow annotations), --max-warnings 0.
# .github/workflows/i18n.yml
- run: npx tongue check --reporter githubFills missing/stale target messages using an LLM. See AI translation.
Flags: --locale de,fr, --keys 'home.*', --dry-run, --yes, --concurrency 4, --retranslate (ignore lock), --review (write to messages/{locale}.review.json instead of in place), --accept (merge reviewed *.review.json files into messages and update the lock).
XLIFF 2.0 and CSV round-trip for translators. See Translator workflow.
Per-route keys and bytes sent to the client, from next build output. See Dev tools.
Deferred: the codemod ships after v1.0 (#31). Until then follow the manual guide. The next-international codemod is dropped.
Guides
- Getting Started
- Configuration
- Routing and Proxy
- Server Components
- Client Components
- Server Actions
- ICU Messages
- Type Safety
- Cache Components and PPR
- Static Export
- Metadata SEO and hreflang
- Database and CMS Messages
- Dev Tools
- Translator Workflow
- Per-user Preferred Language
- CLI
- AI Translation
- Testing
- VS Code Extension
- Migration from next intl
- Migration from next international (deferred)
Reference