fix: accurate sync speed display, add missing i18n keys, native language names
- Fix blk/s calculation that was inflated ~10x due to resetting the time baseline every frame instead of only when blocks advanced - Add decay when no new blocks arrive for 10s so rate doesn't stay stale - Add 7 missing translation keys (timeout_off/1min/5min/15min/30min/1hour, slider_off) to all 8 language files so settings dropdowns translate - Show language names in native script (中文, Русский, 日本語, 한국어)
This commit is contained in:
@@ -49,6 +49,40 @@ namespace dragonx {
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
// ============================================================================
|
||||
// Warmup Message Translation
|
||||
// Maps raw daemon RPC warmup messages to user-friendly text.
|
||||
// ============================================================================
|
||||
|
||||
struct WarmupText {
|
||||
const char* title;
|
||||
const char* description;
|
||||
};
|
||||
|
||||
static WarmupText translateWarmup(const std::string& raw)
|
||||
{
|
||||
if (raw.find("Loading") != std::string::npos)
|
||||
return {"Loading blockchain data...",
|
||||
"Reading the block database from disk. This may take a few minutes after updates."};
|
||||
if (raw.find("Verifying") != std::string::npos)
|
||||
return {"Verifying blockchain...",
|
||||
"Checking recent blocks to make sure your chain data is valid."};
|
||||
if (raw.find("Activating") != std::string::npos)
|
||||
return {"Processing blocks...",
|
||||
"Applying blocks to build the current chain state."};
|
||||
if (raw.find("Rewinding") != std::string::npos)
|
||||
return {"Reorganizing chain...",
|
||||
"A chain reorganization was detected. Reverting to the correct chain."};
|
||||
if (raw.find("Rescanning") != std::string::npos)
|
||||
return {"Scanning for transactions...",
|
||||
"Searching the blockchain for transactions belonging to your wallet. This can take a while."};
|
||||
if (raw.find("Pruning") != std::string::npos)
|
||||
return {"Optimizing storage...",
|
||||
"Removing old block data to free up disk space."};
|
||||
// Fallback: use the raw message
|
||||
return {raw.c_str(), ""};
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Connection Management
|
||||
// ============================================================================
|
||||
@@ -164,7 +198,9 @@ void App::tryConnect()
|
||||
// fail until warmup completes. Set the warmup state so
|
||||
// the UI shows status instead of a blocking overlay.
|
||||
state_.warming_up = true;
|
||||
state_.warmup_status = warmupStatus;
|
||||
auto wt = translateWarmup(warmupStatus);
|
||||
state_.warmup_status = wt.title;
|
||||
state_.warmup_description = wt.description;
|
||||
// Append current block height from daemon output
|
||||
if (embedded_daemon_) {
|
||||
int h = embedded_daemon_->getLastBlockHeight();
|
||||
@@ -560,6 +596,7 @@ void App::refreshCoreData()
|
||||
// Warmup finished — daemon is fully ready
|
||||
state_.warming_up = false;
|
||||
state_.warmup_status.clear();
|
||||
state_.warmup_description.clear();
|
||||
connection_status_ = "Connected";
|
||||
VERBOSE_LOGF("[warmup] Daemon ready, warmup complete\n");
|
||||
// Parse initial info
|
||||
@@ -577,7 +614,9 @@ void App::refreshCoreData()
|
||||
refreshData();
|
||||
} else {
|
||||
// Still warming up — update status
|
||||
state_.warmup_status = errMsg;
|
||||
auto wt = translateWarmup(errMsg);
|
||||
state_.warmup_status = wt.title;
|
||||
state_.warmup_description = wt.description;
|
||||
if (embedded_daemon_) {
|
||||
int h = embedded_daemon_->getLastBlockHeight();
|
||||
if (h > 0)
|
||||
|
||||
Reference in New Issue
Block a user