feat: i18n fix

This commit is contained in:
Andres 2023-10-19 13:18:38 +02:00
parent d19bf07382
commit 3d67022b38
12 changed files with 25 additions and 31 deletions

View file

@ -50,7 +50,7 @@ function HomeLoggedIn() {
<Typography variant="h5">{t("controllerNetworks")}</Typography>
{networks[0] && t("controllerAddress")}
<Box fontWeight="fontWeightBold">
{networks[0] && String(networks[0]["id"]).slice(0, 10)}
{networks[0] && networks[0]["id"].slice(0, 10)}
</Box>
</Grid>
<Grid item xs="auto">

View file

@ -12,7 +12,6 @@ function LogIn() {
<Divider orientation="vertical" />
</>
)}
&nbsp;
<LogInUser />
</>
);

View file

@ -30,7 +30,7 @@ function AddMember({ nwid, callback }) {
return (
<>
<Typography>{t("addMemberMan")}</Typography>
<Typography>{t("addMemberManually")}</Typography>
<List
disablePadding={true}
style={{

View file

@ -51,7 +51,7 @@ function NetworkSettings({ network, setNetwork }) {
<AccordionDetails>
<Grid container direction="column" spacing={3}>
<Grid item>
<Typography>{t("netId")}</Typography>
<Typography>{t("networkId")}</Typography>
<Typography variant="h5">
<span>{network["config"]["id"]}</span>
</Typography>
@ -129,7 +129,7 @@ function NetworkSettings({ network, setNetwork }) {
color="primary"
onChange={handleChange("config", "enableBroadcast", "checkbox")}
/>
<span>{t("enaBroadcast")}</span>
<span>{t("enableBroadcast")}</span>
</Grid>
{/* TODO: */}
{/* <Grid item>

View file

@ -16,7 +16,7 @@ import { parseValue, replaceValue, setValue } from "utils/ChangeHelper";
import { useTranslation } from "react-i18next";
function SettingsComponent() {
function Settings() {
const { t, i18n } = useTranslation();
const handleChange = () => (event) => {
@ -40,4 +40,4 @@ function SettingsComponent() {
);
}
export default SettingsComponent;
export default Settings;

View file

@ -0,0 +1 @@
export { default } from "./Settings";

View file

@ -1 +0,0 @@
export { default } from "./SettingsComponent";

View file

@ -11,14 +11,12 @@ i18n
.use(Backend)
.init({
compatibilityJSON: "v4",
//lng: "en",
fallbackLng: "en",
detection: {
order: ["path", "cookie", "localStorage", "htmlTag"],
caches: ["localStorage", "cookie"], // cache user language on
caches: ["localStorage", "cookie"],
},
debug: true,
//keySeparator: false, // we use content as keys
interpolation: {
escapeValue: true,
},

View file

@ -1,11 +1,10 @@
import { Grid, Link, Typography } from "@material-ui/core";
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
import SettingsComponent from "components/SettingsComponent";
import SettingsComponent from "components/Settings";
import { useCallback, useEffect, useState } from "react";
import { Link as RouterLink, useHistory, useParams } from "react-router-dom";
import { Link as RouterLink } from "react-router-dom";
import { useLocalStorage } from "react-use";
import API from "utils/API";
import useStyles from "./Settings.styles";
import { useTranslation } from "react-i18next";
@ -13,10 +12,8 @@ import { useTranslation } from "react-i18next";
function Settings() {
const { t, i18n } = useTranslation();
const [loggedIn] = useLocalStorage("loggedIn", false);
const [network, setNetwork] = useState({});
const classes = useStyles();
const history = useHistory();
if (loggedIn) {
return (
@ -45,9 +42,7 @@ function Settings() {
}}
>
<Grid item xs={10}>
<Typography variant="h5">
You are not authorized. Please Log In
</Typography>
<Typography variant="h5">{t("notAuthorized")}</Typography>
</Grid>
</Grid>
);