Compiler Options
This page lists all of the available configuration options for Lingo.dev Compiler. You can set these options when initializing the compiler.
The available options include:
sourceLocale
The locale to translate from.
This must match one of the following formats:
- ISO 639-1 language code (e.g.,
"en"
) - IETF BCP 47 language tag (e.g.,
"en-US"
)
Type
string
Default value
"en"
targetLocales
The locale(s) to translate to.
Each locale must match one of the following formats:
- ISO 639-1 language code (e.g.,
"en"
) - IETF BCP 47 language tag (e.g.,
"en-US"
)
Type
string[]
Default value
["es"]
lingoDir
The name of the directory where translation files will be stored, relative to sourceRoot
.
Type
string
Default value
"lingo"
sourceRoot
The directory of the source code that will be translated, relative to the current working directory.
Type
string
Default value
"src"
rsc
If true
, the compiler will generate code for React Server Components (RSC).
When using Vite, this value is always false
.
When using Next.js, this value is always true
.
Type
boolean
Default value
false
useDirective
If true
, the compiler will only localize files that use the "use i18n";
directive.
Type
boolean
Default value
false
debug
If true
, the compiler will log additional information to the console.
Type
boolean
Default value
false
models
The model(s) to use for translation.
If set to "lingo.dev"
, the compiler will use Lingo.dev Engine.
If set to an object, the compiler will use the model(s) specified in the object:
- The key is a string that represents the source and target locales, separated by a colon (e.g.,
"en:es"
). - The value is a string that represents the LLM provider and model, separated by a colon (e.g.,
"google:gemini-2.0-flash"
).
You can use *
as a wildcard to match any locale.
If a model is not specified, an error will be thrown.
Type
"lingo.dev" | Record<string, string>
Default value
{}