From aeddba1774fd04ef3e89ae016dbb90c3de9279fb Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 8 Sep 2021 09:18:57 +0200 Subject: [PATCH] Clean up some error strings Try to reuse and split things so that it makes things easier for the translators. --- vncviewer/MonitorArrangement.cxx | 6 +++--- vncviewer/MonitorIndicesParameter.cxx | 4 ++-- vncviewer/ServerDialog.cxx | 12 ++++-------- vncviewer/parameters.cxx | 13 ++++++------- vncviewer/vncviewer.cxx | 7 +++---- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/vncviewer/MonitorArrangement.cxx b/vncviewer/MonitorArrangement.cxx index 93227c59..b1d30128 100644 --- a/vncviewer/MonitorArrangement.cxx +++ b/vncviewer/MonitorArrangement.cxx @@ -406,7 +406,7 @@ int MonitorArrangement::get_monitor_name(int m, char name[], size_t name_len) XRRScreenResources *res = XRRGetScreenResources(fl_display, DefaultRootWindow(fl_display)); if (!res) { - vlog.error(_("Failed to get XRRScreenResources for root window")); + vlog.error(_("Failed to get system monitor configuration")); return -1; } @@ -414,7 +414,7 @@ int MonitorArrangement::get_monitor_name(int m, char name[], size_t name_len) XRRCrtcInfo *crtc = XRRGetCrtcInfo(fl_display, res, res->crtcs[i]); if (!crtc) { - vlog.error(_("Failed to get XRRCrtcInfo for crtc %d"), i); + vlog.error(_("Failed to get information about CRTC %d"), i); continue; } @@ -427,7 +427,7 @@ int MonitorArrangement::get_monitor_name(int m, char name[], size_t name_len) if (monitor_found) { XRROutputInfo *output = XRRGetOutputInfo(fl_display, res, crtc->outputs[j]); if (!output) { - vlog.error(_("Failed to get XRROutputInfo for crtc %d, output %d"), i, j); + vlog.error(_("Failed to get information about output %d for CRTC %d"), j, i); continue; } diff --git a/vncviewer/MonitorIndicesParameter.cxx b/vncviewer/MonitorIndicesParameter.cxx index b3ee4b19..827687dc 100644 --- a/vncviewer/MonitorIndicesParameter.cxx +++ b/vncviewer/MonitorIndicesParameter.cxx @@ -44,7 +44,7 @@ std::set MonitorIndicesParameter::getParam() std::vector monitors = fetchMonitors(); if (monitors.size() <= 0) { - vlog.error(_("Failed to get monitors")); + vlog.error(_("Failed to get system monitor configuration")); return indices; } @@ -97,7 +97,7 @@ bool MonitorIndicesParameter::setParam(std::set indices) std::vector monitors = fetchMonitors(); if (monitors.size() <= 0) { - vlog.error(_("Failed to get monitors")); + vlog.error(_("Failed to get system monitor configuration")); // Don't return, store the configuration anyways. } diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index 1c20dd30..ba0386ca 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -306,10 +306,8 @@ void ServerDialog::loadServerHistory() #endif char* homeDir = NULL; - if (getvnchomedir(&homeDir) == -1) { - throw Exception(_("Failed to read server history file, " - "can't obtain home directory path.")); - } + if (getvnchomedir(&homeDir) == -1) + throw Exception(_("Could not obtain the home directory path")); char filepath[PATH_MAX]; snprintf(filepath, sizeof(filepath), "%s%s", homeDir, SERVER_HISTORY); @@ -371,10 +369,8 @@ void ServerDialog::saveServerHistory() #endif char* homeDir = NULL; - if (getvnchomedir(&homeDir) == -1) { - throw Exception(_("Failed to write server history file, " - "can't obtain home directory path.")); - } + if (getvnchomedir(&homeDir) == -1) + throw Exception(_("Could not obtain the home directory path")); char filepath[PATH_MAX]; snprintf(filepath, sizeof(filepath), "%s%s", homeDir, SERVER_HISTORY); diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index ab5d5872..18384f3a 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -636,9 +636,9 @@ void saveViewerParameters(const char *filename, const char *servername) { /* Write parameters to file */ FILE* f = fopen(filepath, "w+"); if (!f) - throw Exception(_("Failed to write configuration file, can't open %s: %s"), + throw Exception(_("Could not open \"%s\": %s"), filepath, strerror(errno)); - + fprintf(f, "%s\n", IDENTIFIER_STRING); fprintf(f, "\n"); @@ -730,8 +730,7 @@ char* loadViewerParameters(const char *filename) { char* homeDir = NULL; if (getvnchomedir(&homeDir) == -1) - throw Exception(_("Failed to read configuration file, " - "can't obtain home directory path.")); + throw Exception(_("Could not obtain the home directory path")); snprintf(filepath, sizeof(filepath), "%sdefault.tigervnc", homeDir); delete[] homeDir; @@ -744,7 +743,7 @@ char* loadViewerParameters(const char *filename) { if (!f) { if (!filename) return NULL; // Use defaults. - throw Exception(_("Failed to read configuration file, can't open %s: %s"), + throw Exception(_("Could not open \"%s\": %s"), filepath, strerror(errno)); } @@ -830,8 +829,8 @@ char* loadViewerParameters(const char *filename) { } if (invalidParameterName) - vlog.info(_("Unknown parameter %s on line %d in file %s"), - line, lineNr, filepath); + vlog.error(_("Failed to read line %d in file %s: %s"), + lineNr, filepath, _("Unknown parameter")); } fclose(f); f=0; diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 2a81ffd3..d5c2f2bb 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -457,8 +457,7 @@ static void mkvnchomedir() char* homeDir = NULL; if (getvnchomedir(&homeDir) == -1) { - vlog.error(_("Could not create VNC home directory: can't obtain home " - "directory path.")); + vlog.error(_("Could not obtain the home directory path")); } else { int result = mkdir(homeDir, 0755); if (result == -1 && errno != EEXIST) @@ -551,8 +550,8 @@ potentiallyLoadConfigurationFile(char *vncServerName) vncServerName[VNCSERVERNAMELEN-1] = '\0'; } catch (rfb::Exception& e) { vlog.error("%s", e.str()); - abort_vncviewer(_("Error reading configuration file \"%s\":\n\n%s"), - vncServerName, e.str()); + abort_vncviewer(_("Unable to load the specified configuration " + "file:\n\n%s"), e.str()); } } } -- 2.39.5