From 5422d2fdb874fc00bb91feeab036307838321cf1 Mon Sep 17 00:00:00 2001 From: getsnoopy Date: Mon, 16 Oct 2023 08:25:03 +0000 Subject: [PATCH] gutils: Use international symbol for bits --- glib/gutils.c | 50 +++++++++++++++++++++--------------------- glib/tests/fileutils.c | 36 +++++++++++++++--------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/glib/gutils.c b/glib/gutils.c index 9949a1e9f..5a15e99b1 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -2913,7 +2913,7 @@ g_format_size (guint64 size) * a strong "power of 2" basis, like RAM sizes or RAID stripe sizes. * Network and storage sizes should be reported in the normal SI units. * @G_FORMAT_SIZE_BITS: set the size as a quantity in bits, rather than - * bytes, and return units in bits. For example, ‘Mb’ rather than ‘MB’. + * bytes, and return units in bits. For example, ‘Mbit’ rather than ‘MB’. * @G_FORMAT_SIZE_ONLY_VALUE: return only value, without unit; this should * not be used together with @G_FORMAT_SIZE_LONG_FORMAT * nor @G_FORMAT_SIZE_ONLY_UNIT. Since: 2.74 @@ -2990,32 +2990,32 @@ g_format_size_full (guint64 size, { EXBIBYTE_FACTOR, N_("EiB") } }, { - /* Translators: A unit symbol for size formatting, showing for example: "13.0 kb" */ - { KILOBYTE_FACTOR, N_("kb") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Mb" */ - { MEGABYTE_FACTOR, N_("Mb") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Gb" */ - { GIGABYTE_FACTOR, N_("Gb") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Tb" */ - { TERABYTE_FACTOR, N_("Tb") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Pb" */ - { PETABYTE_FACTOR, N_("Pb") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Eb" */ - { EXABYTE_FACTOR, N_("Eb") } + /* Translators: A unit symbol for size formatting, showing for example: "13.0 kbit" */ + { KILOBYTE_FACTOR, N_("kbit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Mbit" */ + { MEGABYTE_FACTOR, N_("Mbit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Gbit" */ + { GIGABYTE_FACTOR, N_("Gbit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Tbit" */ + { TERABYTE_FACTOR, N_("Tbit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Pbit" */ + { PETABYTE_FACTOR, N_("Pbit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Ebit" */ + { EXABYTE_FACTOR, N_("Ebit") } }, { - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Kib" */ - { KIBIBYTE_FACTOR, N_("Kib") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Mib" */ - { MEBIBYTE_FACTOR, N_("Mib") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Gib" */ - { GIBIBYTE_FACTOR, N_("Gib") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Tib" */ - { TEBIBYTE_FACTOR, N_("Tib") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Pib" */ - { PEBIBYTE_FACTOR, N_("Pib") }, - /* Translators: A unit symbol for size formatting, showing for example: "13.0 Eib" */ - { EXBIBYTE_FACTOR, N_("Eib") } + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Kibit" */ + { KIBIBYTE_FACTOR, N_("Kibit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Mibit" */ + { MEBIBYTE_FACTOR, N_("Mibit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Gibit" */ + { GIBIBYTE_FACTOR, N_("Gibit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Tibit" */ + { TEBIBYTE_FACTOR, N_("Tibit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Pibit" */ + { PEBIBYTE_FACTOR, N_("Pibit") }, + /* Translators: A unit symbol for size formatting, showing for example: "13.0 Eibit" */ + { EXBIBYTE_FACTOR, N_("Eibit") } } }; diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 87a61339a..1b45e83c2 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -981,17 +981,17 @@ test_format_size_for_display (void) check_string (g_format_size_full (2, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_ONLY_VALUE), "2"); check_string (g_format_size_full (2, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_ONLY_UNIT), "bits"); - check_string (g_format_size_full (2000ULL, G_FORMAT_SIZE_BITS), "2.0\302\240kb"); - check_string (g_format_size_full (2000ULL * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Mb"); - check_string (g_format_size_full (2000ULL * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Gb"); - check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Tb"); - check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Pb"); - check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Eb"); + check_string (g_format_size_full (2000ULL, G_FORMAT_SIZE_BITS), "2.0\302\240kbit"); + check_string (g_format_size_full (2000ULL * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Mbit"); + check_string (g_format_size_full (2000ULL * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Gbit"); + check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Tbit"); + check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Pbit"); + check_string (g_format_size_full (2000ULL * 1000 * 1000 * 1000 * 1000 * 1000, G_FORMAT_SIZE_BITS), "2.0\302\240Ebit"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS), "238.5\302\240Mb"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_LONG_FORMAT), "238.5\302\240Mb (238472938 bits)"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS), "238.5\302\240Mbit"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_LONG_FORMAT), "238.5\302\240Mbit (238472938 bits)"); check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_ONLY_VALUE), "238.5"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_ONLY_UNIT), "Mb"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_ONLY_UNIT), "Mbit"); check_string (g_format_size_full (0, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "0 bits"); @@ -1004,17 +1004,17 @@ test_format_size_for_display (void) check_string (g_format_size_full (2, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_ONLY_VALUE), "2"); check_string (g_format_size_full (2, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_ONLY_UNIT), "bits"); - check_string (g_format_size_full (2048ULL, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Kib"); - check_string (g_format_size_full (2048ULL * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Mib"); - check_string (g_format_size_full (2048ULL * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Gib"); - check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Tib"); - check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Pib"); - check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Eib"); + check_string (g_format_size_full (2048ULL, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Kibit"); + check_string (g_format_size_full (2048ULL * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Mibit"); + check_string (g_format_size_full (2048ULL * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Gibit"); + check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Tibit"); + check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Pibit"); + check_string (g_format_size_full (2048ULL * 1024 * 1024 * 1024 * 1024 * 1024, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "2.0\302\240Eibit"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "227.4\302\240Mib"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_LONG_FORMAT), "227.4\302\240Mib (238472938 bits)"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS), "227.4\302\240Mibit"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_LONG_FORMAT), "227.4\302\240Mibit (238472938 bits)"); check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_ONLY_VALUE), "227.4"); - check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_ONLY_UNIT), "Mib"); + check_string (g_format_size_full (238472938, G_FORMAT_SIZE_BITS | G_FORMAT_SIZE_IEC_UNITS | G_FORMAT_SIZE_ONLY_UNIT), "Mibit"); } static void