@dzangolab/react-i18n v0.36.1
Dzangolab React I18n
Adds internationalization to a react app.
Requirements
@dzangolab/react-config: 0.1.0
Installation
pnpm install @dzangolab/react-config @dzangolab/react-i18n
Usage
Setup i18n
In src/main.tsx
:
import i18n from "@dzangolab/react-i18n";
import i18n from "@dzangolab/react-i18n";
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import config from "./config";
i18n(config.i18n);
...
Resources
Create your resources under src/locales/{locale}
.
For each locale, your resource should look like this:
{
"locales": {
"en": "English",
"fr": "Français",
"th": "ไทย"
}
}
Configuration
The package supports the same configuration options as the react-i18next
package.
The configuration options must be defined under the i18n
attribute of your app config (AppConfig
).
# src/config.ts
const config: AppConfig = {
...
i18n: {
fallbackLng: "en",
resources: {
...
},
},
...
};
2 days ago
8 days ago
21 days ago
23 days ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
10 months ago
8 months ago
8 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
8 months ago
6 months ago
10 months ago
7 months ago
10 months ago
9 months ago
8 months ago
8 months ago
10 months ago
5 months ago
7 months ago
7 months ago
10 months ago
10 months ago
12 months ago
1 year ago
12 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
12 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago