steps translation

master
Tudor Stanciu 2020-12-24 02:27:29 +02:00
parent e19b4f6d5c
commit bcee2da91f
5 changed files with 23 additions and 11 deletions

View File

@ -12,6 +12,11 @@
"English": "English", "English": "English",
"Romanian": "Romanian" "Romanian": "Romanian"
}, },
"Steps": {
"Login": "Login",
"Network": "Network",
"Settings": "Settings"
},
"Login": { "Login": {
"Username": "Username", "Username": "Username",
"Password": "Password" "Password": "Password"

View File

@ -3,6 +3,11 @@
"English": "Engleză", "English": "Engleză",
"Romanian": "Română" "Romanian": "Română"
}, },
"Steps": {
"Login": "Autentificare",
"Network": "Rețea",
"Settings": "Setări"
},
"Login": { "Login": {
"Username": "Utilizator", "Username": "Utilizator",
"Password": "Parolă" "Password": "Parolă"

View File

@ -11,6 +11,7 @@ import {
import { useLocation, useHistory } from "react-router-dom"; import { useLocation, useHistory } from "react-router-dom";
import CustomStepConnector from "./CustomStepConnector"; import CustomStepConnector from "./CustomStepConnector";
import StepIcon from "./StepIcon"; import StepIcon from "./StepIcon";
import { useTranslation } from "react-i18next";
const styles = () => ({ const styles = () => ({
stepperCard: { stepperCard: {
@ -29,6 +30,7 @@ const ApplicationStepper = () => {
const classes = useStyles(); const classes = useStyles();
const location = useLocation(); const location = useLocation();
const history = useHistory(); const history = useHistory();
const { t } = useTranslation();
useEffect(() => { useEffect(() => {
const step = steps.find(z => z.route === location.pathname); const step = steps.find(z => z.route === location.pathname);
@ -59,7 +61,9 @@ const ApplicationStepper = () => {
disabled={step.disabled} disabled={step.disabled}
onClick={() => handleStepClick(step)} onClick={() => handleStepClick(step)}
> >
<StepLabel StepIconComponent={StepIcon}>{step.title}</StepLabel> <StepLabel StepIconComponent={StepIcon}>
{t(step.title)}
</StepLabel>
</StepButton> </StepButton>
</Step> </Step>
))} ))}

View File

@ -3,21 +3,21 @@ import { Router, VpnKey, Settings } from "@material-ui/icons";
const steps = [ const steps = [
{ {
id: 0, id: 0,
title: "Login", title: "Steps.Login",
route: "/", route: "/",
disabled: false, disabled: false,
icon: <VpnKey /> icon: <VpnKey />
}, },
{ {
id: 1, id: 1,
title: "Network", title: "Steps.Network",
route: "/network", route: "/network",
disabled: false, disabled: false,
icon: <Router /> icon: <Router />
}, },
{ {
id: 2, id: 2,
title: "Settings", title: "Steps.Settings",
route: "/settings", route: "/settings",
disabled: false, disabled: false,
icon: <Settings /> icon: <Settings />

View File

@ -6,12 +6,10 @@ import App from "./components/App";
import { BrowserRouter as Router } from "react-router-dom"; import { BrowserRouter as Router } from "react-router-dom";
ReactDOM.render( ReactDOM.render(
<React.StrictMode>
<Router basename={process.env.PUBLIC_URL || ""}> <Router basename={process.env.PUBLIC_URL || ""}>
<Suspense fallback={<div>Loading...</div>}> <Suspense fallback={<div>Loading...</div>}>
<App /> <App />
</Suspense> </Suspense>
</Router> </Router>,
</React.StrictMode>,
document.getElementById("root") document.getElementById("root")
); );