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
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# Array of languages
languages=('ar' 'bn' 'cs' 'da' 'de' 'el' 'en' 'es' 'fa' 'fi' 'fil' 'fr' 'he' 'hi' 'hu' 'id' 'it' 'ja' 'ko' 'mr' 'nl' 'no' 'pl' 'pt' 'ro' 'ru' 'sq' 'sv' 'te' 'th' 'tr' 'uk' 'ur' 'vi' 'zh')
# Create directories and default.json files
for lang in "${languages[@]}"; do
mkdir -p "$lang"
touch "$lang/default.json"
done
View File
View File
View File
View File
View File
View File
View File
View File
View File
+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 },
});