Skip to content

Commit

Permalink
i18n: extract strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rithvikvibhu committed Jun 22, 2022
1 parent e357c90 commit badc1c7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
26 changes: 14 additions & 12 deletions app/pages/Auction/RepairBid.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ export class RepairBid extends Component {
* Attempt to repair bid from input
*/
testBidValue = async () => {
const {t} = this.context;
const {bidValue} = this.state;
if (!this.isValueValid(bidValue)) return;

if (await this.verifyBid(parseFloat(bidValue), true)) {
// Found value, close modal
this.setState({isEditing: false});
} else {
this.setState({errorMessage: 'Bid value incorrect.'});
this.setState({errorMessage: t('bidValueIncorrect')});
}
}

Expand Down Expand Up @@ -181,10 +182,12 @@ export class RepairBid extends Component {
}

render() {
const {t} = this.context;

if (this.state.isEditing) {
return (
<>
<span>Repairing...</span>
<span>{t('repairing')}</span>
{this.renderModal()}
</>
);
Expand Down Expand Up @@ -217,15 +220,14 @@ export class RepairBid extends Component {
<div className="repair-bid__container">
<div className="repair-bid__header">
<div
className="repair-bid__title">Repair bid</div>
className="repair-bid__title">{t('repairBid')}</div>
<div className="repair-bid__close-btn" onClick={() => this.setState({isEditing: false})}>
</div>
</div>
<div className="repair-bid__content">
<p className="repair-bid__description">
True bid values are secret until they are revealed on-chain and cannot be restored with just a seed phrase.
To repair it, enter the bid value below.
{t('repairBidDescription')}
</p>

{/* Single bid value test */}
Expand Down Expand Up @@ -268,7 +270,7 @@ export class RepairBid extends Component {
onClick={this.testBidValue}
disabled={!this.isValueValid(bidValue)}
>
Repair
{t('repair')}
</button>
</section>

Expand All @@ -291,14 +293,14 @@ export class RepairBid extends Component {

if (findNonceProgress.isFinding) {
bruteForceAlertType = 'info';
bruteForceAlertMessage = `Finding (${findNonceProgress.progress.toFixed(2)}% completed)... ${findNonceProgress.bidValue / 1e6} HNS`;
bruteForceAlertMessage = t('repairBidBruteForceAlertIsFinding', findNonceProgress.progress.toFixed(2)) + ` ${findNonceProgress.bidValue / 1e6} HNS`;
} else {
if (findNonceProgress.found) {
bruteForceAlertType = 'success';
bruteForceAlertMessage = `Found bid value: ${findNonceProgress.bidValue / 1e6} HNS`;
bruteForceAlertMessage = t('repairBidBruteForceAlertFound') + `: ${findNonceProgress.bidValue / 1e6} HNS`;
} else {
bruteForceAlertType = 'error';
bruteForceAlertMessage = 'Could not find bid value. Try expanding the range or increasing precision.';
bruteForceAlertMessage = t('repairBidBruteForceAlertNotFound');
}
}

Expand All @@ -310,8 +312,8 @@ export class RepairBid extends Component {

return (
<section className="repair-bid__brute-force">
<p>Don't remember the amount? Fill in what you know below.</p>
<span>Bid value range:</span>
<p>{t('repairBidBruteForceDesc')}</p>
<span>{t('bidValueRange')}:</span>
<div>
<div className="repair-bid__amount">
<input
Expand Down Expand Up @@ -344,7 +346,7 @@ export class RepairBid extends Component {
</div>
</div>
<div>
<span>Max decimal places:</span>
<span>{t('maxDecimalPlaces')}:</span>
<div className="repair-bid__amount precision">
<input
type="number"
Expand Down
11 changes: 11 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"biddingSoon": "Bidding Soon",
"bids": "bid(s)",
"bidsTitle": "Bids",
"bidValueIncorrect": "Bid value incorrect.",
"bidValueRange": "Bid value range",
"blindAmount": "Blind Amount",
"blindTooltip": "You can add a blind to your bid amount to cover up your actual bid. Your bid + blind is called lockup, which is the only value that other bidders see. The entire lockup will be frozen during the bidding period. The blind will be returned when it is revealed during the reveal period, whether you win the auction or not.",
"block": "Block",
Expand Down Expand Up @@ -196,6 +198,7 @@
"logout": "Logout",
"manage": "Manage",
"manageMyDomain": "Manage My Domain",
"maxDecimalPlaces": "Max decimal places",
"miscellaneous": "Miscellaneous",
"next": "Next",
"nextBid": "Next Bid",
Expand Down Expand Up @@ -322,6 +325,14 @@
"renewMyDomain": "Renew My Domain",
"renewSuccess": "Your renew request is submitted! Please wait around 15 minutes for it to be confirmed.",
"renewing": "Renewing",
"repair": "Repair",
"repairBid": "Repair Bid",
"repairBidBruteForceAlertFound": "Found bid value",
"repairBidBruteForceAlertIsFinding": "Finding (%s% completed)...",
"repairBidBruteForceAlertNotFound": "Could not find bid value. Try expanding the range or increasing precision.",
"repairBidBruteForceDesc": "Don't remember the amount? Fill in what you know below to find it.",
"repairBidDescription": "True bid values are secret until they are revealed on-chain and cannot be restored with just a seed phrase. To repair it, enter the bid value below.",
"repairing": "Repairing...",
"repairUnknownBids": "Repair Unknown Bids",
"rescanAuction": "Rescan Auction",
"rescanTooltip": "Rewinds blockchain to look for bids placed in the past. This may take a few minutes to complete, during which time the wallet will be unresponsive.",
Expand Down

0 comments on commit badc1c7

Please sign in to comment.