Skip to content

Commit

Permalink
docs: add catalogsMergePath in Lingui Configuration (#1881)
Browse files Browse the repository at this point in the history
  • Loading branch information
aseerkt authored Mar 11, 2024
1 parent 8d96c7d commit a7ead64
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions website/docs/ref/conf.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Default config:
"exclude": ["**/node_modules/**"]
}
],
"catalogsMergePath": "",
"compileNamespace": "cjs",
"extractorParserOptions": {},
"compilerBabelOptions": {},
Expand Down Expand Up @@ -127,7 +128,7 @@ locales
"catalogs": [
{
"path": "components/{name}/locale/{locale}",
"include": "components/{name}/"
"include": ["components/{name}/"]
}
]
}
Expand Down Expand Up @@ -156,7 +157,7 @@ components/
"catalogs": [
{
"path": "locale/{locale}/{name}",
"include": "components/{name}/"
"include": ["components/{name}/"]
}
]
}
Expand All @@ -180,6 +181,55 @@ components/
└── LoginForm.js
```

## catalogsMergePath

Default: `""`

Specify the path to merge translated catalogs into a single file per locale during compile.

#### Example

Let's assume we have [separate catalogs for `locales: ["en", "cs"]` per component placed inside shared directory](#separate-catalogs-per-component-placed-inside-shared-directory).

Using `catalogsMergePath`, separate catalogs can be merged during [`compile`](/docs/ref/cli.md#compile):

```diff
{
"catalogs": [
{
"path": "/locale/{locale}/{name}",
"include": ["components/{name}/"]
}
],
+ "catalogsMergePath": "locales/{locale}"
}
```

```diff
.
├── locale/
│ ├── en/
│ │ ├── RegistrationForm.po
- │ │ ├── RegistrationForm.js
│ │ ├── LoginForm.po
- │ │ └── LoginForm.js
│ └── cs/
│ ├── RegistrationForm.po
- │ ├── RegistrationForm.js
│ ├── LoginForm.po
- │ └── LoginForm.js
+ ├── locales/
+ │ ├── en.js
+ │ └── cs.js
└── components/
├── RegistrationForm/
│ ├── RegistrationForm.test.js
│ └── RegistrationForm.js
└── LoginForm/
├── LoginForm.test.js
└── LoginForm.js
```

## compileNamespace

Default: `cjs`
Expand Down

0 comments on commit a7ead64

Please sign in to comment.