Application not translated i18next
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I use i18next and my application is not translated. No message displays and I have none error in the console.
Index.js
import React from 'react';
import ReactDOM from 'react-dom';
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import "assets/scss/material-kit-react.css?v=1.3.0";
import "assets/scss/material-kit-react.css?v=1.3.0";
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import messages_fr from "locales/fr.json";
const hist = createBrowserHistory();
i18next.init(
interpolation: escapeValue: false , // React already does escaping
lng: 'fr', // language to use
resources:
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
</Login>
</I18nextProvider>
), document.getElementById('root')
);
serviceWorker.unregister();
And in my page :
import translate, Trans from 'react-i18next';
<Trans i18nKey='myKey.mySubKey'></Trans>
export default translate('langue')(withStyles(loginPageStyle)(LoginPage));
I don't understant why my text is not.
reactjs internationalization i18next
add a comment |
I use i18next and my application is not translated. No message displays and I have none error in the console.
Index.js
import React from 'react';
import ReactDOM from 'react-dom';
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import "assets/scss/material-kit-react.css?v=1.3.0";
import "assets/scss/material-kit-react.css?v=1.3.0";
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import messages_fr from "locales/fr.json";
const hist = createBrowserHistory();
i18next.init(
interpolation: escapeValue: false , // React already does escaping
lng: 'fr', // language to use
resources:
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
</Login>
</I18nextProvider>
), document.getElementById('root')
);
serviceWorker.unregister();
And in my page :
import translate, Trans from 'react-i18next';
<Trans i18nKey='myKey.mySubKey'></Trans>
export default translate('langue')(withStyles(loginPageStyle)(LoginPage));
I don't understant why my text is not.
reactjs internationalization i18next
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
It is not working
– dna
Nov 19 '18 at 18:46
add a comment |
I use i18next and my application is not translated. No message displays and I have none error in the console.
Index.js
import React from 'react';
import ReactDOM from 'react-dom';
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import "assets/scss/material-kit-react.css?v=1.3.0";
import "assets/scss/material-kit-react.css?v=1.3.0";
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import messages_fr from "locales/fr.json";
const hist = createBrowserHistory();
i18next.init(
interpolation: escapeValue: false , // React already does escaping
lng: 'fr', // language to use
resources:
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
</Login>
</I18nextProvider>
), document.getElementById('root')
);
serviceWorker.unregister();
And in my page :
import translate, Trans from 'react-i18next';
<Trans i18nKey='myKey.mySubKey'></Trans>
export default translate('langue')(withStyles(loginPageStyle)(LoginPage));
I don't understant why my text is not.
reactjs internationalization i18next
I use i18next and my application is not translated. No message displays and I have none error in the console.
Index.js
import React from 'react';
import ReactDOM from 'react-dom';
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import "assets/scss/material-kit-react.css?v=1.3.0";
import "assets/scss/material-kit-react.css?v=1.3.0";
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import messages_fr from "locales/fr.json";
const hist = createBrowserHistory();
i18next.init(
interpolation: escapeValue: false , // React already does escaping
lng: 'fr', // language to use
resources:
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
</Login>
</I18nextProvider>
), document.getElementById('root')
);
serviceWorker.unregister();
And in my page :
import translate, Trans from 'react-i18next';
<Trans i18nKey='myKey.mySubKey'></Trans>
export default translate('langue')(withStyles(loginPageStyle)(LoginPage));
I don't understant why my text is not.
reactjs internationalization i18next
reactjs internationalization i18next
asked Nov 16 '18 at 11:41
dnadna
2315
2315
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
It is not working
– dna
Nov 19 '18 at 18:46
add a comment |
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
It is not working
– dna
Nov 19 '18 at 18:46
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
It is not working
– dna
Nov 19 '18 at 18:46
It is not working
– dna
Nov 19 '18 at 18:46
add a comment |
2 Answers
2
active
oldest
votes
I made as this but my application always stays in English while the language of my browser is French.
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
lng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
|
show 1 more comment
My index.js :
import React from 'react';
import ReactDOM from 'react-dom';
import Router, Route, Switch, Redirect from "react-router-dom";
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import indexRoutes from "routes/index.jsx";
import messages_en from "locales/en.json";
import messages_fr from "locales/fr.json";
import LanguageDetector from 'i18next-browser-languagedetector';
const hist = createBrowserHistory();
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
fallbackLng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
<Router history=hist>
<Switch>
indexRoutes.map((prop, key) =>
if (prop.redirect)
return <Redirect from=prop.path to=prop.to key=key />;
return <Route path=prop.path component=prop.component key=key />;
)
</Switch>
</Router>
</I18nextProvider>
), document.getElementById('root'));
serviceWorker.unregister();
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337175%2fapplication-not-translated-i18next%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I made as this but my application always stays in English while the language of my browser is French.
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
lng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
|
show 1 more comment
I made as this but my application always stays in English while the language of my browser is French.
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
lng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
|
show 1 more comment
I made as this but my application always stays in English while the language of my browser is French.
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
lng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
I made as this but my application always stays in English while the language of my browser is French.
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
lng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
answered Nov 19 '18 at 11:42
dnadna
2315
2315
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
|
show 1 more comment
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
Try fallbackLng: 'en' instead of lng: ‘en’
– adrai
Nov 19 '18 at 18:52
I'm the same result
– dna
Nov 20 '18 at 8:52
I'm the same result
– dna
Nov 20 '18 at 8:52
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Help please it is urgent
– dna
Nov 20 '18 at 20:45
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
Can you setup a codesandbox.io example?
– adrai
Nov 20 '18 at 21:24
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
My applipcation does not detect the language of the browser and rest in English. Key of the files of translation are found well by the application
– dna
Nov 20 '18 at 22:22
|
show 1 more comment
My index.js :
import React from 'react';
import ReactDOM from 'react-dom';
import Router, Route, Switch, Redirect from "react-router-dom";
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import indexRoutes from "routes/index.jsx";
import messages_en from "locales/en.json";
import messages_fr from "locales/fr.json";
import LanguageDetector from 'i18next-browser-languagedetector';
const hist = createBrowserHistory();
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
fallbackLng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
<Router history=hist>
<Switch>
indexRoutes.map((prop, key) =>
if (prop.redirect)
return <Redirect from=prop.path to=prop.to key=key />;
return <Route path=prop.path component=prop.component key=key />;
)
</Switch>
</Router>
</I18nextProvider>
), document.getElementById('root'));
serviceWorker.unregister();
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
add a comment |
My index.js :
import React from 'react';
import ReactDOM from 'react-dom';
import Router, Route, Switch, Redirect from "react-router-dom";
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import indexRoutes from "routes/index.jsx";
import messages_en from "locales/en.json";
import messages_fr from "locales/fr.json";
import LanguageDetector from 'i18next-browser-languagedetector';
const hist = createBrowserHistory();
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
fallbackLng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
<Router history=hist>
<Switch>
indexRoutes.map((prop, key) =>
if (prop.redirect)
return <Redirect from=prop.path to=prop.to key=key />;
return <Route path=prop.path component=prop.component key=key />;
)
</Switch>
</Router>
</I18nextProvider>
), document.getElementById('root'));
serviceWorker.unregister();
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
add a comment |
My index.js :
import React from 'react';
import ReactDOM from 'react-dom';
import Router, Route, Switch, Redirect from "react-router-dom";
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import indexRoutes from "routes/index.jsx";
import messages_en from "locales/en.json";
import messages_fr from "locales/fr.json";
import LanguageDetector from 'i18next-browser-languagedetector';
const hist = createBrowserHistory();
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
fallbackLng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
<Router history=hist>
<Switch>
indexRoutes.map((prop, key) =>
if (prop.redirect)
return <Redirect from=prop.path to=prop.to key=key />;
return <Route path=prop.path component=prop.component key=key />;
)
</Switch>
</Router>
</I18nextProvider>
), document.getElementById('root'));
serviceWorker.unregister();
My index.js :
import React from 'react';
import ReactDOM from 'react-dom';
import Router, Route, Switch, Redirect from "react-router-dom";
import I18nextProvider from 'react-i18next';
import i18next from 'i18next';
import * as serviceWorker from './serviceWorker';
import createBrowserHistory from "history";
import indexRoutes from "routes/index.jsx";
import messages_en from "locales/en.json";
import messages_fr from "locales/fr.json";
import LanguageDetector from 'i18next-browser-languagedetector';
const hist = createBrowserHistory();
i18next
.use(LanguageDetector)
.init(
interpolation: escapeValue: false ,
fallbackLng: 'en',
resources:
en:
langue: messages_en
,
fr:
langue: messages_fr
,
,
);
ReactDOM.render((
<I18nextProvider i18n=i18next>
<Router history=hist>
<Switch>
indexRoutes.map((prop, key) =>
if (prop.redirect)
return <Redirect from=prop.path to=prop.to key=key />;
return <Route path=prop.path component=prop.component key=key />;
)
</Switch>
</Router>
</I18nextProvider>
), document.getElementById('root'));
serviceWorker.unregister();
answered Nov 21 '18 at 10:12
dnadna
2315
2315
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
add a comment |
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
I solved my problem. My navigator had to keep in hiding place the data of my application and had of the blow to keep English as language. By emptying the mask, it detects well the language of my browser
– dna
Nov 21 '18 at 13:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337175%2fapplication-not-translated-i18next%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Help please, It's urgent
– dna
Nov 16 '18 at 13:07
can you create a sample on codesandbox.io or similar? and add debug: true in the init options? after that perhaps you will see some hints in the console
– adrai
Nov 17 '18 at 20:57
I solved the problem. It came from my files badly formated json. Now I try to take the language by default of the browser and when I change the language of the browser, when it changes the language of my application. But I not how find to make
– dna
Nov 17 '18 at 22:43
github.com/i18next/i18next-browser-languageDetector
– adrai
Nov 18 '18 at 10:04
It is not working
– dna
Nov 19 '18 at 18:46