From 2eb72654cf59fa2dcd411eb6bcce2a06890c1027 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 17 Jul 2022 13:42:29 -0700 Subject: [PATCH] Load languages.json from http backend --- frontend/src/components/App.js | 4 +- frontend/src/components/BottomBar.js | 6 +- frontend/src/components/i18n.js | 130 ++++++++++++++---- .../{src => static}/locales/CONTRIBUTING.MD | 0 frontend/{src => static}/locales/ca.json | 0 frontend/{src => static}/locales/de.json | 0 frontend/{src => static}/locales/en.json | 0 frontend/{src => static}/locales/es.json | 0 frontend/{src => static}/locales/eu.json | 0 frontend/{src => static}/locales/fr.json | 0 frontend/{src => static}/locales/it.json | 0 frontend/{src => static}/locales/pl.json | 0 frontend/{src => static}/locales/pt.json | 0 frontend/{src => static}/locales/ru.json | 0 frontend/{src => static}/locales/zh.json | 0 15 files changed, 113 insertions(+), 27 deletions(-) rename frontend/{src => static}/locales/CONTRIBUTING.MD (100%) rename frontend/{src => static}/locales/ca.json (100%) rename frontend/{src => static}/locales/de.json (100%) rename frontend/{src => static}/locales/en.json (100%) rename frontend/{src => static}/locales/es.json (100%) rename frontend/{src => static}/locales/eu.json (100%) rename frontend/{src => static}/locales/fr.json (100%) rename frontend/{src => static}/locales/it.json (100%) rename frontend/{src => static}/locales/pl.json (100%) rename frontend/{src => static}/locales/pt.json (100%) rename frontend/{src => static}/locales/ru.json (100%) rename frontend/{src => static}/locales/zh.json (100%) diff --git a/frontend/src/components/App.js b/frontend/src/components/App.js index 2e2c654b..c82b25b9 100644 --- a/frontend/src/components/App.js +++ b/frontend/src/components/App.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component , Suspense } from "react"; import ReactDOM from 'react-dom/client'; import HomePage from "./HomePage"; import { CssBaseline, IconButton , Link} from "@mui/material"; @@ -36,6 +36,7 @@ export default class App extends Component { render() { return ( + @@ -48,6 +49,7 @@ export default class App extends Component { + ); } } diff --git a/frontend/src/components/BottomBar.js b/frontend/src/components/BottomBar.js index de7df16c..2876ccb6 100644 --- a/frontend/src/components/BottomBar.js +++ b/frontend/src/components/BottomBar.js @@ -294,15 +294,17 @@ bottomBarDesktop =()=>{ } LangSelect = () => { - const { i18n} = this.props; + const { i18n } = this.props; + const lang = i18n.resolvedLanguage == null ? 'en' : i18n.resolvedLanguage.substring(0,2); const flagProps = { width: 20, height: 20, }; + return(