Config Reference

The inlang config file makes use of JSON Schema for auto-complete and validation. The JSON Schema definitions can be found here.

Example

See how the examplary config below is used by one of the examples in the awesome-fluent-i18n repository here.

{
  "$schema": "https://raw.githubusercontent.com/inlang/inlang/main/packages/config/src/schemas/v0.1.json",
  "fileFormat": "fluent",
  "pathPattern": "./static/translations/{languageCode}.ftl",
  "baseLanguageCode": "en",
  "extractPatternReplacementOptions": [
    "$t('{id}')",
    "{$t('{id}')}",
    "{@html $t('{id}')}"
  ],
  "fetchI18nDetectionGrammarFrom": "https://raw.githubusercontent.com/inlang/inlang/main/packages/i18n-detection/src/grammars/t-function.pegjs"
}

Properties

$schema

type string;

/**
 * A link to the JSON schema.
 *
 * Go to https://github.com/inlang/inlang/tree/main/packages/config/src/schemas to see a list of all schemas.
 *
 * Using a schema enables auto-complete and linting in most IDE's via https://json-schema.org/.
 * Furthermore, defining a version of the config file allows for changes down the line with auto-migration scripts.
 */

fileFormat

type string;

/**
* The file format of the local translation files.
*
* Any other file format than Fluent makes use of a converter.
* Read more about converters and their limitations here https://inlang.dev/architecture/overview#support-for-file-formats-other-than-fluent.
*/

pathPattern

type string;

/**
* Where and how the local translation files are saved.
*
* Use '{languageCode}' as dynamic value.
* @examples
* 		`./translations/{languageCode}.json`
* 		`./{languageCode}/Localizable.strings`
*/

fetchI18nDetectionGrammarFrom?

type string | undefined;

/**
* A link to the pegjs grammar to detect the usage of i18n (translations) in the source code.
*
* Go to https://github.com/inlang/inlang/tree/main/packages/i18n-detection/src/grammars for predefined grammars.
*
* Using a link offers flexibility to define own grammars for specific environments. Go to
*/

extractPatternReplacementOptions?

type string | undefined;

/**
* The replacement options when extracting pattern.
*
* Must include `{id}` in all options.
* @example
* 		['t("{id}")', 'i18n.{id}']
*/

baseLanguageCode?

type string | undefined;

/**
* An ISO 639-1 human language code that determines the base language.
*/