Skip to content

Commit

Permalink
fix(i18n): init method returns a promise
Browse files Browse the repository at this point in the history
before start, the app has to start all is ready
  • Loading branch information
Francisco Moreno Cantero committed Jun 5, 2020
1 parent 8cc5a42 commit 92841f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
12 changes: 1 addition & 11 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ i18n
// learn more: https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector)
// pass the i18n instance to react-i18next.
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
fallbackLng: 'en',
debug: true,

interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
});
.use(initReactI18next);

export default i18n;
24 changes: 18 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './i18n';
import i18n from './i18n';

ReactDOM.render(
<App />,
document.getElementById('app'), // eslint-disable-line no-undef
);
i18n
.init({
lng: 'es',
fallbackLng: 'en',
debug: process.env.NODE_ENV === 'development',
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
initImmediate: false
})
.then(() => {
ReactDOM.render(
<App />,
document.getElementById('app'), // eslint-disable-line no-undef
);

module.hot.accept();
module.hot.accept();
});

0 comments on commit 92841f4

Please sign in to comment.