lossless-cut/src/i18n.js

38 wiersze
1.1 KiB
JavaScript
Czysty Zwykły widok Historia

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const Backend = window.require('i18next-fs-backend');
2022-11-22 15:23:41 +00:00
const remote = window.require('@electron/remote');
const { commonI18nOptions, fallbackLng, loadPath, addPath } = remote.require('./i18n-common');
export { fallbackLng };
2020-05-02 15:27:46 +00:00
// https://github.com/i18next/i18next/issues/869
i18n
.use(Backend)
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
2021-08-23 11:09:48 +00:00
// LanguageDetector is disabled because many users are used to english, and I cannot guarantee the status of all the translations so it's best to default to engligh https://github.com/mifi/lossless-cut/issues/346
2020-05-06 06:27:53 +00:00
// .use(LanguageDetector)
// pass the i18n instance to react-i18next.
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
// See also i18next-scanner.config.js
.init({
...commonI18nOptions,
backend: {
loadPath,
addPath,
},
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
});
export default i18n;