LazyLocales uses a configuration file at the root of your project. It is created automatically on your first lazylocales translate run, or you can create it manually.
Config file
The CLI looks for one of these files (in order):
lazylocales.config.ts
lazylocales.config.js
lazylocales.config.json
TypeScript (recommended)
import { defineConfig } from 'lazylocales';
export default defineConfig({
projectId: 'proj_abc123',
localesDir: './public/locales',
sourceLocale: 'en',
});
JSON
{
"projectId": "proj_abc123",
"localesDir": "./public/locales",
"sourceLocale": "en"
}
Options
| Option | Type | Required | Description |
|---|
projectId | string | Yes | Your LazyLocales project ID (e.g. proj_abc123) |
localesDir | string | Yes | Relative path to your locales directory |
sourceLocale | string | Yes | BCP 47 code of your source language (e.g. en) |
apiToken | string | No | API token for CI/CD (overrides login session) |
Using API tokens for CI/CD
For non-interactive environments (CI pipelines, servers), set the apiToken option:
import { defineConfig } from 'lazylocales';
export default defineConfig({
projectId: 'proj_abc123',
localesDir: './public/locales',
sourceLocale: 'en',
apiToken: process.env.LAZYLOCALES_API_TOKEN,
});
If you add an apiToken to the config, add the config file to your
.gitignore to avoid leaking the token. Alternatively, always use an
environment variable as shown above.
Context keys
You can provide translation context by adding __context__ keys to your source JSON. These keys are sent to the AI but are not included in the translated output.
{
"greeting": "Hello",
"__context__greeting": "Informal greeting shown on the homepage hero section",
"cta.start": "Get started",
"__context__cta.start": "Call-to-action button, keep it short (max 2 words)"
}
Context keys help the AI produce more accurate translations by understanding where and how each string is used.