Lingui Configuration

Configuration is read from 3 different sources (the first found wins):

  • from lingui section in package.json

  • from .linguirc

  • from lingui.config.js

<rootDir> is replaced with base directory of the configuration file.

Default config:

  "lingui": {
    "compileNamespace": "cjs",
    "extractBabelOptions": {},
    "fallbackLocale": "",
    "sourceLocale": "",
    "localeDir": "<rootDir>/locale",
    "srcPathDirs": [
    "srcPathIgnorePatterns": [
    "format": "lingui",


Default: cjs

Specify namespace for exporting compiled messages. See compile command.


Use CommonJS exports:

/* eslint-disable */module.exports={languageData: {"..."}, messages: {"..."}}


Use ES6 default export:

/* eslint-disable */export default{languageData: {"..."}, messages: {"..."}}


Assign compiled messages to window or global object. Specify an identifier after window or global to which the catalog is assigned, e.g. window.i18n.

For example, setting compileNamespace to window.i18n creates file similar to this:

/* eslint-disable */window.i18n={languageData: {"..."}, messages: {"..."}}


Default: {}

Specify extra babel options used to parse source files when messages are being extracted. Not required in most cases.

  "extractBabelOptions": {
    "plugins": ["@babel/plugin-syntax-dynamic-import"]


Default: ''

Translation from fallbackLocale is used when translation for given locale is missing.

If fallbackLocale isn’t defined or translation in fallbackLocale is missing too, either message default or message ID is used instead.


Default: lingui

Format of message catalogs. Possible values are:


Each message is an object composed in the following format:

  "MessageID": {
    "translation": "Translated Message",
    "defaults": "Default string (from source code)",
    "origin": [
      ["path/to/src.js", 42]

Origin is filename and line number from where the message was extracted.

Note that origins may produce a large amount of merge conflicts. Origins can be disabled by setting origins: false in formatOptions.


Simple JSON with message ID -> translation mapping:

   "MessageID": "Translated Message"


Gettext PO file:

#: src/App.js:4, src/Component.js:2
msgid "MessageID"
msgstr "Translated Message"


Default: { origins: true }

Object for configuring message catalog output. See individual formats for options.


Default: ''

Locale of message IDs, which is used in source files. Catalog for sourceLocale doesn’t require translated messages, because message IDs are used by default. However, it’s still possible to override message ID by providing custom translation.

The difference between fallbackLocale and sourceLocale is that fallbackLocale is used in translation, while sourceLocale is used for the message ID.


Default: [<rootDir>]

List of directories with source files from which messages are extracted. Ignored directories are defined in srcPathIgnorePatterns.


Default: ["/node_modules/"]

Ignored paths when looking for source files to extract messages from.


Default: <rootDir>/locale

Directory where message catalogs should be saved.


Default: messageId

Sorting order for catalog files. Possible values are:


Sort by the message ID.


Sort by file origin of the message.