fix(console): localize the lite console + drop full-node-only wording
The lite console tab lagged the full-node one on i18n: its toolbar status, status lines, help, and error/warning strings were hard-coded English or worded for a full node (a "daemon" the lite wallet doesn't have). - toolbarStatus()/statusLines(): route through TR() (reusing the existing lite_net_* keys where they already map) - printHelp(): enumerate the 25 pass-through backend verbs for discoverability, since the C++ tab intercepts `help` before the backend's own HelpCommand runs - gate the destructive 'stop' confirmation to the full node (hasRpcReference); lite has no node, so it lets 'stop' fall through to the backend instead of showing a phantom "shut down the node" warning behind a dead gate - word the not-connected error per variant (daemon vs "no wallet open") - TR() the "(no output)" command-result fallback Adds 7 i18n keys across all 8 languages (additive); rebuilds the CJK subset for the one new glyph (U+C5D4 for the Korean "backend"). Build + ctest + source-hygiene green; changes adversarially verified (no logic/i18n defects). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -258,7 +258,7 @@ bool LiteConsoleExecutor::pollResult(std::string& result, bool& isError)
|
||||
if (!lw) return false;
|
||||
wallet::LiteConsoleResult res;
|
||||
if (!lw->takeConsoleResult(res)) return false;
|
||||
result = res.response.empty() ? std::string("(no output)") : res.response;
|
||||
result = res.response.empty() ? std::string(TR("console_no_output")) : res.response;
|
||||
isError = !res.ok;
|
||||
return true;
|
||||
}
|
||||
@@ -286,6 +286,13 @@ void LiteConsoleExecutor::printHelp(const ConsoleAddLineFn& add)
|
||||
add(TR("console_help_clear"), ConsoleChannel::None);
|
||||
add(TR("console_help_help"), ConsoleChannel::None);
|
||||
add(TR("lite_console_help_passthrough"), ConsoleChannel::Info);
|
||||
// The lite backend's own command verbs (literal command tokens, not RPC methods — mirrors the
|
||||
// backend's get_commands() registry). Listed for discoverability: the C++ tab intercepts `help`
|
||||
// before it can reach the backend's own HelpCommand, so its "type help" advice would dead-end.
|
||||
add(TR("lite_console_backend_commands"), ConsoleChannel::Info);
|
||||
add(" sync syncstatus balance addresses height info list notes encryptionstatus", ConsoleChannel::None);
|
||||
add(" send shield new seed import timport export", ConsoleChannel::None);
|
||||
add(" encrypt decrypt lock unlock rescan save sietch saplingtree coinsupply", ConsoleChannel::None);
|
||||
}
|
||||
|
||||
std::vector<ConsoleStatusLine> LiteConsoleExecutor::statusLines() const
|
||||
@@ -294,20 +301,20 @@ std::vector<ConsoleStatusLine> LiteConsoleExecutor::statusLines() const
|
||||
wallet::LiteWalletController* lw = app_->liteWallet();
|
||||
if (lw && lw->walletOpen()) {
|
||||
const SyncInfo& sync = app_->state().sync;
|
||||
char buf[96];
|
||||
char buf[128];
|
||||
if (sync.syncing && !sync.isSynced()) {
|
||||
double vp = sync.verification_progress;
|
||||
if (vp < 0.0) vp = 0.0; else if (vp > 1.0) vp = 1.0;
|
||||
std::snprintf(buf, sizeof(buf), "Syncing %.1f%% (block %d / %d)",
|
||||
vp * 100.0, sync.blocks, sync.headers);
|
||||
std::snprintf(buf, sizeof(buf), "%s %.1f%% (block %d / %d)",
|
||||
TR("lite_net_syncing"), vp * 100.0, sync.blocks, sync.headers);
|
||||
} else {
|
||||
std::snprintf(buf, sizeof(buf), "Synced (block %d)", sync.blocks);
|
||||
std::snprintf(buf, sizeof(buf), "%s (block %d)", TR("lite_net_synced"), sync.blocks);
|
||||
}
|
||||
out.push_back({std::string(buf), OnSurfaceMedium(), false});
|
||||
}
|
||||
const std::string& err = app_->liteOpenError();
|
||||
if (!err.empty() && (!lw || !lw->walletOpen()))
|
||||
out.push_back({std::string("Last error: ") + err, Error(), false});
|
||||
out.push_back({std::string(TR("console_last_error")) + " " + err, Error(), false});
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -315,10 +322,10 @@ ConsoleStatusLine LiteConsoleExecutor::toolbarStatus() const
|
||||
{
|
||||
ConsoleStatusLine s;
|
||||
wallet::LiteWalletController* lw = app_->liteWallet();
|
||||
if (!lw) { s.text = "No backend"; s.color = Error(); return s; }
|
||||
if (lw->walletOpen()) { s.text = "Connected"; s.color = Success(); }
|
||||
else if (lw->openInProgress()) { s.text = "Connecting"; s.color = Warning(); s.pulse = true; }
|
||||
else { s.text = "Disconnected"; s.color = Error(); }
|
||||
if (!lw) { s.text = TR("console_backend_unavailable"); s.color = Error(); return s; }
|
||||
if (lw->walletOpen()) { s.text = TR("lite_net_connected"); s.color = Success(); }
|
||||
else if (lw->openInProgress()) { s.text = TR("lite_net_connecting"); s.color = Warning(); s.pulse = true; }
|
||||
else { s.text = TR("lite_net_disconnected"); s.color = Error(); }
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -1434,18 +1434,22 @@ bool ConsoleTab::submitConsoleCommand(ConsoleCommandExecutor& exec, const std::s
|
||||
exec.printHelp(add);
|
||||
} else if (first == "quit" || first == "exit") {
|
||||
addLine(TR("console_quit_note"), ConsoleChannel::Info);
|
||||
} else if (first == "stop") {
|
||||
} else if (first == "stop" && exec.hasRpcReference()) {
|
||||
// Full-node 'stop' shuts down the daemon (destructive) — gate behind a confirming second
|
||||
// 'stop'. Lite has no node: `stop` isn't a backend verb, so it falls through below and the
|
||||
// backend reports it as unknown — no misleading "shut down the node" warning or dead gate.
|
||||
if (!stop_confirm_pending_) {
|
||||
stop_confirm_pending_ = true;
|
||||
addLine("'stop' will shut down the node and disconnect the wallet. Type 'stop' again to confirm.",
|
||||
ConsoleChannel::Warning);
|
||||
addLine(TR("console_stop_confirm_node"), ConsoleChannel::Warning);
|
||||
} else {
|
||||
stop_confirm_pending_ = false;
|
||||
if (!exec.isReady()) addLine(TR("console_not_connected"), ConsoleChannel::Error);
|
||||
else exec.submit(cmd);
|
||||
}
|
||||
} else if (!exec.isReady()) {
|
||||
addLine(TR("console_not_connected"), ConsoleChannel::Error);
|
||||
// Full node connects to a daemon; the lite backend opens a wallet — word the error per variant.
|
||||
addLine(exec.hasRpcReference() ? TR("console_not_connected") : TR("console_not_connected_lite"),
|
||||
ConsoleChannel::Error);
|
||||
} else {
|
||||
exec.submit(cmd);
|
||||
}
|
||||
|
||||
@@ -1395,6 +1395,12 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["console_available_commands"] = "Available commands:";
|
||||
strings_["console_quit_note"] = "'quit'/'exit' aren't needed here — just close the window.";
|
||||
strings_["lite_console_help_passthrough"] = "Any other input runs as a lite-wallet console command.";
|
||||
strings_["lite_console_backend_commands"] = "Backend commands:";
|
||||
strings_["console_no_output"] = "(no output)";
|
||||
strings_["console_backend_unavailable"] = "No backend";
|
||||
strings_["console_last_error"] = "Last error:";
|
||||
strings_["console_not_connected_lite"] = "Error: no wallet open";
|
||||
strings_["console_stop_confirm_node"] = "'stop' will shut down the node and disconnect the wallet. Type 'stop' again to confirm.";
|
||||
strings_["console_capturing_output"] = "Capturing daemon output...";
|
||||
strings_["console_clear"] = "Clear";
|
||||
strings_["console_clear_console"] = "Clear Console";
|
||||
@@ -1854,6 +1860,7 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["lite_net_show_hidden"] = "Show hidden servers";
|
||||
strings_["lite_net_hidden_section"] = "Hidden servers";
|
||||
strings_["lite_net_connected"] = "Connected";
|
||||
strings_["lite_net_connecting"] = "Connecting";
|
||||
strings_["lite_net_disconnected"] = "Not connected";
|
||||
strings_["lite_net_syncing"] = "Syncing";
|
||||
strings_["lite_net_synced"] = "Synced";
|
||||
|
||||
Reference in New Issue
Block a user