Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
fix(i18n): fix file type and import
Browse files Browse the repository at this point in the history
fix #1668
  • Loading branch information
ocBruno committed Jan 7, 2020
1 parent 761deda commit 98c25b9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 46 deletions.
45 changes: 0 additions & 45 deletions src/i18n.js

This file was deleted.

26 changes: 26 additions & 0 deletions src/i18n.tsx
@@ -0,0 +1,26 @@
import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';

i18n
// load translation using xhr -> see /public/locales
// learn more: https://github.com/i18next/i18next-xhr-backend
.use(Backend)
// detect user language
// 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
},
});

export default i18n;
2 changes: 1 addition & 1 deletion src/index.tsx
Expand Up @@ -4,7 +4,7 @@ import 'bootstrap/dist/css/bootstrap.min.css'
import './index.css'
import App from './App'
import * as serviceWorker from './serviceWorker'
import './i18n'
import './i18n.tsx'

ReactDOM.render(<App />, document.getElementById('root'))

Expand Down

0 comments on commit 98c25b9

Please sign in to comment.