Replace i18next-http-backend with i18next-resources-to-backend (#1466)

* Replace i18next-http-backend with i18next-resources-to-backend

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-08-31 22:40:33 +02:00 committed by GitHub
parent dee494386a
commit 7fb7c55877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 30 additions and 24 deletions

View file

@ -1,31 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import Backend from 'i18next-http-backend'
import { Settings } from 'luxon'
import { initReactI18next } from 'react-i18next'
export const setUpI18n = async (frontendAssetsUrl: string): Promise<void> => {
await i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: 'en',
debug: process.env.NODE_ENV !== 'production',
backend: {
loadPath: `${frontendAssetsUrl}locales/{{lng}}.json`
},
interpolation: {
escapeValue: false
}
})
Settings.defaultLocale = i18n.language
}