All error messages in german and in englisch

This commit is contained in:
rxf
2023-05-09 15:37:27 +02:00
parent 2cf418756d
commit 347c6bdc96
17 changed files with 1007 additions and 243 deletions
+24 -1
View File
@@ -3,11 +3,34 @@ import logger from 'morgan'
import express from 'express'
import cookieParser from 'cookie-parser'
import cors from 'cors'
import i18next from 'i18next'
import i18nextMiddleware from 'i18next-http-middleware'
import Backend from 'i18next-node-fs-backend'
const app = express()
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
import indexRouter from './routes/index.js'
import { apiRouter } from './routes/api.js'
import {fileURLToPath} from "url";
import path from "path";
const app = express()
i18next
.use(Backend)
.use(i18nextMiddleware.LanguageDetector)
.init({
backend: {
loadPath: __dirname + '/locales/{{lng}}/{{ns}}.json'
},
fallbackLng: 'de',
debug: false,
preload: ['de', 'en']
});
app.use(i18nextMiddleware.handle(i18next));
app.use(cors())
app.use(logger('dev'))