i18n: route explorer and shield status strings through TR()
Centralise the remaining hardcoded English literals in two otherwise fully-translated files (explorer_tab: 40 TR calls, shield_dialog: 23) so they join the i18n system with an English source key + fallback: - explorer_tab: the three search-error messages (invalid response, hash not found, not-connected) now use explorer_* keys. Also guards a hash lookup behind an active daemon connection and disables the block-detail prev/next nav while a fetch is in flight (both were the reason these error paths could fire). - shield_dialog: the operation status/error strings (submitting, submitted, failed, status, error-checking-status, shield/merge failed) now use shield_* keys. - i18n: add the new explorer_* and shield_* English source keys. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -221,7 +221,7 @@ static void applyBlockDetailResult(const json& result, const std::string& error)
|
||||
}
|
||||
|
||||
if (result.is_null()) {
|
||||
s_search_error = "Invalid response from daemon";
|
||||
s_search_error = TR("explorer_invalid_response");
|
||||
s_show_detail_modal = false;
|
||||
return;
|
||||
}
|
||||
@@ -388,7 +388,7 @@ static void navigateToHash(App* app, const std::string& hash) {
|
||||
s_expanded_tx_idx = 0;
|
||||
s_show_detail_modal = false;
|
||||
} else {
|
||||
s_search_error = "No block or transaction found for this hash";
|
||||
s_search_error = TR("explorer_hash_not_found");
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -417,6 +417,11 @@ static void performSearch(App* app, const std::string& query) {
|
||||
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
});
|
||||
if (isHex64) {
|
||||
// A hash lookup needs the daemon; navigateToHash() would otherwise return silently.
|
||||
if (!app->rpc() || !app->rpc()->isConnected()) {
|
||||
s_search_error = TR("explorer_not_connected");
|
||||
return;
|
||||
}
|
||||
navigateToHash(app, query);
|
||||
return;
|
||||
}
|
||||
@@ -1039,6 +1044,9 @@ static void renderBlockDetailModal(App* app) {
|
||||
// Nav buttons on same line
|
||||
ImGui::SameLine(contentW - Layout::spacingXl() * 3);
|
||||
|
||||
// Disable prev/next while a fetch is in flight so navigation can't stack fetches.
|
||||
ImGui::BeginDisabled(s_detail_loading);
|
||||
|
||||
// Prev
|
||||
if (s_detail_height > 1) {
|
||||
ImGui::PushFont(Type().iconMed());
|
||||
@@ -1065,6 +1073,8 @@ static void renderBlockDetailModal(App* app) {
|
||||
ImGui::PopID();
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
Reference in New Issue
Block a user