From f227e9ec3eeb4e3575910a9c88d3ec7273443a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 25 Jul 2014 07:57:48 +0200 Subject: [PATCH] core: add terabyte unit for size displayed --- ChangeLog.asciidoc | 1 + po/cs.po | 16 ++++++++++------ po/de.po | 15 +++++++++------ po/es.po | 15 +++++++++------ po/fr.po | 14 ++++++++------ po/hu.po | 14 ++++++++------ po/it.po | 15 +++++++++------ po/ja.po | 14 ++++++++------ po/pl.po | 16 ++++++++++------ po/pt_BR.po | 12 +++++++----- po/ru.po | 15 +++++++++------ po/tr.po | 14 ++++++++------ po/weechat.pot | 12 +++++++----- src/core/wee-string.c | 25 ++++++++++++++++--------- 14 files changed, 119 insertions(+), 79 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index f52acf668..b3d0d715a 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 1.0 (under dev) +* core: add terabyte unit for size displayed * core: fix insert of mouse code in input line after a partial key combo (closes #130) * core: check code point value in UTF-8 check function (closes #108) diff --git a/po/cs.po b/po/cs.po index 6a8834336..6e628bb2b 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" "Language: cs\n" @@ -3903,9 +3903,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "bajtů" - msgid "KB" msgstr "KB" @@ -3915,8 +3912,15 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "bajt" +msgid_plural "bytes" +msgstr[0] "bajt" +msgstr[1] "bajt" +msgstr[2] "bajt" #, c-format msgid "debug: removing file: %s" diff --git a/po/de.po b/po/de.po index 942ca6bc0..f4bbebe9a 100644 --- a/po/de.po +++ b/po/de.po @@ -22,8 +22,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-22 12:01+0100\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" "Language: de_DE\n" @@ -4577,9 +4577,6 @@ msgstr "" msgid "No secured data set" msgstr "keine schutzwürdigen Daten definiert" -msgid "bytes" -msgstr "Bytes" - msgid "KB" msgstr "KB" @@ -4589,8 +4586,14 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "Byte" +msgid_plural "bytes" +msgstr[0] "Byte" +msgstr[1] "Byte" #, c-format msgid "debug: removing file: %s" diff --git a/po/es.po b/po/es.po index 559ec7ad4..5baecd1d5 100644 --- a/po/es.po +++ b/po/es.po @@ -22,8 +22,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" "Language: es\n" @@ -4114,9 +4114,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "bytes" - msgid "KB" msgstr "KB" @@ -4126,8 +4123,14 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "byte" +msgid_plural "bytes" +msgstr[0] "byte" +msgstr[1] "byte" #, c-format msgid "debug: removing file: %s" diff --git a/po/fr.po b/po/fr.po index d18f95e25..24845d15c 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-20 12:27+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -4478,9 +4478,6 @@ msgstr "" msgid "No secured data set" msgstr "Pas de donnée sécurisée définie" -msgid "bytes" -msgstr "octets" - msgid "KB" msgstr "Ko" @@ -4490,8 +4487,13 @@ msgstr "Mo" msgid "GB" msgstr "Go" +msgid "TB" +msgstr "To" + msgid "byte" -msgstr "octet" +msgid_plural "bytes" +msgstr[0] "octet" +msgstr[1] "octets" #, c-format msgid "debug: removing file: %s" diff --git a/po/hu.po b/po/hu.po index 01478a6da..955d8c380 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" "Language: hu\n" @@ -3525,9 +3525,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "byte" - msgid "KB" msgstr "KB" @@ -3537,9 +3534,14 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + #, fuzzy msgid "byte" -msgstr "byte" +msgid_plural "bytes" +msgstr[0] "byte" +msgstr[1] "byte" #, fuzzy, c-format msgid "debug: removing file: %s" diff --git a/po/it.po b/po/it.po index 36a3513ab..827aa1a71 100644 --- a/po/it.po +++ b/po/it.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" "Language: it\n" @@ -4237,9 +4237,6 @@ msgstr "" msgid "No secured data set" msgstr "Dati sicuri non configurati" -msgid "bytes" -msgstr "byte" - msgid "KB" msgstr "KB" @@ -4249,8 +4246,14 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "byte" +msgid_plural "bytes" +msgstr[0] "byte" +msgstr[1] "byte" #, c-format msgid "debug: removing file: %s" diff --git a/po/ja.po b/po/ja.po index 75d80dccf..9a718f3e4 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -4289,9 +4289,6 @@ msgstr "" msgid "No secured data set" msgstr "保護データが設定されていません" -msgid "bytes" -msgstr "バイト" - msgid "KB" msgstr "キロバイト" @@ -4301,8 +4298,13 @@ msgstr "メガバイト" msgid "GB" msgstr "ギガバイト" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "バイト" +msgid_plural "bytes" +msgstr[0] "バイト" #, c-format msgid "debug: removing file: %s" diff --git a/po/pl.po b/po/pl.po index 2a0d96e98..ba60dc510 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" "Language: pl\n" @@ -4359,9 +4359,6 @@ msgstr "" msgid "No secured data set" msgstr "Brak zabezpieczonych danych" -msgid "bytes" -msgstr "bajty" - msgid "KB" msgstr "KB" @@ -4371,8 +4368,15 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "bajt" +msgid_plural "bytes" +msgstr[0] "bajt" +msgstr[1] "bajt" +msgstr[2] "bajt" #, c-format msgid "debug: removing file: %s" diff --git a/po/pt_BR.po b/po/pt_BR.po index 1f8395d73..a41721356 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" "PO-Revision-Date: 2014-07-14 18:44+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -4005,9 +4005,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "" - msgid "KB" msgstr "" @@ -4017,9 +4014,14 @@ msgstr "" msgid "GB" msgstr "" -msgid "byte" +msgid "TB" msgstr "" +msgid "byte" +msgid_plural "bytes" +msgstr[0] "" +msgstr[1] "" + #, c-format msgid "debug: removing file: %s" msgstr "" diff --git a/po/ru.po b/po/ru.po index d47468074..edde176a4 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" "Language: ru\n" @@ -3554,9 +3554,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "байтов" - msgid "KB" msgstr "КБ" @@ -3566,9 +3563,15 @@ msgstr "МБ" msgid "GB" msgstr "ГБ" +msgid "TB" +msgstr "" + #, fuzzy msgid "byte" -msgstr "байтов" +msgid_plural "bytes" +msgstr[0] "байтов" +msgstr[1] "байтов" +msgstr[2] "байтов" #, fuzzy, c-format msgid "debug: removing file: %s" diff --git a/po/tr.po b/po/tr.po index e4f835973..a87bdab1b 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" -"PO-Revision-Date: 2014-07-14 18:44+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" +"PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" "Language: tr\n" @@ -3167,9 +3167,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "bayt" - msgid "KB" msgstr "KB" @@ -3179,8 +3176,13 @@ msgstr "MB" msgid "GB" msgstr "GB" +msgid "TB" +msgstr "" + +#, fuzzy msgid "byte" -msgstr "bayt" +msgid_plural "bytes" +msgstr[0] "bayt" #, c-format msgid "debug: removing file: %s" diff --git a/po/weechat.pot b/po/weechat.pot index ebee6d244..1f38631ad 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-07-20 12:16+0200\n" +"POT-Creation-Date: 2014-07-24 22:41+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: weechat-dev \n" @@ -3166,9 +3166,6 @@ msgstr "" msgid "No secured data set" msgstr "" -msgid "bytes" -msgstr "" - msgid "KB" msgstr "" @@ -3178,9 +3175,14 @@ msgstr "" msgid "GB" msgstr "" -msgid "byte" +msgid "TB" msgstr "" +msgid "byte" +msgid_plural "bytes" +msgstr[0] "" +msgstr[1] "" + #, c-format msgid "debug: removing file: %s" msgstr "" diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 6890810d6..a0edc34ac 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -2274,30 +2274,37 @@ string_iconv_fprintf (FILE *file, const char *data, ...) char * string_format_size (unsigned long long size) { - char *unit_name[] = { N_("bytes"), N_("KB"), N_("MB"), N_("GB") }; - char *unit_format[] = { "%.0f", "%.1f", "%.02f", "%.02f" }; - float unit_divide[] = { 1, 1024, 1024*1024, 1024*1024*1024 }; + char *unit_name[] = { "", N_("KB"), N_("MB"), N_("GB"), N_("TB") }; + char *unit_format[] = { "%.0f", "%.1f", "%.02f", "%.02f", "%.02f" }; + float unit_divide[] = { 1.0, 1000.0, 1000.0 * 1000.0, + 1000.0 * 1000.0 * 1000.0, + 1000.0 * 1000.0 * 1000.0 * 1000.0 }; char format_size[128], str_size[128]; int num_unit; + float size_float; str_size[0] = '\0'; - if (size < 1024*10) + if (size < 10L * 1000L) num_unit = 0; - else if (size < 1024*1024) + else if (size < 1000L * 1000L) num_unit = 1; - else if (size < 1024*1024*1024) + else if (size < 1000L * 1000L * 1000L) num_unit = 2; - else + else if (size < 1000L * 1000L * 1000L * 1000L) num_unit = 3; + else + num_unit = 4; snprintf (format_size, sizeof (format_size), "%s %%s", unit_format[num_unit]); + size_float = ((float)size) / ((float)(unit_divide[num_unit])); snprintf (str_size, sizeof (str_size), format_size, - ((float)size) / ((float)(unit_divide[num_unit])), - (size <= 1) ? _("byte") : _(unit_name[num_unit])); + size_float, + (num_unit == 0) ? + NG_("byte", "bytes", size_float) : _(unit_name[num_unit])); return strdup (str_size); }