Added i18next-loader to webpack

This commit is contained in:
Dylan 2022-07-17 12:12:12 +09:30
parent 5ec542143c
commit ef31851554
7 changed files with 1378 additions and 809 deletions

693
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
"author": "Ajay Bura",
"license": "MIT",
"dependencies": {
"@alienfast/i18next-loader": "^1.1.4",
"@fontsource/inter": "^4.5.11",
"@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",
@ -26,11 +27,10 @@
"file-saver": "^2.0.5",
"flux": "^4.0.3",
"formik": "^2.2.9",
"html-react-parser": "^1.4.14",
"html-react-parser": "^2.0.0",
"i18next": "^21.8.9",
"i18next-browser-languagedetector": "^6.1.4",
"i18next-http-backend": "^1.4.1",
"html-react-parser": "^2.0.0",
"katex": "^0.15.6",
"linkify-html": "^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
View file

@ -0,0 +1 @@
//root pointer

View file

@ -1,11 +1,9 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend'
import resources from '../../public/locales';
i18n
.use(Backend)
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector)
// pass the i18n instance to react-i18next.
@ -13,10 +11,12 @@ i18n
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
resources,
debug: true,
fallbackLng: 'en',
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
}
},
});
export default i18n;

View file

@ -47,6 +47,10 @@ module.exports = {
{
test: /\.svg$/,
type: 'asset/inline',
},
{
test: /locales/,
loader: '@alienfast/i18next-loader'
}
],
},

View file

@ -21,7 +21,8 @@ module.exports = merge(common, {
'css-loader',
'sass-loader',
],
},
}
],
},
});