Skip to content

Commit 78fb8da

Browse files
author
Dave MacFarlane
committed
Fix Translations
1 parent 559675c commit 78fb8da

File tree

7 files changed

+36
-12
lines changed

7 files changed

+36
-12
lines changed

modules/login/php/mfa.class.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class MFA extends \NDB_Page
5050
[$baseURL . '/login/css/login.css']
5151
);
5252
}
53+
5354
/**
5455
* This function will return a json object for login module.
5556
*

modules/my_preferences/jsx/mfa.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function genPotentialSecret() {
2929
function CodeValidator(props: {
3030
secret: string
3131
}): React.ReactElement {
32+
const {t} = useTranslation();
3233
const formSubmit = useCallback(
3334
(code: string, onError: (msg: string) => void) => {
3435
const formObject = new FormData();
@@ -46,7 +47,12 @@ function CodeValidator(props: {
4647
return resp.json();
4748
}).then( (json) => {
4849
if (json.ok == 'success') {
49-
swal.fire('Success!', json.message, 'success').then( () => {
50+
swal.fire({
51+
title: t('Success!', {ns: 'loris'}),
52+
text: json.message,
53+
type: 'success',
54+
confirmButtonText: t('OK', {ns: 'loris'}),
55+
}).then( () => {
5056
window.location.href = loris.BaseURL + '/my_preferences/';
5157
});
5258
} else if (json.error) {
@@ -60,7 +66,7 @@ function CodeValidator(props: {
6066
}, [props.secret]);
6167
return (
6268
<div>
63-
<h3>Validate Code</h3>
69+
<h3>{t('Validate Code', {ns: 'my_preferences'})}</h3>
6470
<MFAPrompt validate={formSubmit} />
6571
</div>
6672
);
@@ -92,13 +98,16 @@ function MFAIndex(): React.ReactElement {
9298
</Modal>
9399
<p>{t('Scan the following QR code below in your MFA authenticator and enter the code to validate.', {ns: 'my_preferences'})}</p>
94100
<p>
95-
<b>Note that this will <i>overwrite</i> any previously
96-
setup MFA in LORIS!</b>
101+
<strong><Trans
102+
ns="my_preferences"
103+
components={[<strong>overwrite</strong>]}
104+
defaults="Note that this will <0>overwrite</0> any previously setup MFA in LORIS!" /></strong>
97105
</p>
98106
<QRCode value={mfaUrl} />
99-
<p>Can't scan the QR code? <a href="#" onClick={() => setShowModal(true)}>
100-
Setup manually.</a>
101-
</p>
107+
<p><Trans
108+
ns="my_preferences"
109+
defaults="Can't scan the QR code? <0>Setup manually.</0>"
110+
components={[<a href="#" onClick={() => setShowModal(true)} />]} /></p>
102111
<CodeValidator secret={key} />
103112
</div>;
104113
}

modules/my_preferences/locale/ja/LC_MESSAGES/my_preferences.po

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,15 @@ msgstr "認証アプリで次のコードを使用してください: <0>{{code}
6666

6767
msgid "Scan the following QR code below in your MFA authenticator and enter the code to validate."
6868
msgstr "多要素認証システムで以下の QR コードをスキャンし、コードを入力して検証します。"
69+
70+
msgid "Note that this will <0>overwrite</0> any previously setup MFA in LORIS!"
71+
msgstr "これにより、ロリスで以前に設定された多要素認証が <0>上書き</0> されることに注意してください。"
72+
73+
msgid "Can't scan the QR code? <0>Setup manually.</0>"
74+
msgstr "QR コードをスキャンできませんか? <0>手動で設定してください。</0>"
75+
76+
msgid "Validate Code"
77+
msgstr "コードの検証"
78+
79+
msgid "Successfully registered multifactor authenticator"
80+
msgstr "多要素認証の登録に成功しました"

modules/my_preferences/php/mfa.class.inc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class MFA extends \NDB_Page
5555

5656
}
5757
}
58+
5859
/**
5960
* {@inheritDoc}
6061
*
@@ -111,8 +112,12 @@ class MFA extends \NDB_Page
111112
$login = $_SESSION['State']->getProperty('login');
112113
$login->setPassedMFA();
113114
return new \LORIS\Http\Response\JSON\OK(
114-
['ok' => 'success',
115-
'message' => 'Successfully registered multifactor authenticator'
115+
[
116+
'ok' => 'success',
117+
'message' => dgettext(
118+
'my_preferences',
119+
'Successfully registered multifactor authenticator'
120+
)
116121
]
117122
);
118123
}

php/libraries/SinglePointLogin.class.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,5 +623,4 @@ class SinglePointLogin
623623
$_SESSION['PassedMFA'] = true;
624624
session_write_close();
625625
}
626-
627626
}

php/libraries/User.class.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ class User extends UserPermissions implements
689689
return $this->userInfo['Pending_approval'] == 'Y';
690690
}
691691

692-
693692
/**
694693
* Returns a TOTP validator for this account, or null if 2FA
695694
* has never been enabled by the user.

test/unittests/security/TOTP_Test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
class TOTP_Test extends TestCase
1717
{
18-
1918
/**
2019
* Test that test vector counters from RFC6238 pass
2120
*

0 commit comments

Comments
 (0)