@@ -21,14 +21,16 @@ npm install --save ra-i18n-i18next
21
21
22
22
``` tsx
23
23
import { Admin } from ' react-admin' ;
24
- import { useI18nextProvider , convertRaMessagesToI18next } from ' ra-i18n-i18next' ;
24
+ import { useI18nextProvider , convertRaTranslationsToI18next } from ' ra-i18n-i18next' ;
25
25
import englishMessages from ' ra-language-english' ;
26
26
27
27
const App = () => {
28
28
const i18nProvider = useI18nextProvider ({
29
29
options: {
30
30
resources: {
31
- translations: convertRaMessagesToI18next (englishMessages )
31
+ en: {
32
+ translations: convertRaTranslationsToI18next (englishMessages )
33
+ }
32
34
}
33
35
}
34
36
});
@@ -54,14 +56,16 @@ You can provide your own i18next instance but don't initialize it, the hook will
54
56
55
57
``` tsx
56
58
import { Admin } from ' react-admin' ;
57
- import { useI18nextProvider , convertRaMessagesToI18next } from ' ra-i18n-i18next' ;
59
+ import { useI18nextProvider , convertRaTranslationsToI18next } from ' ra-i18n-i18next' ;
58
60
import englishMessages from ' ra-language-english' ;
59
61
60
62
const App = () => {
61
63
const i18nProvider = useI18nextProvider ({
62
64
options: {
63
65
resources: {
64
- translations: convertRaMessagesToI18next (englishMessages )
66
+ en: {
67
+ translations: convertRaTranslationsToI18next (englishMessages )
68
+ }
65
69
}
66
70
}
67
71
});
@@ -190,7 +194,7 @@ const App = () => {
190
194
};
191
195
```
192
196
193
- ### ` convertRaMessagesToI18next ` function
197
+ ### ` convertRaTranslationsToI18next ` function
194
198
195
199
A function that takes translations from a standard react-admin language package and converts them to i18next format.
196
200
It transforms the following:
@@ -201,9 +205,9 @@ It transforms the following:
201
205
202
206
``` ts
203
207
import englishMessages from ' ra-language-english' ;
204
- import { convertRaMessagesToI18next } from ' ra-i18n-18next' ;
208
+ import { convertRaTranslationsToI18next } from ' ra-i18n-18next' ;
205
209
206
- const messages = convertRaMessagesToI18next (englishMessages );
210
+ const messages = convertRaTranslationsToI18next (englishMessages );
207
211
```
208
212
209
213
#### Parameters
@@ -219,9 +223,9 @@ If you provided interpolation options to your i18next instance, you should provi
219
223
220
224
``` ts
221
225
import englishMessages from ' ra-language-english' ;
222
- import { convertRaMessagesToI18next } from ' ra-i18n-18next' ;
226
+ import { convertRaTranslationsToI18next } from ' ra-i18n-18next' ;
223
227
224
- const messages = convertRaMessagesToI18next (englishMessages , {
228
+ const messages = convertRaTranslationsToI18next (englishMessages , {
225
229
prefix: ' #{' ,
226
230
suffix: ' }#' ,
227
231
});
0 commit comments