@@ -5,7 +5,7 @@ import QRCode from 'react-qr-code';
55import * as base32 from 'hi-base32' ;
66import Modal from 'Modal' ;
77import MFAPrompt from 'jsx/MFAPrompt' ;
8- import { withTranslation } from 'react-i18next' ;
8+ import { useTranslation , Trans } from 'react-i18next' ;
99import i18n from 'I18nSetup' ;
1010
1111declare const loris : any ;
@@ -71,6 +71,7 @@ function CodeValidator(props: {
7171function MFAIndex ( ) : React . ReactElement {
7272 const [ showModal , setShowModal ] = useState < boolean > ( false ) ;
7373 const [ key ] = useState < string > ( genPotentialSecret ( ) ) ;
74+ const { t} = useTranslation ( ) ;
7475 const studyTitle = loris . config ( 'studyTitle' ) ;
7576 const mfaUrl = 'otpauth://totp/'
7677 + encodeURI ( studyTitle )
@@ -83,7 +84,10 @@ function MFAIndex(): React.ReactElement {
8384 onClose = { ( ) => setShowModal ( false ) }
8485 show = { showModal }
8586 throwWarning = { false } >
86- < p > Use the following key in your authenticator app: < b > { key } </ b > </ p >
87+ < Trans
88+ defaults = "<p>Use the following key in your authenticator app: <b>{{code}}</b></p>"
89+ values = { { code : key } } >
90+ </ Trans >
8791 </ Modal >
8892 < p > Scan the following QR code below in your MFA authenticator and
8993 enter the code to validate.</ p >
@@ -102,15 +106,12 @@ function MFAIndex(): React.ReactElement {
102106window . addEventListener ( 'load' , ( ) => {
103107 i18n . addResourceBundle ( 'ja' , 'my_preferences' , require ( "../locale/ja/LC_MESSAGES/my_preferences.json" ) ) ;
104108 i18n . addResourceBundle ( 'hi' , 'my_preferences' , require ( "../locale/ja/LC_MESSAGES/my_preferences.json" ) ) ;
105- const TranslatedMFAIndex = withTranslation (
106- [ 'my_preferences' , 'loris' ]
107- ) ( MFAIndex ) ;
108109
109110 const element = document . getElementById ( 'lorisworkspace' ) ;
110111 if ( ! element ) {
111112 throw new Error ( 'Missing lorisworkspace' ) ;
112113 }
113114 createRoot ( element ) . render (
114- < TranslatedMFAIndex />
115+ < MFAIndex />
115116 ) ;
116117} ) ;
0 commit comments