translate network

This commit is contained in:
Proddy
2022-08-28 16:36:04 +02:00
parent 3ea71e1dfb
commit 1ccacdc600
13 changed files with 285 additions and 88 deletions

View File

@@ -37,7 +37,11 @@ import { ValidateFieldsError } from 'async-validator';
import { validate } from '../../validators';
import { createNetworkSettingsValidator } from '../../validators/network';
import { useI18nContext } from '../../i18n/i18n-react';
const WiFiSettingsForm: FC = () => {
const { LL } = useI18nContext();
const { selectedNetwork, deselectNetwork } = useContext(WiFiConnectionContext);
const [initialized, setInitialized] = useState(false);
@@ -112,7 +116,7 @@ const WiFiSettingsForm: FC = () => {
<ValidatedTextField
fieldErrors={fieldErrors}
name="ssid"
label="SSID (leave blank to disable WiFi)"
label={'SSID (' + LL.NETWORK_BLANK_SSID() + ')'}
fullWidth
variant="outlined"
value={data.ssid}
@@ -124,7 +128,7 @@ const WiFiSettingsForm: FC = () => {
<ValidatedPasswordField
fieldErrors={fieldErrors}
name="password"
label="Password"
label={LL.PASSWORD()}
fullWidth
variant="outlined"
value={data.password}
@@ -136,7 +140,7 @@ const WiFiSettingsForm: FC = () => {
<ValidatedTextField
fieldErrors={fieldErrors}
name="tx_power"
label="WiFi Tx Power"
label={'WiFi Tx ' + LL.POWER()}
InputProps={{
endAdornment: <InputAdornment position="end">dBm</InputAdornment>
}}
@@ -150,21 +154,21 @@ const WiFiSettingsForm: FC = () => {
<BlockFormControlLabel
control={<Checkbox name="nosleep" checked={data.nosleep} onChange={updateFormValue} />}
label="Disable WiFi Sleep Mode"
label={LL.NETWORK_DISABLE_SLEEP()}
/>
<BlockFormControlLabel
control={<Checkbox name="bandwidth20" checked={data.bandwidth20} onChange={updateFormValue} />}
label="Use Lower WiFi Bandwidth"
label={LL.NETWORK_LOW_BAND()}
/>
<BlockFormControlLabel
control={<Checkbox name="enableMDNS" checked={data.enableMDNS} onChange={updateFormValue} />}
label="Enable mDNS Service"
label={LL.NETWORK_USE_DNS()}
/>
<Typography sx={{ pt: 2 }} variant="h6" color="primary">
General
{LL.GENERAL_OPTIONS()}
</Typography>
<ValidatedTextField
@@ -180,12 +184,12 @@ const WiFiSettingsForm: FC = () => {
<BlockFormControlLabel
control={<Checkbox name="enableIPv6" checked={data.enableIPv6} onChange={updateFormValue} />}
label="Enable IPv6 support"
label={LL.NETWORK_ENABLE_IPV6()}
/>
<BlockFormControlLabel
control={<Checkbox name="static_ip_config" checked={data.static_ip_config} onChange={updateFormValue} />}
label="Use Fixed IP address"
label={LL.NETWORK_FIXED_IP()}
/>
{data.static_ip_config && (
<>
@@ -250,7 +254,7 @@ const WiFiSettingsForm: FC = () => {
type="submit"
onClick={validateAndSubmit}
>
Save
{LL.SAVE()}
</Button>
</ButtonRow>
</>
@@ -258,7 +262,7 @@ const WiFiSettingsForm: FC = () => {
};
return (
<SectionContent title="Network Settings" titleGutter>
<SectionContent title={LL.NETWORK() + ' ' + LL.SETTINGS()} titleGutter>
{content()}
</SectionContent>
);