i18n(migrate,sweep): translate status/error strings + add a hygiene regression guard

- The import-key sweep and migrate-to-seed flows set several user-visible
  status/error strings (shown via sweep_status_ / seed_migration_status_ /
  rescan_status) as bare English; routed them through TR() with additive keys.
- Extended scripts/check-source-hygiene.sh with two low-false-positive content
  guards so this debt can't regrow: a bare-English migrate/sweep status
  assignment, and a Tactile button sized with a raw (unscaled) pixel literal.
  Passes clean on the tree (362 files); the dev sweep harness is allowlisted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 08:44:55 -05:00
co-authored by Claude Opus 4.8
parent 8b07f776e5
commit 8d8e523a26
3 changed files with 61 additions and 16 deletions
+16 -16
View File
@@ -5635,7 +5635,7 @@ void App::sweepPrivateKey(const std::string& rawKey, int startHeight, int destMo
const std::string& destExisting)
{
if (!state_.connected || !rpc_ || !worker_) {
sweep_status_ = "Not connected to the daemon.";
sweep_status_ = TR("err_not_connected_daemon");
sweep_step_ = SweepStep::Error;
return;
}
@@ -5647,7 +5647,7 @@ void App::sweepPrivateKey(const std::string& rawKey, int startHeight, int destMo
// Sweeping requires a SPENDING key (transparent WIF or shielded z-spending key) — a viewing key
// can't sign, and this must never accidentally route to z_importviewingkey.
if (!services::WalletSecurityController::isRecognizedPrivateKey(key)) {
sweep_status_ = "Enter a spending key (a viewing key can't move funds).";
sweep_status_ = TR("sweep_err_need_spending_key");
sweep_step_ = SweepStep::Error;
return;
}
@@ -5665,7 +5665,7 @@ void App::sweepPrivateKey(const std::string& rawKey, int startHeight, int destMo
}
sweep_step_ = SweepStep::Running;
sweep_status_ = "Importing key & rescanning…";
sweep_status_ = TR("sweep_status_importing");
sweep_txid_.clear();
sweep_dest_shown_.clear();
@@ -5759,7 +5759,7 @@ void App::sweepPrivateKey(const std::string& rawKey, int startHeight, int destMo
} catch (const std::exception& e) {
err = e.what();
} catch (...) {
err = "Sweep failed (unknown error)";
err = TR("sweep_err_unknown");
}
// Scrub the worker's copy of the spending key now that the request has been sent (all paths).
if (!key.empty()) sodium_memzero(&key[0], key.size());
@@ -5767,16 +5767,16 @@ void App::sweepPrivateKey(const std::string& rawKey, int startHeight, int destMo
invalidateAddressValidationCache();
refreshAddresses();
if (!err.empty()) {
if (err == "__NOFUNDS__") sweep_status_ = "This key holds no funds to sweep.";
else if (err == "__UNCONFIRMED__") sweep_status_ = "This key's funds are still unconfirmed — try again shortly.";
else if (err == "__ALREADY__") sweep_status_ = "This key is already in your wallet — use Send to move its funds.";
else if (err == "__DUST__") sweep_status_ = "This key's balance is too small to cover the network fee.";
if (err == "__NOFUNDS__") sweep_status_ = TR("sweep_err_nofunds");
else if (err == "__UNCONFIRMED__") sweep_status_ = TR("sweep_err_unconfirmed");
else if (err == "__ALREADY__") sweep_status_ = TR("sweep_err_already");
else if (err == "__DUST__") sweep_status_ = TR("sweep_err_dust");
else sweep_status_ = err;
sweep_step_ = SweepStep::Error;
return;
}
sweep_dest_shown_ = dest;
sweep_status_ = "Sweeping funds to your address…";
sweep_status_ = TR("sweep_status_sweeping");
// Send all funds from the swept address to the destination through the tested z_sendmany
// wrapper (fixed-decimal amount + async-op tracking). z_sendmany needs every input in one
// transaction to cover the full balance, so it fails loudly rather than partial-sweeping.
@@ -6283,7 +6283,7 @@ void App::showSeedMigrationDialog()
pending_send_callbacks_[sweepOpid] = makeSweepCompletionCallback(/*resumed=*/true);
trackOperation(sweepOpid);
seed_migration_step_ = SeedMigrationStep::Sweeping;
seed_migration_status_ = "Checking on the previous sweep…";
seed_migration_status_ = TR("migrate_status_checking_sweep");
break;
case MigrationResume::SweepGate:
// No txid, and either no opid or not connected to re-track it (a persisted opid is left in
@@ -6361,15 +6361,15 @@ void App::beginSweepToSeedWallet()
return;
}
if (!rpc_ || !worker_ || !state_.connected) {
seed_migration_status_ = "Not connected to the daemon.";
seed_migration_status_ = TR("err_not_connected_daemon");
seed_migration_step_ = SeedMigrationStep::Error; return;
}
if (seed_migration_dest_.empty()) {
seed_migration_status_ = "No destination address for the sweep.";
seed_migration_status_ = TR("migrate_err_no_dest");
seed_migration_step_ = SeedMigrationStep::Error; return;
}
seed_migration_step_ = SeedMigrationStep::Sweeping;
seed_migration_status_ = "Building the sweep transaction…";
seed_migration_status_ = TR("migrate_status_building");
// Mark the sweep as submitted BEFORE broadcasting (persisted synchronously). If the app or daemon
// then dies after the tx reaches the mempool but before its opid/txid is persisted, a resumed
// migration still knows a sweep is in flight and won't mistake the resulting ~0 legacy balance for
@@ -6409,7 +6409,7 @@ void App::beginSweepToSeedWallet()
}
pending_send_callbacks_[opid] = makeSweepCompletionCallback(/*resumed=*/false);
trackOperation(opid);
seed_migration_status_ = "Waiting for the sweep transaction to be accepted…";
seed_migration_status_ = TR("migrate_status_waiting_accept");
};
});
}
@@ -6568,7 +6568,7 @@ void App::beginAdoptSeedWallet()
{
if (refuseIfNodeBusy()) return; // stays on its current step; the user retries once the node is free
seed_migration_step_ = SeedMigrationStep::Adopting;
seed_migration_status_ = "Restarting with your new wallet — this rescan can take a while…";
seed_migration_status_ = TR("migrate_status_restarting");
{ std::lock_guard<std::mutex> lk(seed_migration_mutex_); seed_migration_adopt_done_ = false; }
// Gate the main-loop reconnect so tryConnect can't start the daemon while we swap wallet.dat.
daemon_restarting_ = true;
@@ -7410,7 +7410,7 @@ bool App::runtimeRescan(int startHeight)
rescan_confirmed_active_ = true;
user_initiated_rescan_ = true; // user clicked Rescan → completion should toast
state_.sync.rescan_progress = 0.0f;
state_.sync.rescan_status = "Rescanning from block " + std::to_string(startHeight) + "...";
{ char rb[64]; snprintf(rb, sizeof(rb), TR("rescan_status_from_block"), startHeight); state_.sync.rescan_status = rb; }
markTransactionsDirty();
last_tx_block_height_ = -1;
invalidateShieldedHistoryScanProgress(true);