From dfe23e47e4d940bd9e09a3f0edcb06276c83a56d Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Sun, 13 Oct 2019 11:27:03 -0400 Subject: [PATCH] make "I Understand" acknowledgement work for i18n case --- .tx/config | 3 +-- src/ui/modal/modalWalletEncrypt/view.jsx | 15 +++++++++++---- static/app-strings.json | 13 +++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.tx/config b/.tx/config index 9961e304b..c1a4319ec 100644 --- a/.tx/config +++ b/.tx/config @@ -2,7 +2,6 @@ host = https://www.transifex.com [lbry-desktop.app-strings] -file_filter = static/locales/.json -source_file = static/locales/en.json +source_file = static/app-strings.json source_lang = en type = KEYVALUEJSON diff --git a/src/ui/modal/modalWalletEncrypt/view.jsx b/src/ui/modal/modalWalletEncrypt/view.jsx index 7de7a837c..be94866d7 100644 --- a/src/ui/modal/modalWalletEncrypt/view.jsx +++ b/src/ui/modal/modalWalletEncrypt/view.jsx @@ -24,6 +24,8 @@ type State = { rememberPassword: boolean, }; +const acknowledgementText = __('I Understand'); + class ModalWalletEncrypt extends React.PureComponent { state = { newPassword: null, @@ -63,8 +65,9 @@ class ModalWalletEncrypt extends React.PureComponent { } onChangeUnderstandConfirm(event: SyntheticInputEvent<>) { + const regex = new RegExp('^.?' + acknowledgementText + '.?$', 'i'); this.setState({ - understandConfirmed: /^.?i understand.?$/i.test(event.target.value), + understandConfirmed: regex.test(event.target.value), }); } @@ -151,9 +154,13 @@ class ModalWalletEncrypt extends React.PureComponent { } - error={understandError === true ? 'You must enter "I understand"' : false} - label={__('Enter "I understand"')} - placeholder={__('Dear computer, I understand')} + error={ + understandError === true + ? __('You must enter "%acknowledgement_text%"', { acknowledgement_text: acknowledgementText }) + : false + } + label={__('Enter "%acknowledgement_text%"', { acknowledgement_text: acknowledgementText })} + placeholder={__('Type "%acknowledgement_text%"', { acknowledgement_text: acknowledgementText })} type="text" name="wallet-understand" onChange={event => this.onChangeUnderstandConfirm(event)} diff --git a/static/app-strings.json b/static/app-strings.json index 458ef6e63..afde10267 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -791,5 +791,14 @@ "channel": "channel", "Create": "Create", "You have no rewards available.": "You have no rewards available.", - "URL does not include name.": "URL does not include name." -} + "URL does not include name.": "URL does not include name.", + "Enter a LBRY URL or search for videos, music, games and more": "Enter a LBRY URL or search for videos, music, games and more", + "I Understand": "I Understand", + "Enter \"%acknowledgement_text\"": "Enter \"%acknowledgement_text\"", + "Dear computer, %acknowledgement_text%": "Dear computer, %acknowledgement_text%", + "Enter \"%acknowledgement_text%\"": "Enter \"%acknowledgement_text%\"", + "Type \"%acknowledgement_text%\"": "Type \"%acknowledgement_text%\"", + "You must enter \"%acknowledgement_text%\"": "You must enter \"%acknowledgement_text%\"", + "Decrypt Wallet": "Decrypt Wallet", + "Your wallet has been encrypted with a local password, performing this action will remove this password.": "Your wallet has been encrypted with a local password, performing this action will remove this password." +} \ No newline at end of file