Skip to content

Commit 3694e8b

Browse files
committed
[#915] Add Spanish translation to account linking flow
1 parent 0bc8958 commit 3694e8b

File tree

5 files changed

+45
-34
lines changed

5 files changed

+45
-34
lines changed

client/modules/IDE/components/ErrorModal.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ class ErrorModal extends React.Component {
1616
}
1717

1818
oauthError() {
19+
const { t, service } = this.props;
20+
const serviceLabels = {
21+
github: 'GitHub',
22+
google: 'Google'
23+
};
1924
return (
2025
<p>
21-
{'There was a problem linking your GitHub account to your p5.js Web Editor account.'}
22-
{' Your GitHub account has already been linked to another p5.js Web Editor account.'}
26+
{t('ErrorModal.LinkMessage', { serviceauth: serviceLabels[service] })}
2327
</p>
2428
);
2529
}
@@ -63,7 +67,12 @@ class ErrorModal extends React.Component {
6367
ErrorModal.propTypes = {
6468
type: PropTypes.string.isRequired,
6569
closeModal: PropTypes.func.isRequired,
66-
t: PropTypes.func.isRequired
70+
t: PropTypes.func.isRequired,
71+
service: PropTypes.string
72+
};
73+
74+
ErrorModal.defaultProps = {
75+
service: ''
6776
};
6877

6978
export default withTranslation()(ErrorModal);

client/modules/User/components/SocialAuthButton.jsx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ const authUrls = {
1414
google: '/auth/google'
1515
};
1616

17-
const linkLabels = {
18-
github: {
19-
connect: 'Connect GitHub Account',
20-
unlink: 'Unlink GitHub Account'
21-
},
22-
google: {
23-
connect: 'Connect Google Account',
24-
unlink: 'Unlink Google Account'
25-
}
26-
};
27-
2817
const icons = {
2918
github: GithubIcon,
3019
google: GoogleIcon
@@ -35,6 +24,11 @@ const services = {
3524
google: 'google'
3625
};
3726

27+
const servicesLabels = {
28+
github: 'GitHub',
29+
google: 'Google'
30+
};
31+
3832
const StyledButton = styled(Button)`
3933
width: ${remSize(300)};
4034
`;
@@ -43,37 +37,38 @@ function SocialAuthButton({
4337
service, linkStyle, isConnected, t
4438
}) {
4539
const ServiceIcon = icons[service];
46-
const labels = {
47-
github: t('SocialAuthButton.Github'),
48-
google: t('SocialAuthButton.Google')
49-
};
40+
const serviceLabel = servicesLabels[service];
41+
const loginLabel = t('SocialAuthButton.Login', { serviceauth: serviceLabel });
42+
const connectLabel = t('SocialAuthButton.Connect', { serviceauth: serviceLabel });
43+
const unlinkLabel = t('SocialAuthButton.Unlink', { serviceauth: serviceLabel });
44+
const ariaLabel = t('SocialAuthButton.LogoARIA', { serviceauth: service });
5045
const dispatch = useDispatch();
5146
if (linkStyle) {
5247
if (isConnected) {
5348
return (
5449
<StyledButton
55-
iconBefore={<ServiceIcon aria-label={t('SocialAuthButton.LogoARIA', { serviceauth: service })} />}
50+
iconBefore={<ServiceIcon aria-label={ariaLabel} />}
5651
onClick={() => { dispatch(unlinkService(service)); }}
5752
>
58-
{linkLabels[service].unlink}
53+
{unlinkLabel}
5954
</StyledButton>
6055
);
6156
}
6257
return (
6358
<StyledButton
64-
iconBefore={<ServiceIcon aria-label={t('SocialAuthButton.LogoARIA', { serviceauth: service })} />}
59+
iconBefore={<ServiceIcon aria-label={ariaLabel} />}
6560
href={authUrls[service]}
6661
>
67-
{linkLabels[service].connect}
62+
{connectLabel}
6863
</StyledButton>
6964
);
7065
}
7166
return (
7267
<StyledButton
73-
iconBefore={<ServiceIcon aria-label={t('SocialAuthButton.LogoARIA', { serviceauth: service })} />}
68+
iconBefore={<ServiceIcon aria-label={ariaLabel} />}
7469
href={authUrls[service]}
7570
>
76-
{labels[service]}
71+
{loginLabel}
7772
</StyledButton>
7873
);
7974
}

client/modules/User/pages/AccountView.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ class AccountView extends React.Component {
7272

7373
{showError &&
7474
<Overlay
75-
title="Error Linking Account"
76-
ariaLabel="Error Lnking Account"
75+
title={this.props.t('ErrorModal.LinkTitle')}
76+
ariaLabel={this.props.t('ErrorModal.LinkTitle')}
7777
closeOverlay={() => {
7878
browserHistory.push(this.props.location.pathname);
7979
}}
8080
>
8181
<ErrorModal
8282
type="oauthError"
83+
service={errorType}
8384
/>
8485
</Overlay>
8586
}

translations/locales/en-US/translations.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@
6767
"ResetPassword": "Reset your password"
6868
},
6969
"SocialAuthButton": {
70-
"Github": "Login with Github",
71-
"LogoARIA": "{{serviceauth}} logo",
72-
"Google": "Login with Google"
70+
"Connect": "Connect {{serviceauth}} Account",
71+
"Unlink": "Unlink {{serviceauth}} Account",
72+
"Login": "Login with {{serviceauth}}",
73+
"LogoARIA": "{{serviceauth}} logo"
7374
},
7475
"About": {
7576
"Title": "About",
@@ -381,7 +382,9 @@
381382
"SignUp": "Sign Up",
382383
"MessageLoggedOut": "It looks like you've been logged out. Please ",
383384
"LogIn": "log in",
384-
"SavedDifferentWindow": "The project you have attempted to save has been saved from another window.\n Please refresh the page to see the latest version."
385+
"SavedDifferentWindow": "The project you have attempted to save has been saved from another window.\n Please refresh the page to see the latest version.",
386+
"LinkTitle": "Error Linking Account",
387+
"LinkMessage": "There was a problem linking your {{serviceauth}} account to your p5.js Web Editor account. Your {{serviceauth}} account has already been linked to another p5.js Web Editor account."
385388
},
386389
"ShareModal": {
387390
"Embed": "Embed",

translations/locales/es-419/translations.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@
6767
"ResetPassword": "Regenera tu contraseña"
6868
},
6969
"SocialAuthButton": {
70-
"Github": "Ingresa con Github",
71-
"LogoARIA": "Logo de {{serviceauth}}",
72-
"Google": "Ingresa con Google"
70+
"Connect": "Conecta Cuenta {{serviceauth}}",
71+
"Unlink": "Desvincular Cuenta {{serviceauth}}",
72+
"Login": "Ingresa con {{serviceauth}}",
73+
"LogoARIA": "Logo de {{serviceauth}}"
7374
},
7475
"About": {
7576
"Title": "Acerca de",
@@ -381,7 +382,9 @@
381382
"SignUp": "Registráte",
382383
"MessageLoggedOut": "Parece que has salido de tu cuenta. Por favor ",
383384
"LogIn": "ingresa",
384-
"SavedDifferentWindow": " El proyecto que has intentado guardar ha sido guardado desde otra ventana.\n Por favor refresca la página para ver la versión más actual."
385+
"SavedDifferentWindow": " El proyecto que has intentado guardar ha sido guardado desde otra ventana.\n Por favor refresca la página para ver la versión más actual.",
386+
"LinkTitle": "Error Vinculando Cuenta",
387+
"LinkMessage": "Hubo un problema vinculando tu cuenta de {{serviceauth}} con tu cuenta del Editor Web p5.js. Tu cuenta de {{serviceauth}} había sido vinculada previamente con otra cuenta del Editor Web p5.js."
385388
},
386389
"ShareModal": {
387390
"Embed": "Incrustar",

0 commit comments

Comments
 (0)