Skip to content

Commit 258cfcc

Browse files
guilbillAijeyomah
authored andcommitted
fix: use correct function name convertRaTranslationsToI18next and fix ts error in examples
1 parent 3e581dc commit 258cfcc

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/ra-i18n-i18next/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ npm install --save ra-i18n-i18next
2121

2222
```tsx
2323
import { Admin } from 'react-admin';
24-
import { useI18nextProvider, convertRaMessagesToI18next } from 'ra-i18n-i18next';
24+
import { useI18nextProvider, convertRaTranslationsToI18next } from 'ra-i18n-i18next';
2525
import englishMessages from 'ra-language-english';
2626

2727
const App = () => {
2828
const i18nProvider = useI18nextProvider({
2929
options: {
3030
resources: {
31-
translations: convertRaMessagesToI18next(englishMessages)
31+
en: {
32+
translations: convertRaTranslationsToI18next(englishMessages)
33+
}
3234
}
3335
}
3436
});
@@ -54,14 +56,16 @@ You can provide your own i18next instance but don't initialize it, the hook will
5456

5557
```tsx
5658
import { Admin } from 'react-admin';
57-
import { useI18nextProvider, convertRaMessagesToI18next } from 'ra-i18n-i18next';
59+
import { useI18nextProvider, convertRaTranslationsToI18next } from 'ra-i18n-i18next';
5860
import englishMessages from 'ra-language-english';
5961

6062
const App = () => {
6163
const i18nProvider = useI18nextProvider({
6264
options: {
6365
resources: {
64-
translations: convertRaMessagesToI18next(englishMessages)
66+
en: {
67+
translations: convertRaTranslationsToI18next(englishMessages)
68+
}
6569
}
6670
}
6771
});
@@ -190,7 +194,7 @@ const App = () => {
190194
};
191195
```
192196

193-
### `convertRaMessagesToI18next` function
197+
### `convertRaTranslationsToI18next` function
194198

195199
A function that takes translations from a standard react-admin language package and converts them to i18next format.
196200
It transforms the following:
@@ -201,9 +205,9 @@ It transforms the following:
201205

202206
```ts
203207
import englishMessages from 'ra-language-english';
204-
import { convertRaMessagesToI18next } from 'ra-i18n-18next';
208+
import { convertRaTranslationsToI18next } from 'ra-i18n-18next';
205209

206-
const messages = convertRaMessagesToI18next(englishMessages);
210+
const messages = convertRaTranslationsToI18next(englishMessages);
207211
```
208212

209213
#### Parameters
@@ -219,9 +223,9 @@ If you provided interpolation options to your i18next instance, you should provi
219223

220224
```ts
221225
import englishMessages from 'ra-language-english';
222-
import { convertRaMessagesToI18next } from 'ra-i18n-18next';
226+
import { convertRaTranslationsToI18next } from 'ra-i18n-18next';
223227

224-
const messages = convertRaMessagesToI18next(englishMessages, {
228+
const messages = convertRaTranslationsToI18next(englishMessages, {
225229
prefix: '#{',
226230
suffix: '}#',
227231
});

0 commit comments

Comments
 (0)