mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
init translations
This commit is contained in:
Executable
+10
@@ -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
|
||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import App from './app';
|
import App from './app';
|
||||||
import { HashRouter as Router } from 'react-router-dom';
|
import { HashRouter as Router } from 'react-router-dom';
|
||||||
|
import './lib/init-translations';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import './themes.css';
|
import './themes.css';
|
||||||
import { App as CapacitorApp } from '@capacitor/app';
|
import { App as CapacitorApp } from '@capacitor/app';
|
||||||
|
|||||||
@@ -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 },
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user