Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add catalogsMergePath in Lingui Configuration #1881

Merged
merged 8 commits into from
Mar 11, 2024
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
Loading