@sonenta/react-i18next 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,36 @@ npm install @sonenta/react-i18next
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## Drop-in replacement for react-i18next
|
|
23
|
+
|
|
24
|
+
Already on **react-i18next**? Switch in two steps. Your existing
|
|
25
|
+
`useTranslation`, `t()`, and `<Trans>` calls keep working unchanged.
|
|
26
|
+
|
|
27
|
+
**1. Repoint the import** — one find-and-replace across your codebase:
|
|
28
|
+
|
|
29
|
+
```diff
|
|
30
|
+
- import { useTranslation, Trans } from "react-i18next";
|
|
31
|
+
+ import { useTranslation, Trans } from "@sonenta/react-i18next";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**2. Wrap your app once** in `<SonentaProvider>` (replacing `i18next.init` +
|
|
35
|
+
`I18nextProvider`). Translations now load from the Sonenta CDN and missing
|
|
36
|
+
keys stream to your dashboard — everything else stays the same:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { SonentaProvider } from "@sonenta/react-i18next";
|
|
40
|
+
|
|
41
|
+
<SonentaProvider token={…} projectUuid={…} defaultLocale="fr" fallbackLng="en">
|
|
42
|
+
<App />
|
|
43
|
+
</SonentaProvider>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
No `i18next.init`, no backend module, no bundled JSON. See
|
|
47
|
+
[Migrating from react-i18next](#migrating-from-react-i18next) for the full
|
|
48
|
+
compatibility notes.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
22
52
|
## Quickstart
|
|
23
53
|
|
|
24
54
|
```tsx
|
|
@@ -27,8 +57,8 @@ import { SonentaProvider, useTranslation } from "@sonenta/react-i18next";
|
|
|
27
57
|
export function App() {
|
|
28
58
|
return (
|
|
29
59
|
<SonentaProvider
|
|
30
|
-
token={import.meta.env.
|
|
31
|
-
projectUuid={import.meta.env.
|
|
60
|
+
token={import.meta.env.VITE_SONENTA_TOKEN}
|
|
61
|
+
projectUuid={import.meta.env.VITE_SONENTA_PROJECT}
|
|
32
62
|
defaultLocale="fr"
|
|
33
63
|
fallbackLng="en"
|
|
34
64
|
namespaces={["common"]}
|
|
@@ -481,8 +511,8 @@ import { SonentaProvider } from "@sonenta/react-i18next";
|
|
|
481
511
|
export function I18nClient({ children }: { children: React.ReactNode }) {
|
|
482
512
|
return (
|
|
483
513
|
<SonentaProvider
|
|
484
|
-
token={process.env.
|
|
485
|
-
projectUuid={process.env.
|
|
514
|
+
token={process.env.NEXT_PUBLIC_SONENTA_TOKEN!}
|
|
515
|
+
projectUuid={process.env.NEXT_PUBLIC_SONENTA_PROJECT!}
|
|
486
516
|
defaultLocale="fr"
|
|
487
517
|
fallbackLng="en"
|
|
488
518
|
>
|
package/dist/index.cjs
CHANGED
|
@@ -236,7 +236,7 @@ function flattenPlurals(tree, locale) {
|
|
|
236
236
|
|
|
237
237
|
// src/transport.ts
|
|
238
238
|
var SDK_LIB = "@sonenta/react-i18next";
|
|
239
|
-
var SDK_VER = true ? "2.0.
|
|
239
|
+
var SDK_VER = true ? "2.0.1" : "0.0.0-dev";
|
|
240
240
|
function defaultTransport(opts) {
|
|
241
241
|
return async (batch) => {
|
|
242
242
|
if (!batch.length) return;
|
package/dist/index.js
CHANGED
|
@@ -210,7 +210,7 @@ function flattenPlurals(tree, locale) {
|
|
|
210
210
|
|
|
211
211
|
// src/transport.ts
|
|
212
212
|
var SDK_LIB = "@sonenta/react-i18next";
|
|
213
|
-
var SDK_VER = true ? "2.0.
|
|
213
|
+
var SDK_VER = true ? "2.0.1" : "0.0.0-dev";
|
|
214
214
|
function defaultTransport(opts) {
|
|
215
215
|
return async (batch) => {
|
|
216
216
|
if (!batch.length) return;
|