TypeScript Compiler Options
--locale — TypeScript CLI
Changes compiler message language without changing type semantics or generated program output. The language is selected on the command line or by the host, not compilerOptions. In 5.8.3 Japanese and English diagnostics retain TS2322 for the same invalid assignment. Unsupported well-formed language tags may fall back to English; this is not a translation of source or types. Baseline: TypeScript 5.8.3. Commands are run with the pinned local compiler in an isolated directory; omit file labels. CLI-only setting.
Formal Syntax & Structure
typescript syntaxtypescript
tsc --locale <language-tag> --pretty falseParameters & Attributes
| Name | Type | Description |
|---|---|---|
| locale | string | Supported diagnostic language tag, e.g. en or ja; required when the flag is used. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "outDir": "dist" }, "files": [ "index.ts" ]}// File: index.ts (omit this label)export const count: number = "bad";
// Run in a temporary project:// tsc -p . --locale ja --pretty false --noEmit// tsc -p . --locale en --pretty false --noEmit