init translations

This commit is contained in:
plebeius.eth
2024-02-29 11:41:57 +01:00
parent 71f99ffca5
commit a64de01057
38 changed files with 125 additions and 0 deletions
+1
View File
@@ -2,6 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './app';
import { HashRouter as Router } from 'react-router-dom';
import './lib/init-translations';
import './index.css';
import './themes.css';
import { App as CapacitorApp } from '@capacitor/app';
+114
View File
@@ -0,0 +1,114 @@
import i18next from 'i18next';
import HttpBackend from 'i18next-http-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';
const loadPath = `./translations/{{lng}}/{{ns}}.json`;
i18next
.use(HttpBackend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: 'en',
supportedLngs: [
'af',
'am',
'ar',
'az',
'be',
'bg',
'bn',
'bs',
'ca',
'ckb',
'cs',
'cy',
'da',
'de',
'el',
'en',
'eo',
'es',
'et',
'eu',
'fa',
'fi',
'fr',
'fy',
'ga',
'gd',
'gl',
'gu',
'ha',
'he',
'hi',
'hr',
'ht',
'hu',
'hy',
'id',
'ig',
'is',
'it',
'ja',
'ka',
'kk',
'km',
'kn',
'ko',
'ku',
'ky',
'lb',
'lo',
'lt',
'lv',
'mg',
'mk',
'ml',
'mn',
'mr',
'ms',
'mt',
'my',
'ne',
'nl',
'no',
'or',
'pa',
'pl',
'ps',
'pt',
'ro',
'ru',
'rw',
'si',
'sk',
'sl',
'sn',
'so',
'sq',
'sr',
'sv',
'sw',
'ta',
'te',
'th',
'tl',
'tr',
'ug',
'uk',
'ur',
'uz',
'vi',
'yi',
'yo',
'zh',
'zu',
],
ns: ['default'],
defaultNS: 'default',
backend: { loadPath },
});