Skip to content

Commit cc1b9a2

Browse files
committed
translations: Fixed Settings translations
1 parent 7a865ca commit cc1b9a2

File tree

9 files changed

+32
-18
lines changed

9 files changed

+32
-18
lines changed

frontend/public/locales/EN/translation.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@
4949
"successMessage": "OTP has been set to your chosen platform.",
5050
"disableButton": "Disable 2FA",
5151
"enableButton": "Enable 2FA",
52-
"scanMessage": "Scan this QR code with your authenticator app to set up OTP."
52+
"scanMessage": "Scan this QR code with your authenticator app to set up OTP.",
53+
"requestSent": "A request has been sent."
5354
}
5455
},
5556
"restrictions": {
5657
"username": {
5758
"required": "Username is required.",
5859
"invalidLength": "Username must be 4-16 characters long.",
5960
"invalidCharacters": "Username must contain only alphanumeric characters.",
61+
"invalidFormat": "Username cannot end with '42'.",
6062
"errorKeyword": "Username"
6163
},
6264
"displayName": {
@@ -310,6 +312,7 @@
310312
"privacy": {
311313
"title": "Data Privacy",
312314
"subTitle": "Come back in a few minutes while we prepare your data...",
315+
"downloadingMessage": "Your data is being downloaded...",
313316
"subSections": {
314317
"downloadData": {
315318
"title": "Download Data",
@@ -325,6 +328,7 @@
325328
},
326329
"visibility": {
327330
"title": "Visibility",
331+
"successMessage": "User has been unblocked.",
328332
"subSections": {
329333
"blockedUsers": {
330334
"title": "Blocked Users",

frontend/public/locales/ES/translation.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@
4949
"successMessage": "OTP se ha configurado en la plataforma elegida.",
5050
"disableButton": "Desactivar 2FA",
5151
"enableButton": "Activar 2FA",
52-
"scanMessage": "Escanea este código QR con tu aplicación de autenticación para configurar OTP."
52+
"scanMessage": "Escanea este código QR con tu aplicación de autenticación para configurar OTP.",
53+
"requestSent": "Se ha enviado una solicitud."
5354
}
5455
},
5556
"restrictions": {
5657
"username": {
5758
"required": "Se requiere un nombre de usuario.",
5859
"invalidLength": "El nombre de usuario debe tener entre 4 y 16 caracteres.",
5960
"invalidCharacters": "El nombre de usuario solo puede contener caracteres alfanuméricos.",
61+
"invalidFormat": "El nombre de usuario no puede terminar con '42'.",
6062
"errorKeyword": "Nombre de usuario"
6163
},
6264
"displayName": {
@@ -310,6 +312,7 @@
310312
"privacy": {
311313
"title": "Privacidad de datos",
312314
"subTitle": "Vuelve en unos minutos mientras preparamos tus datos...",
315+
"downloadingMessage": "Tus datos se están descargando...",
313316
"subSections": {
314317
"downloadData": {
315318
"title": "Descargar datos",
@@ -325,6 +328,7 @@
325328
},
326329
"visibility": {
327330
"title": "Visibilidad",
331+
"successMessage": "El usuario ha sido desbloqueado.",
328332
"subSections": {
329333
"blockedUsers": {
330334
"title": "Usuarios bloqueados",

frontend/public/locales/FR/translation.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@
4949
"successMessage": "L'OTP a été configuré sur votre plateforme choisie.",
5050
"disableButton": "Désactiver l'authentification à deux facteurs",
5151
"enableButton": "Activer l'authentification à deux facteurs",
52-
"scanMessage": "Scannez ce code QR avec votre application d'authentification pour configurer l'OTP."
52+
"scanMessage": "Scannez ce code QR avec votre application d'authentification pour configurer l'OTP.",
53+
"requestSent": "Une demande a été envoyée."
5354
}
5455
},
5556
"restrictions": {
5657
"username": {
5758
"required": "Le nom d'utilisateur est requis.",
5859
"invalidLength": "Le nom d'utilisateur doit comporter entre 4 et 16 caractères.",
5960
"invalidCharacters": "Le nom d'utilisateur ne doit contenir que des caractères alphanumériques.",
61+
"invalidFormat": "Le nom d'utilisateur ne peut pas se terminer par '42'.",
6062
"errorKeyword": "Nom d'utilisateur"
6163
},
6264
"displayName": {
@@ -310,6 +312,7 @@
310312
"privacy": {
311313
"title": "Confidentialité des données",
312314
"subTitle": "Revenez dans quelques minutes pendant que nous préparons vos données...",
315+
"downloadingMessage": "Vos données sont en cours de téléchargement...",
313316
"subSections": {
314317
"downloadData": {
315318
"title": "Télécharger les données",
@@ -325,6 +328,7 @@
325328
},
326329
"visibility": {
327330
"title": "Visibilité",
331+
"successMessage": "L'utilisateur a été débloqué.",
328332
"subSections": {
329333
"blockedUsers": {
330334
"title": "Utilisateurs bloqués",

frontend/src/components/Settings/AccountPreferences/AccountPreferences.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const AccountPreferences = ({ user, setUser }) => {
6161
} else if (data.username.length < 4 || data.username.length > 16) {
6262
return t('restrictions.username.invalidLength');
6363
} else if (/42$/.test(data.username)) {
64-
return ('Username cannot end with 42'); // Brandon this needs translation
64+
return t('restrictions.username.invalidFormat');
6565
} else if (/[^a-zA-Z0-9]/.test(data.username)) {
6666
return t('restrictions.username.invalidCharacters');
6767
} else if (data.displayName && (data.displayName.length < 4 || data.displayName.length > 16)) {

frontend/src/components/Settings/Privacy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Privacy = () => {
5555
window.URL.revokeObjectURL(blobUrl);
5656
console.log('Data harvested');
5757
setIsHarvesting(true);
58-
addNotification('success', 'Download started');
58+
addNotification('success', t('settings.privacy.downloadingMessage'));
5959
})
6060
.catch(err => {
6161
addNotification('error', `${err?.response?.data?.error || 'An error occurred'}`);
@@ -68,7 +68,7 @@ const Privacy = () => {
6868
setLoading(true);
6969
API.post('users/@me/harvest')
7070
.then(() => {
71-
addNotification('success', 'Data harvesting scheduled');
71+
addNotification('success', t('settings.privacy.subTitle'));
7272
setIsHarvesting(true);
7373
})
7474
.catch(err => {

frontend/src/components/Settings/Security/2FA/TwoFactorAuthDeactivate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const TwoFactorAuthDeactivate = ({ setShow2FA, setShowQRCode, setIs2FAEnabled })
2929
const handlePlatform = platform => {
3030
API.post('auth/totp/request', { platform })
3131
.then(() => {
32-
addNotification('success', 'Request sent');
32+
addNotification('success', t('auth.twoFactor.requestSent'));
3333
})
3434
.catch(err => {
3535
addNotification('error', `${err?.response?.data?.error || 'An error occurred'}`);

frontend/src/components/Settings/Security/2FA/TwoFactorAuthSecurity.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setShowTwoFactorAuth }) => {
3030
const handlePlatform = useCallback(platform => {
3131
API.post('auth/totp/request', { platform })
3232
.then(() => {
33-
addNotification('success', 'Request sent');
33+
addNotification('success', t('auth.twoFactor.requestSent'));
3434
})
3535
.catch(err => {
3636
addNotification('error', `${err?.response?.data?.error || 'An error occurred'}`);
3737
});
38-
}, [addNotification]);
38+
}, [addNotification, t]);
3939

4040
const handleSubmit = e => {
4141
e.preventDefault();
@@ -46,7 +46,7 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setShowTwoFactorAuth }) => {
4646

4747
API.patch('users/@me/profile', { ...submissionData, otp: authCode })
4848
.then(() => {
49-
addNotification('success', 'Security updated successfully');
49+
addNotification('success', t('settings.security.successMessage'));
5050
getUser()
5151
.then(res => {
5252
setUser(res.data);
@@ -69,7 +69,7 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setShowTwoFactorAuth }) => {
6969
<Backdrop/>
7070
<FormContainer onSubmit={handleSubmit}>
7171
<h1>{t('auth.twoFactor.title')}</h1>
72-
<p>{t('auth.twoFactor.subTitle')} caca</p>
72+
<p>{t('auth.twoFactor.subTitle')}</p>
7373

7474
<OTPInputComponent setAuthCode={setAuthCode} setDisableVerify={setDisableVerify}/>
7575

frontend/src/components/Settings/Security/TwoFactorAuthSecurity.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import { AvailablePlatformsContainer, PlatformButton } from '../../Auth/styles/T
66
import { getUser } from '../../../api/user';
77
import { Backdrop, FormContainer } from '../styles/TwoFactorAuthSecurity.styled';
88
import PongButton from '../../../styles/shared/PongButton.styled';
9+
import { useTranslation } from 'react-i18next';
910

1011
const TwoFactorAuthSecurity = ({ formData, setUser, setSuccess, setShowTwoFactorAuth }) => {
1112
const [availablePlatforms, setAvailablePlatforms] = useState([]);
1213
const [authCode, setAuthCode] = useState('');
1314
const [disableVerify, setDisableVerify] = useState(true);
1415
const [error, setError] = useState('');
16+
const { t } = useTranslation();
1517

1618
useEffect(() => {
1719
API.get('auth/totp/platform_availability')
@@ -49,7 +51,7 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setSuccess, setShowTwoFactor
4951
API.patch('users/@me/profile', { ...submissionData, otp: authCode })
5052
.then(res => {
5153
console.log('2FA: Success');
52-
setSuccess('Security updated successfully');
54+
setSuccess(t('settings.security.successMessage'));
5355
getUser()
5456
.then(res => {
5557
setUser(res.data);
@@ -74,8 +76,8 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setSuccess, setShowTwoFactor
7476
<>
7577
<Backdrop/>
7678
<FormContainer onSubmit={handleSubmit}>
77-
<h1>Two Factor Authentication</h1>
78-
<p>Enter the 6-digit code generated by your chosen platform.</p>
79+
<h1>{t('auth.twoFactor.title')}</h1>
80+
<p>{t('auth.twoFactor.subTitle')}</p>
7981

8082
<OTPInputComponent setAuthCode={setAuthCode} setDisableVerify={setDisableVerify}/>
8183

@@ -92,16 +94,16 @@ const TwoFactorAuthSecurity = ({ formData, setUser, setSuccess, setShowTwoFactor
9294
{platform === "sms" && <i className="bi bi-chat-left-text-fill"/>}
9395
</PlatformButton>
9496
)) : (
95-
<p>No Available Platforms...</p>
97+
<p>{t('auth.twoFactor.noAvailablePlatform')}</p>
9698
)}
9799
</AvailablePlatformsContainer>
98100

99101
<PongButton type="submit" disabled={disableVerify}>
100-
Verify
102+
{t('auth.twoFactor.verifyButton')}
101103
</PongButton>
102104

103105
<PongButton type="button" onClick={() => setShowTwoFactorAuth(false)}>
104-
Back
106+
{t('auth.twoFactor.backButton')}
105107
</PongButton>
106108
</FormContainer>
107109
</>

frontend/src/components/Settings/Visibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const Visibility = () => {
3939
setLoading(true);
4040
API.delete(`users/@me/relationships/${relationshipID}`)
4141
.then(() => {
42-
addNotification('success', 'User unblocked');
42+
addNotification('success', t('settings.visibility.successMessage'));
4343
setIsRefetch(true);
4444
})
4545
.catch(err => {

0 commit comments

Comments
 (0)