fix(gui): route runtime status messages through Loc instead of hardcoded Italian
Send/Donate/Sync/Wizard view models wrote status/error strings
directly in Italian ("Importo non valido.", "Errore: …", the TLS
pin-mismatch message, …), so a user running the app in English/German/
etc. still saw them in Italian despite the 6-language Loc system
covering the rest of the UI.
Added the missing Loc keys and routed every occurrence through
Loc.Tr(...). CertificatePinMismatchException (Core) no longer bakes an
Italian message into .Message; it now exposes Host/Port so the UI can
translate it, with an English fallback for any exception type the UI
doesn't specifically handle. Also drops the now-stale USERGUIDE.md
caveat about a few messages staying in Italian regardless of language.
This commit is contained in:
@@ -319,14 +319,14 @@ public partial class MainWindowViewModel
|
||||
IsConnected = false;
|
||||
ConnectionStatus = Loc.Tr("conn.none");
|
||||
ConnectionStatusShort = Loc.Tr("conn.none");
|
||||
StatusMessage = ex.Message;
|
||||
StatusMessage = DescribeError(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
IsConnected = _client?.IsConnected == true;
|
||||
ConnectionStatus = IsConnected ? ConnectionStatus : Loc.Tr("conn.none");
|
||||
ConnectionStatusShort = IsConnected ? Loc.Tr("conn.connectedto") : Loc.Tr("conn.none");
|
||||
StatusMessage = $"Errore: {ex.Message}";
|
||||
StatusMessage = $"{Loc.Tr("msg.error")}: {DescribeError(ex)}";
|
||||
if (_account is not null)
|
||||
{
|
||||
_syncFailed = true;
|
||||
@@ -378,7 +378,8 @@ public partial class MainWindowViewModel
|
||||
}
|
||||
if (temp is null)
|
||||
{
|
||||
StatusMessage = $"Errore nella scoperta peer: {lastError?.Message ?? Loc.Tr("conn.none")}";
|
||||
StatusMessage = $"{Loc.Tr("msg.peer.discovery.error")}: " +
|
||||
(lastError is null ? Loc.Tr("conn.none") : DescribeError(lastError));
|
||||
return;
|
||||
}
|
||||
try
|
||||
@@ -401,15 +402,26 @@ public partial class MainWindowViewModel
|
||||
SelectedKnownServer = KnownServers.FirstOrDefault(s => s.Host == selected?.Host)
|
||||
?? KnownServers.FirstOrDefault();
|
||||
StatusMessage = added > 0
|
||||
? $"Trovati {added} nuovi server dai peer (totale {KnownServers.Count})."
|
||||
: $"Nessun nuovo server annunciato (totale {KnownServers.Count}).";
|
||||
? string.Format(Loc.Tr("msg.peer.discovery.found"), added, KnownServers.Count)
|
||||
: string.Format(Loc.Tr("msg.peer.discovery.none"), KnownServers.Count);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StatusMessage = $"Errore nella scoperta peer: {ex.Message}";
|
||||
StatusMessage = $"{Loc.Tr("msg.peer.discovery.error")}: {DescribeError(ex)}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translates known Core exception types to the current UI language; falls back to the
|
||||
/// exception's own message (Core has no localization, so it is English by default).
|
||||
/// </summary>
|
||||
private static string DescribeError(Exception ex) => ex switch
|
||||
{
|
||||
CertificatePinMismatchException cert =>
|
||||
string.Format(Loc.Tr("msg.cert.mismatch"), $"{cert.Host}:{cert.Port}"),
|
||||
_ => ex.Message,
|
||||
};
|
||||
|
||||
private void OnServerNotification(string method, System.Text.Json.JsonElement payload)
|
||||
{
|
||||
if (method is "blockchain.scripthash.subscribe" or "blockchain.headers.subscribe")
|
||||
|
||||
Reference in New Issue
Block a user