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(vite-setup): add missing dependencies and show ts configuration #1556

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions website/docs/tutorials/setup-vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Lingui Vite integration:
1. Install `@lingui/cli`, `babel-plugin-macros` as development dependencies and `@lingui/macro`, `@lingui/react` as a runtime dependency:

```bash npm2yarn
npm install --save-dev @lingui/cli babel-plugin-macros
npm install --save-dev @lingui/cli @lingui/vite-plugin babel-plugin-macros
npm install --save @lingui/react @lingui/macro
```

Expand Down Expand Up @@ -45,7 +45,7 @@ The Lingui Vite integration:
1. Install `@lingui/cli`, `@lingui/swc-plugin` as development dependencies and `@lingui/macro`, `@lingui/react` as a runtime dependency:

```bash npm2yarn
npm install --save-dev @lingui/cli @lingui/swc-plugin
npm install --save-dev @lingui/cli @lingui/vite-plugin @lingui/swc-plugin
npm install --save @lingui/react @lingui/macro
```

Expand All @@ -67,18 +67,20 @@ The Lingui Vite integration:
```
## Further Setup

1. Create a `lingui.config.js` file with LinguiJS configuration in the root of your project (next to `package.json`). Replace `src` with a directory name where you have source files:

```js title="lingui.config.js"
/** @type {import('@lingui/conf').LinguiConfig} */
module.exports = {
locales: ["en", "cs", "fr"],
catalogs: [{
path: "src/locales/{locale}",
include: ["src"]
}],
format: "po"
1. Create a `lingui.config.ts` file with LinguiJS configuration in the root of your project (next to `package.json`). Replace `src` with a directory name where you have source files:

```ts title="lingui.config.ts"
import type { LinguiConfig } from "@lingui/conf"

const config: LinguiConfig = {
locales: ["en", "cs", "fr"],
catalogs: [{
path: "src/locales/{locale}",
include: ["src"]
}],
}

export default config
```

PO format is recommended for message catalogs, and could be compiled on the fly thanks to `@lingui/vite-plugin`.
Expand Down