Package: modem-manager-gui Version: 0.0.19.1-2 Severity: minor Tags: patch Hi,
I observed that the data download in modem-manager-gui was off by a factor of 8 as bit and bytes were confused with each other. This was noticed in the German translation but the problem is the obscure use of units in the English source code. The connection speed was provided with "Gbps" which is OK (but hard to decipher) but for the total amount of received and transmitted data units such as "Kb" was used which confused the translator. Two characters but 3 errors in it: It should mean kilo bytes, the SI unit for kilo is "k" and for byte "B" (b stands for bits but is not officially defined as unit). And as we all know in computer area kilo is not kilo but kibi so it should be "KiB" (now again indeed with capital K). This is maybe a little bit unusual but it is used more and more and is the proper one. To avoid confusion I used also "Kibit/s" instead of "kbps" and replaced two times "sec" by it's SI unit "s". I attached a patch which addresses this and updated/unfuzzied the German translation (which was up-to-date except 2 or 3 strings). What I also noticed during my tests: There is an xgettext error in src/strformat.c:105 and :109 in two strings which is reported by "ninja meson-modem-manager-gui-update-po" (which works only after adding po/POTFILES). The reason is that xgettext parses the C source code to extract translations and does not know macros such as G_GUINT64_FORMAT. The solution would be to provide translators a replacement string using maybe %u and to replace it after the gettext call. I was not doing so as string handling is difficult in C, sorry. Two further trivial changes: The string "Disabled" occurs a few times but at least in the German language two different translations are required (which differ only in capitalization). That's why a translation context was given once. Further the text '"%" G_GUINT64_FORMAT " day(s)"' was transferred into a plural rule so that it reads either "1 day" or "n days" (but xgettext had trouble with the macro in the old version already). All very minor stuff but maybe worth a Debian patch if upstream does not fix it fast ... It is also fully OK for me if parts of the patch ("Gibit/s" :-)) are rejected. Contact me in this case and I will update po/de.po. Jens
commit bb13e8853116ecd092699d3f3d189be38a44c27e Author: Jens Seidel <jenssei...@users.sf.net> Date: Mon Feb 15 23:12:58 2021 +0100 Fix wrong units such as "Kb" into "KiB" diff --git a/resources/ui/modem-manager-gui.ui b/resources/ui/modem-manager-gui.ui index 579f21e..9bb8369 100644 --- a/resources/ui/modem-manager-gui.ui +++ b/resources/ui/modem-manager-gui.ui @@ -4415,9 +4415,9 @@ Umidjon Almasov <u.alma...@gmail.com></property> <property name="can_focus">False</property> <property name="valign">center</property> <items> - <item translatable="yes">Mb</item> - <item translatable="yes">Gb</item> - <item translatable="yes">Tb</item> + <item translatable="yes">MiB</item> + <item translatable="yes">GiB</item> + <item translatable="yes">TiB</item> </items> </object> <packing> diff --git a/src/strformat.c b/src/strformat.c index cec6dd8..776af21 100644 --- a/src/strformat.c +++ b/src/strformat.c @@ -36,23 +36,23 @@ gchar *mmgui_str_format_speed(gfloat speed, gchar *buffer, gsize bufsize, gboole if (speed < 1024.0) { if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3f kbps</b></small>"), speed); + g_snprintf(buffer, bufsize, _("<small><b>%.3f Kibit/s</b></small>"), speed); } else { - g_snprintf(buffer, bufsize, _("%.3f kbps"), speed); + g_snprintf(buffer, bufsize, _("%.3f Kibit/s"), speed); } } else if ((speed >= 1024.0) && (speed < 1048576.0)) { fpvalue = speed / (gdouble)(1024.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Mbps</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g Mibit/s</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Mbps"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g Mibit/s"), fpvalue); } } else { fpvalue = speed / (gdouble)(1048576.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Gbps</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g Gibit/s</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Gbps"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g Gibit/s"), fpvalue); } } @@ -84,9 +84,9 @@ gchar *mmgui_str_format_time(guint64 seconds, gchar *buffer, gsize bufsize, gboo if (seconds < 60) { if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%u sec</b></small>"), (guint)seconds); + g_snprintf(buffer, bufsize, _("<small><b>%u s</b></small>"), (guint)seconds); } else { - g_snprintf(buffer, bufsize, _("%u sec"), (guint)seconds); + g_snprintf(buffer, bufsize, _("%u s"), (guint)seconds); } } else if ((seconds >= 60) && (seconds < 3600)) { if (small) { @@ -102,9 +102,13 @@ gchar *mmgui_str_format_time(guint64 seconds, gchar *buffer, gsize bufsize, gboo } } else { if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%" G_GUINT64_FORMAT " day(s) %s:%s:%s</b></small>"), seconds/86400, mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); + g_snprintf(buffer, bufsize, ngettext("<small><b>%" G_GUINT64_FORMAT " day %s:%s:%s</b></small>", + "<small><b>%" G_GUINT64_FORMAT " days %s:%s:%s</b></small>", seconds/86400), + mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } else { - g_snprintf(buffer, bufsize, _("%" G_GUINT64_FORMAT " day(s) %s:%s:%s"), seconds/86400, mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); + g_snprintf(buffer, bufsize, ngettext("%" G_GUINT64_FORMAT " day %s:%s:%s", + "%" G_GUINT64_FORMAT " days %s:%s:%s", seconds/86400), + mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } } @@ -121,37 +125,37 @@ gchar *mmgui_str_format_bytes(guint64 bytes, gchar *buffer, gsize bufsize, gbool if (bytes < 1024) { if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%u</b></small>"), (guint)bytes); + g_snprintf(buffer, bufsize, "<small><b>%u</b></small>", (guint)bytes); } else { - g_snprintf(buffer, bufsize, _("%u"), (guint)bytes); + g_snprintf(buffer, bufsize, "%u", (guint)bytes); } } else if ((bytes >= 1024) && (bytes < 1048576ull)) { fpvalue = bytes / (gdouble)(1024.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Kb</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g KiB</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Kb"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g KiB"), fpvalue); } } else if ((bytes >= 1048576ull) && (bytes < 1073741824ull)) { fpvalue = bytes / (gdouble)(1048576.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Mb</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g MiB</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Mb"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g MiB"), fpvalue); } } else if ((bytes >= 1073741824ull) && (bytes < 109951162800ull)) { fpvalue = bytes / (gdouble)(1073741824.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Gb</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g GiB</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Gb"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g GiB"), fpvalue); } } else { fpvalue = bytes / (gdouble)(109951162800.0); if (small) { - g_snprintf(buffer, bufsize, _("<small><b>%.3g Tb</b></small>"), fpvalue); + g_snprintf(buffer, bufsize, _("<small><b>%.3g TiB</b></small>"), fpvalue); } else { - g_snprintf(buffer, bufsize, _("%.3g Tb"), fpvalue); + g_snprintf(buffer, bufsize, _("%.3g TiB"), fpvalue); } } @@ -365,10 +369,10 @@ gchar *mmgui_str_format_operation_timeout_period(gdouble value) if ((value >= 0.0) && (value < 60.0)) { /*Seconds*/ - res = g_strdup_printf(_("%2.0f sec"), value); + res = g_strdup_printf(_("%2.0f s"), value); } else if (value >= 60.0) { /*Minutes*/ - res = g_strdup_printf(_("%u min, %u sec"), (guint)value / 60, (guint)value % 60); + res = g_strdup_printf(_("%u min, %u s"), (guint)value / 60, (guint)value % 60); } else { /*Undefined*/ res = g_strdup("Undefined"); diff --git a/src/traffic-page.c b/src/traffic-page.c index aea77a4..509f760 100644 --- a/src/traffic-page.c +++ b/src/traffic-page.c @@ -846,7 +846,7 @@ gboolean mmgui_main_traffic_stats_update_from_thread(gpointer data) gtk_tree_store_set(GTK_TREE_STORE(model), &elementiter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("<small><b>Limit</b></small>"), -1); } } else { - gtk_tree_store_set(GTK_TREE_STORE(model), &elementiter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("<small><b>Disabled</b></small>"), -1); + gtk_tree_store_set(GTK_TREE_STORE(model), &elementiter, MMGUI_MAIN_TRAFFICLIST_VALUE, C_("data limit", "<small><b>Disabled</b></small>"), -1); } } else { gtk_tree_store_set(GTK_TREE_STORE(model), &elementiter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("<small><b>Limit</b></small>"), -1);
de.po.diff.gz
Description: application/gzip
POTFILES
Description: Binary data