make "I Understand" acknowledgement work for i18n case
This commit is contained in:
parent
255d9013b7
commit
dfe23e47e4
3 changed files with 23 additions and 8 deletions
|
@ -2,7 +2,6 @@
|
|||
host = https://www.transifex.com
|
||||
|
||||
[lbry-desktop.app-strings]
|
||||
file_filter = static/locales/<lang>.json
|
||||
source_file = static/locales/en.json
|
||||
source_file = static/app-strings.json
|
||||
source_lang = en
|
||||
type = KEYVALUEJSON
|
||||
|
|
|
@ -24,6 +24,8 @@ type State = {
|
|||
rememberPassword: boolean,
|
||||
};
|
||||
|
||||
const acknowledgementText = __('I Understand');
|
||||
|
||||
class ModalWalletEncrypt extends React.PureComponent<Props, State> {
|
||||
state = {
|
||||
newPassword: null,
|
||||
|
@ -63,8 +65,9 @@ class ModalWalletEncrypt extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
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<Props, State> {
|
|||
</div>
|
||||
<FormField
|
||||
inputButton={<Submit label={failMessage ? __('Encrypting Wallet') : __('Encrypt Wallet')} />}
|
||||
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)}
|
||||
|
|
|
@ -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."
|
||||
}
|
Loading…
Reference in a new issue