Skip to content

Commit ee73374

Browse files
committed
feat: i18n
1 parent 2cf3a64 commit ee73374

File tree

8 files changed

+30
-17
lines changed

8 files changed

+30
-17
lines changed

frontend/public/locales/en/common.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,10 @@
5858
"logInFailed": "Invalid username or password",
5959
"tooManyAttempts": "Too many login attempts, please try again in 15 minutes.",
6060
"language": "Language",
61-
"notAuthorized": "You are not authorized. Please Log In."
61+
"notAuthorized": "You are not authorized. Please Log In.",
62+
"saveChanges": "Save changes",
63+
"optional": "Optional",
64+
"destination": "Destination",
65+
"username": "Username",
66+
"password": "Password"
6267
}

frontend/public/locales/es-ES/common.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,17 @@
5151
"start": "Inicio",
5252
"end": "Final",
5353
"autoAssignPool": "Rango de IPv4 autoasignables",
54-
"ipv4AutoAssign": "IPv4 Auto-Assign",
54+
"ipv4AutoAssign": "Rangos de IPv4 automáticos",
5555
"addIPv4Pool": "Añadir rango IPv4",
5656
"multicastLimit": "Límite de destinatarios multicast",
5757
"enableBroadcast": "Habilitar broadcast",
5858
"logInFailed": "Nombre de usuario o contraseña incorrecto",
5959
"tooManyAttempts": "Demasiados intentos de inicio de sesión. Vuelvee a intentarlo en 15 minutos",
6060
"language": "Idioma",
61-
"notAuthorized": "No estás autorizado. Por favor, inicia sesión."
61+
"notAuthorized": "No estás autorizado. Por favor, inicia sesión.",
62+
"saveChanges": "Guardar cambios",
63+
"optional": "Opcional",
64+
"destination": "Destino",
65+
"username": "Nombre de usuario",
66+
"password": "Contraseña"
6267
}

frontend/src/components/LogIn/components/LogInUser/LogInUser.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function LogInUser() {
9191
setUsername(e.target.value);
9292
}}
9393
margin="dense"
94-
label="username"
94+
label={t("username")}
9595
type="username"
9696
fullWidth
9797
/>
@@ -101,7 +101,7 @@ function LogInUser() {
101101
setPassword(e.target.value);
102102
}}
103103
margin="dense"
104-
label="password"
104+
label={t("password")}
105105
type="password"
106106
fullWidth
107107
/>

frontend/src/components/NetworkMembers/components/MemberSettings/MemberSettings.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function MemberSettings({ member, network, handleChange }) {
3333
<BuildIcon style={{ fontSize: 20 }} />
3434
</IconButton>
3535
<Dialog open={open} onClose={handleClose}>
36-
<DialogTitle>{"Member " + member.config.id + " settings"}</DialogTitle>
36+
<DialogTitle>
37+
{t("member") + member.config.id + t("settings")}
38+
</DialogTitle>
3739
<DialogContent>
3840
<Grid item>
3941
<Checkbox

frontend/src/components/NetworkRules/NetworkRules.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function NetworkRules({ network, callback }) {
134134
</Typography>
135135
) : (
136136
<Button variant="contained" color="primary" onClick={saveChanges}>
137-
Save Changes
137+
{t("saveChanges")}
138138
</Button>
139139
)}
140140
</Grid>

frontend/src/components/NetworkSettings/components/IPv4AutoAssign/IPv4AutoAssign.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function IPv4AutoAssign({ ipAssignmentPools, handleChange }) {
145145
<TextField
146146
value={start}
147147
onChange={handleStartInput}
148-
placeholder={"Start"}
148+
placeholder={t("start")}
149149
/>
150150
<Divider
151151
orientation="vertical"
@@ -157,7 +157,7 @@ function IPv4AutoAssign({ ipAssignmentPools, handleChange }) {
157157
<TextField
158158
value={end}
159159
onChange={handleEndInput}
160-
placeholder={"End"}
160+
placeholder={t("end")}
161161
/>
162162
<IconButton
163163
size="small"

frontend/src/components/NetworkSettings/components/ManagedRoutes/ManagedRoutes.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ function ManagedRoutes({ routes, handleChange }) {
7474
},
7575
{
7676
id: "target",
77-
name: "Target",
77+
name: t("target"),
7878
cell: (row) => row["target"],
7979
},
8080
{
8181
id: "via",
82-
name: "via",
82+
name: t("via"),
8383
cell: (row) => (row["via"] ? row["via"] : "(LAN)"),
8484
},
8585
];
@@ -103,7 +103,7 @@ function ManagedRoutes({ routes, handleChange }) {
103103
<TextField
104104
value={destination}
105105
onChange={handleDestinationInput}
106-
placeholder={"Destination (CIDR)"}
106+
placeholder={t("destination") + " (CIDR)"}
107107
/>
108108
<Divider
109109
orientation="vertical"
@@ -115,7 +115,7 @@ function ManagedRoutes({ routes, handleChange }) {
115115
<TextField
116116
value={via}
117117
onChange={handleViaInput}
118-
placeholder={"Via (Optional)"}
118+
placeholder={t("via") + " (" + t("optional") + ")"}
119119
/>
120120
<IconButton size="small" color="primary" onClick={addRouteReq}>
121121
<AddIcon

frontend/src/routes/Network/Network.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import { useLocalStorage } from "react-use";
1111
import API from "utils/API";
1212
import useStyles from "./Network.styles";
1313

14+
import { useTranslation } from "react-i18next";
15+
1416
function Network() {
17+
const { t, i18n } = useTranslation();
1518
const { nwid } = useParams();
1619
const [loggedIn] = useLocalStorage("loggedIn", false);
1720
const [network, setNetwork] = useState({});
@@ -42,7 +45,7 @@ function Network() {
4245
<div className={classes.breadcrumbs}>
4346
<Link color="inherit" component={RouterLink} to="/" underline="none">
4447
<ArrowBackIcon className={classes.backIcon}></ArrowBackIcon>
45-
Networks
48+
{t("network", { count: 2 })}
4649
</Link>
4750
</div>
4851
<div className={classes.container}>
@@ -73,9 +76,7 @@ function Network() {
7376
}}
7477
>
7578
<Grid item xs={10}>
76-
<Typography variant="h5">
77-
You are not authorized. Please Log In
78-
</Typography>
79+
<Typography variant="h5">{t("notAuthorized")}</Typography>
7980
</Grid>
8081
</Grid>
8182
);

0 commit comments

Comments
 (0)