Added i18next-loader to webpack
This commit is contained in:
parent
5ec542143c
commit
ef31851554
7 changed files with 1378 additions and 809 deletions
693
package-lock.json
generated
693
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -15,6 +15,7 @@
|
||||||
"author": "Ajay Bura",
|
"author": "Ajay Bura",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@alienfast/i18next-loader": "^1.1.4",
|
||||||
"@fontsource/inter": "^4.5.11",
|
"@fontsource/inter": "^4.5.11",
|
||||||
"@fontsource/roboto": "^4.5.7",
|
"@fontsource/roboto": "^4.5.7",
|
||||||
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
|
||||||
|
@ -26,11 +27,10 @@
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"flux": "^4.0.3",
|
"flux": "^4.0.3",
|
||||||
"formik": "^2.2.9",
|
"formik": "^2.2.9",
|
||||||
"html-react-parser": "^1.4.14",
|
"html-react-parser": "^2.0.0",
|
||||||
"i18next": "^21.8.9",
|
"i18next": "^21.8.9",
|
||||||
"i18next-browser-languagedetector": "^6.1.4",
|
"i18next-browser-languagedetector": "^6.1.4",
|
||||||
"i18next-http-backend": "^1.4.1",
|
"i18next-http-backend": "^1.4.1",
|
||||||
"html-react-parser": "^2.0.0",
|
|
||||||
"katex": "^0.15.6",
|
"katex": "^0.15.6",
|
||||||
"linkify-html": "^4.0.0-beta.5",
|
"linkify-html": "^4.0.0-beta.5",
|
||||||
"linkifyjs": "^4.0.0-beta.5",
|
"linkifyjs": "^4.0.0-beta.5",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1
public/locales/index.js
Normal file
1
public/locales/index.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
//root pointer
|
|
@ -1,11 +1,9 @@
|
||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
||||||
import Backend from 'i18next-http-backend'
|
import resources from '../../public/locales';
|
||||||
|
|
||||||
i18n
|
i18n
|
||||||
.use(Backend)
|
|
||||||
// detect user language
|
|
||||||
// learn more: https://github.com/i18next/i18next-browser-languageDetector
|
// learn more: https://github.com/i18next/i18next-browser-languageDetector
|
||||||
.use(LanguageDetector)
|
.use(LanguageDetector)
|
||||||
// pass the i18n instance to react-i18next.
|
// pass the i18n instance to react-i18next.
|
||||||
|
@ -13,10 +11,12 @@ i18n
|
||||||
// init i18next
|
// init i18next
|
||||||
// for all options read: https://www.i18next.com/overview/configuration-options
|
// for all options read: https://www.i18next.com/overview/configuration-options
|
||||||
.init({
|
.init({
|
||||||
|
resources,
|
||||||
debug: true,
|
debug: true,
|
||||||
|
fallbackLng: 'en',
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false, // not needed for react as it escapes by default
|
escapeValue: false, // not needed for react as it escapes by default
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|
|
@ -47,6 +47,10 @@ module.exports = {
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
type: 'asset/inline',
|
type: 'asset/inline',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /locales/,
|
||||||
|
loader: '@alienfast/i18next-loader'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,7 +21,8 @@ module.exports = merge(common, {
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'sass-loader',
|
'sass-loader',
|
||||||
],
|
],
|
||||||
},
|
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue