From e9bf400d4f114ff33dc6a280b6b4bc3c4fe2ddd4 Mon Sep 17 00:00:00 2001 From: Sergey Alyoshin Date: Thu, 5 Jun 2014 23:36:08 +0400 Subject: [PATCH] Add strings to translation --- panel-plugin/wavelan.c | 14 +++++++++----- panel-plugin/wi_common.c | 11 +++++++---- panel-plugin/wi_linux.c | 2 +- po/POTFILES.in | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/panel-plugin/wavelan.c b/panel-plugin/wavelan.c index dc73b38..813cc15 100644 --- a/panel-plugin/wavelan.c +++ b/panel-plugin/wavelan.c @@ -161,17 +161,21 @@ wavelan_timer(gpointer data) } else { /* set error */ - tip = g_strdup(wi_strerror(result)); + tip = g_strdup(_(wi_strerror(result))); wavelan_set_state(wavelan, -1); } } else { wavelan_set_state(wavelan, stats.ws_quality); - if (strlen(stats.ws_netname) > 0) - tip = g_strdup_printf("%s: %d%s at %dMb/s", stats.ws_netname, stats.ws_quality, stats.ws_qunit, stats.ws_rate); - else - tip = g_strdup_printf("%d%s at %dMb/s", stats.ws_quality, stats.ws_qunit, stats.ws_rate); + if (strlen(stats.ws_netname) > 0) { + /* Translators: net_name: quality quality_unit at rate Mb/s*/ + tip = g_strdup_printf(_("%s: %d%s at %dMb/s"), stats.ws_netname, stats.ws_quality, stats.ws_qunit, stats.ws_rate); + } + else { + /* Translators: quality quality_unit at rate Mb/s*/ + tip = g_strdup_printf(_("%d%s at %dMb/s"), stats.ws_quality, stats.ws_qunit, stats.ws_rate); + } } } else { diff --git a/panel-plugin/wi_common.c b/panel-plugin/wi_common.c index b040393..e59bb91 100644 --- a/panel-plugin/wi_common.c +++ b/panel-plugin/wi_common.c @@ -24,20 +24,23 @@ #include +/* Trick to mark strings for translation */ +#define N_(str) (str) + const char * wi_strerror(int error) { switch (error) { case WI_NOCARRIER: - return("No carrier signal"); + return N_("No carrier signal"); case WI_NOSUCHDEV: - return("No such WaveLAN device"); + return N_("No such WaveLAN device"); case WI_INVAL: - return("Invalid parameter"); + return N_("Invalid parameter"); default: - return("Unknown error"); + return N_("Unknown error"); } } diff --git a/panel-plugin/wi_linux.c b/panel-plugin/wi_linux.c index e4ce838..c16d6ab 100644 --- a/panel-plugin/wi_linux.c +++ b/panel-plugin/wi_linux.c @@ -147,7 +147,7 @@ wi_query(struct wi_device *device, struct wi_stats *stats) /* FIXME */ g_strlcpy(stats->ws_qunit, "%", 2); - g_strlcpy(stats->ws_vendor, "Unknown", WI_MAXSTRLEN); + g_strlcpy(stats->ws_vendor, _("Unknown"), WI_MAXSTRLEN); /* Set interface name */ strncpy(wreq.ifr_name, device->interface, IFNAMSIZ); diff --git a/po/POTFILES.in b/po/POTFILES.in index 197de9b..f79211b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,2 +1,3 @@ panel-plugin/wavelan.c +panel-plugin/wi_common.c panel-plugin/wavelan.desktop.in -- 1.7.10.4