Re: [PATCH v3] l10n: localizable upload progress messages
Duy Nguyen wrote: > > On Sat, Jun 22, 2019 at 4:37 PM Dimitriy Ryazantcev > wrote: > > diff --git a/strbuf.c b/strbuf.c > > index 0e18b259ce..0a3ebc3749 100644 > > --- a/strbuf.c > > +++ b/strbuf.c > > @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const > > char *s, > > void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) > > { > > if (bytes > 1 << 30) { > > - strbuf_addf(buf, "%u.%2.2u GiB", > > + strbuf_addf(buf, "%u.%2.2u ", > > (unsigned)(bytes >> 30), > > (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: gibi */ > > + strbuf_addstr(buf, _("Gi")); > > It may be ISO standard, but GiB to me looks much easier to understand. > What's the reason for changing GiB to Gi btw? I just moved 'B' out of else block so it will be prepended with 'Gi'/'Mi'/'Ki' when needed. Note: I changed 'bytes' to just 'B' unit. > > > } else if (bytes > 1 << 20) { > > unsigned x = bytes + 5243; /* for rounding */ > > - strbuf_addf(buf, "%u.%2.2u MiB", > > + strbuf_addf(buf, "%u.%2.2u ", > > x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: mebi */ > > + strbuf_addstr(buf, _("Mi")); > > } else if (bytes > 1 << 10) { > > unsigned x = bytes + 5; /* for rounding */ > > - strbuf_addf(buf, "%u.%2.2u KiB", > > + strbuf_addf(buf, "%u.%2.2u ", > > x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: kibi */ > > + strbuf_addstr(buf, _("Ki")); > > } else { > > - strbuf_addf(buf, "%u bytes", (unsigned)bytes); > > + strbuf_addf(buf, "%u ", (unsigned)bytes); > > } > > + /* TRANSLATORS: ISO/IEC 8-13:2008, subclause 13-9.c: byte */ > > + strbuf_addstr(buf, _("B")); > > } > > > > void strbuf_add_absolute_path(struct strbuf *sb, const char *path) > > -- > > 2.22.0 > > > > > -- > Duy -- Sincerely, Dimitriy Ryazantcev
Re: [PATCH v3] l10n: localizable upload progress messages
brian m. carlson wrote: > > On 2019-06-22 at 21:42:33, Johannes Sixt wrote: > > Am 22.06.19 um 11:36 schrieb Dimitriy Ryazantcev: > > > diff --git a/strbuf.c b/strbuf.c > > > index 0e18b259ce..0a3ebc3749 100644 > > > --- a/strbuf.c > > > +++ b/strbuf.c > > > @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, > > > const char *s, > > > void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) > > > { > > > if (bytes > 1 << 30) { > > > - strbuf_addf(buf, "%u.%2.2u GiB", > > > + strbuf_addf(buf, "%u.%2.2u ", > > > (unsigned)(bytes >> 30), > > > (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); > > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: gibi */ > > > + strbuf_addstr(buf, _("Gi")); > > > } else if (bytes > 1 << 20) { > > > unsigned x = bytes + 5243; /* for rounding */ > > > - strbuf_addf(buf, "%u.%2.2u MiB", > > > + strbuf_addf(buf, "%u.%2.2u ", > > > x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); > > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: mebi */ > > > + strbuf_addstr(buf, _("Mi")); > > > } else if (bytes > 1 << 10) { > > > unsigned x = bytes + 5; /* for rounding */ > > > - strbuf_addf(buf, "%u.%2.2u KiB", > > > + strbuf_addf(buf, "%u.%2.2u ", > > > x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); > > > + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: kibi */ > > > + strbuf_addstr(buf, _("Ki")); > > > } else { > > > - strbuf_addf(buf, "%u bytes", (unsigned)bytes); > > > + strbuf_addf(buf, "%u ", (unsigned)bytes); > > > } > > > + /* TRANSLATORS: ISO/IEC 8-13:2008, subclause 13-9.c: byte */ > > > + strbuf_addstr(buf, _("B")); > > > } > > > > > > void strbuf_add_absolute_path(struct strbuf *sb, const char *path) > > > > > > > All of the prefixes are in ISO/IEC, i.e., standardized. Why do they have > > to be translated? > > > > Isn't the way of presentation of magnitudes with a unit also > > standardized, and should not need to be translated? > > In my view, the translation is less important for the prefixes and more > important for the unit: at least French prefers the term "octet" over > "byte"[0], so instead of writing "MB", you'd write "Mo". Localization according to local rules is important for every unit part. There is a Russian adoption of IEC 8-13:2008 called GOST R IEC 8-13-2016[0]. And in this document there is national translations for these units\prefixes. So 'KiB' should become 'КиБ' according to this national standard. Same story with Ukrainian adoption called DSTU IEC 8-13:2016[1]: 'KiB' -> 'КіБ'. Also according to ISO website seems that there is French version of IEC 8-13:2008 exist. Not sure about French translation through. > In general, I think it's better to keep the prefixes and units together, > since trying to translate a single letter runs the risk of collisions > with other places in the code. It's likely to be easier for translators > as well. I agree with you in this part. I searched for similar code in other codebases and found such in KDE codebase[2]. I'll update patch if there is no objections. > [0] Technically, as in English, they have different meanings, but I've > always seen French units written with "o" for "octet", not "B" for > "byte". To solve this ambiguity IEC standard in subclause 13-9.с says that 'byte' implies 'octet' (8-bit byte). > -- > brian m. carlson: Houston, Texas, US > OpenPGP: https://keybase.io/bk2204 [0] http://docs.cntd.ru/document/1200143231 [1] http://online.budstandart.com/ua/catalog/doc-page.html?id_doc=69033 [1] https://cgit.kde.org/kcoreaddons.git/tree/src/lib/util/kformatprivate.cpp#n254 -- Sincerely, Dimitriy Ryazantcev
Re: [PATCH v5] l10n: localizable upload progress messages
Junio C Hamano writes: > > Dimitriy Ryazantcev writes: > > > Currenly the data rate in throughput_string(...) method is > > output by simple strbuf_humanise_bytes(...) call and '/s' append. > > But for proper translation of such string the translator needs > > full context. > > > > Add strbuf_humanise_rate(...) method to properly print out > > localizable version of data rate ('3.5 MiB/s' etc) with full context. > > Hmph, so idea is that appending translation of "/s" to translation > of "1.4MiB" may not be a good enough translation of "1.4MiB/s"? > > That does sounds like a good idea, but looking at the heavy > duplication of implementation, I would have to say "Yuck" to it. > > I wonder if an approach like the following illustration would work > better? I am not sure how well Q_() and N_() would interact with > each other, though. Good idea! But unfortunately this will not work properly as xgettext will unable to extract byte/bytes to one plural msgid in *.pot file. Seems it can extract plural forms only from Q_ (ngettext() call) and cannot from _N (gettext_noop() call) in current configuration[0]. Maybe in this case we can try to forward already translated string to strbuf_humanise(): static void strbuf_humanise(struct strbuf *buf, off_t bytes, struct human_format *fmt) { } else { strbuf_addf(buf, fmt->byte, (unsigned)bytes); } void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { struct human_format bytes_fmt = { .giga = _("%u.%2.2u GiB"), .mega = _("%u.%2.2u MiB"), .kilo = _("%u.%2.2u KiB"), .byte = Q_("%u byte", "%u bytes", (unsigned)bytes), }; strbuf_humanise(buf, bytes, &bytes_fmt); } What do you think? [0] https://github.com/git/git/blob/master/Makefile#L2498 > > -- >8 -- > > struct human_format { > const char *giga; > const char *mega; > const char *kilo; > const char *byte; > const char *bytes; > }; > > static void strbuf_humanise(struct strbuf *buf, off_t bytes, struct > human_format *fmt) > { > if (bytes > 1 << 30) { > strbuf_addf(buf, _(fmt->giga), > (unsigned)(bytes >> 30), > (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); > } else if (bytes > 1 << 20) { > unsigned x = bytes + 5243; /* for rounding */ > strbuf_addf(buf, _(fmt->mega), > x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); > strbuf_addstr(buf, _("")); > } else if (bytes > 1 << 10) { > unsigned x = bytes + 5; /* for rounding */ > strbuf_addf(buf, _(fmt->kilo), > x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); > } else { > strbuf_addf(buf, Q_(fmt->byte, fmt->bytes, > (unsigned)bytes), (unsigned)bytes); > } > } > > void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) > { > struct human_format bytes_fmt = { > .giga = N_("%u.%2.2u GiB"), > .mega = N_("%u.%2.2u MiB"), > .kilo = N_("%u.%2.2u KiB"), > .byte = N_("%u byte"), > .bytes = N_("%u bytes"), > }; > strbuf_humanise(buf, bytes, &bytes_fmt); > } > > void strbuf_humanise_rate(struct strbuf *buf, off_t bytes) > { > struct human_format rate_fmt = { > .giga = N_("%u.%2.2u GiB/s"), > .mega = N_("%u.%2.2u MiB/s"), > .kilo = N_("%u.%2.2u KiB/s"), > .byte = N_("%u byte/s"), > .bytes = N_("%u bytes/s"), > }; > strbuf_humanise(buf, bytes, &rate_fmt); > } -- Sincerely, Dimitriy Ryazantcev
[BUG] git pull with pull.rebase and rebase.autoStash is not working anymore in 2.16
Looks like regression in 2.16. Worked fine before update. Seems like git stash is not always working. Any ideas? $ git --version git version 2.16.0.windows.2 $ git config pull.rebase true $ git config rebase.autoStash true $ git status On branch develop Your branch is behind 'origin/develop' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch) Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: source_work/x.cpp no changes added to commit (use "git add" and/or "git commit -a") $ git pull Created autostash: 7ddcdf2ba HEAD is now at ba14a4c3f some commit Cannot rebase: You have unstaged changes. Please commit or stash them. $ git status On branch develop Your branch is behind 'origin/develop' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch) You are currently rebasing. (all conflicts fixed: run "git rebase --continue") Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: source_work/x.cpp no changes added to commit (use "git add" and/or "git commit -a") $ git rebase --abort Applied autostash. $ git stash Saved working directory and index state WIP on develop: ba14a4c3f some commit $ git status On branch develop Your branch is behind 'origin/develop' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch) Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: source_work/x.cpp no changes added to commit (use "git add" and/or "git commit -a") $ git stash Saved working directory and index state WIP on develop: ba14a4c3f some commit $ git status On branch develop Your branch is behind 'origin/develop' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch) nothing to commit, working tree clean -- Sincerely, Dimitriy Ryazantcev
Re: [BUG] git pull with pull.rebase and rebase.autoStash is not working anymore in 2.16
Yeah it seems like this bug. Thank you for sharing this with me. -- Sincerely, Dimitriy Ryazantcev > Could this be the same one as reported as Git for Windows issue > #1437[1] ("`git status` reports (non-existent) modifications after > `git stash push`", 2018-01-20), fixed in Git for Windows v2.16.1...? > > Care to try it out? :) > > Regards, Buga > > [1] https://github.com/git-for-windows/git/issues/1437
[PATCH] gitk: ru.po: Update Russian translation
Signed-off-by: Dimitriy Ryazantcev --- po/ru.po | 640 --- 1 file changed, 328 insertions(+), 312 deletions(-) diff --git a/po/ru.po b/po/ru.po index 17ed026..6a00dc2 100644 --- a/po/ru.po +++ b/po/ru.po @@ -3,15 +3,15 @@ # Translators: # 0xAX , 2014 # Alex Riesen , 2015 -# Dimitriy Ryazantcev , 2015 +# Dimitriy Ryazantcev , 2015-2016 # Dmitry Potapov , 2009 # Skip , 2011 msgid "" msgstr "" "Project-Id-Version: Git Russian Localization Project\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-17 14:32+1000\n" -"PO-Revision-Date: 2015-10-12 10:14+\n" +"POT-Creation-Date: 2016-06-30 16:40+0300\n" +"PO-Revision-Date: 2016-06-30 13:49+\n" "Last-Translator: Dimitriy Ryazantcev \n" "Language-Team: Russian (http://www.transifex.com/djm00n/git-po-ru/language/ru/)\n" "MIME-Version: 1.0\n" @@ -24,11 +24,11 @@ msgstr "" msgid "Couldn't get list of unmerged files:" msgstr "Невозможно получить список файлов незавершённой операции слияния:" -#: gitk:212 gitk:2381 +#: gitk:212 gitk:2399 msgid "Color words" msgstr "Цветные слова" -#: gitk:217 gitk:2381 gitk:8220 gitk:8253 +#: gitk:217 gitk:2399 gitk:8239 gitk:8272 msgid "Markup words" msgstr "Помеченые слова" @@ -58,15 +58,15 @@ msgstr "Ошибка запуска git log:" msgid "Reading" msgstr "Чтение" -#: gitk:496 gitk:4525 +#: gitk:496 gitk:4544 msgid "Reading commits..." msgstr "Чтение коммитов..." -#: gitk:499 gitk:1637 gitk:4528 +#: gitk:499 gitk:1637 gitk:4547 msgid "No commits selected" msgstr "Ничего не выбрано" -#: gitk:1445 gitk:4045 gitk:12432 +#: gitk:1445 gitk:4064 gitk:12469 msgid "Command line" msgstr "Командная строка" @@ -78,1252 +78,1268 @@ msgstr "Ошибка обработки вывода команды git log:" msgid "No commit information available" msgstr "Нет информации о коммите" -#: gitk:1903 gitk:1932 gitk:4315 gitk:9669 gitk:11241 gitk:11521 +#: gitk:1903 gitk:1932 gitk:4334 gitk:9702 gitk:11274 gitk:11554 msgid "OK" msgstr "Ok" -#: gitk:1934 gitk:4317 gitk:9196 gitk:9275 gitk:9391 gitk:9440 gitk:9671 -#: gitk:11242 gitk:11522 +#: gitk:1934 gitk:4336 gitk:9215 gitk:9294 gitk:9424 gitk:9473 gitk:9704 +#: gitk:11275 gitk:11555 msgid "Cancel" msgstr "Отмена" -#: gitk:2069 +#: gitk:2083 msgid "&Update" msgstr "Обновить" -#: gitk:2070 +#: gitk:2084 msgid "&Reload" msgstr "Перечитать" -#: gitk:2071 +#: gitk:2085 msgid "Reread re&ferences" msgstr "Обновить список ссылок" -#: gitk:2072 +#: gitk:2086 msgid "&List references" msgstr "Список ссылок" -#: gitk:2074 +#: gitk:2088 msgid "Start git &gui" msgstr "Запустить git gui" -#: gitk:2076 +#: gitk:2090 msgid "&Quit" msgstr "Завершить" -#: gitk:2068 +#: gitk:2082 msgid "&File" msgstr "Файл" -#: gitk:2080 +#: gitk:2094 msgid "&Preferences" msgstr "Настройки" -#: gitk:2079 +#: gitk:2093 msgid "&Edit" msgstr "Редактировать" -#: gitk:2084 +#: gitk:2098 msgid "&New view..." msgstr "Новое представление..." -#: gitk:2085 +#: gitk:2099 msgid "&Edit view..." msgstr "Редактировать представление..." -#: gitk:2086 +#: gitk:2100 msgid "&Delete view" msgstr "Удалить представление" -#: gitk:2088 gitk:4043 +#: gitk:2102 msgid "&All files" msgstr "Все файлы" -#: gitk:2083 gitk:4067 +#: gitk:2097 msgid "&View" msgstr "Представление" -#: gitk:2093 gitk:2103 gitk:3012 +#: gitk:2107 gitk:2117 msgid "&About gitk" msgstr "О gitk" -#: gitk:2094 gitk:2108 +#: gitk:2108 gitk:2122 msgid "&Key bindings" msgstr "Назначения клавиатуры" -#: gitk:2092 gitk:2107 +#: gitk:2106 gitk:2121 msgid "&Help" msgstr "Подсказка" -#: gitk:2185 gitk:8652 +#: gitk:2199 gitk:8671 msgid "SHA1 ID:" msgstr "SHA1 ID:" -#: gitk:2229 +#: gitk:2243 msgid "Row" msgstr "Строка" -#: gitk:2267 +#: gitk:2281 msgid "Find" msgstr "Поиск" -#: gitk:2295 +#: gitk:2309 msgid "commit" msgstr "коммит" -#: gitk:2299 gitk:2301 gitk:4687 gitk:4710 gitk:4734 gitk:6755 gitk:6827 -#: gitk:6912 +#: gitk:2313 gitk:2315 gitk:4706 gitk:4729 gitk:4753 gitk:6774 gitk:6846 +#: gitk:6931 msgid "containing:" msgstr "содержащее:" -#: gitk:2302 gitk:3526 gitk:3531 git
[PATCH] git-gui: Update translation template
Signed-off-by: Dimitriy Ryazantcev --- po/git-gui.pot | 2203 +++- 1 file changed, 1205 insertions(+), 998 deletions(-) diff --git a/po/git-gui.pot b/po/git-gui.pot index 0c94f9c..634af68 100644 --- a/po/git-gui.pot +++ b/po/git-gui.pot @@ -8,41 +8,42 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-01-26 15:47-0800\n" +"POT-Creation-Date: 2016-10-06 12:00+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: git-gui.sh:41 git-gui.sh:793 git-gui.sh:807 git-gui.sh:820 git-gui.sh:903 -#: git-gui.sh:922 -msgid "git-gui: fatal error" -msgstr "" - -#: git-gui.sh:743 +#: git-gui.sh:865 #, tcl-format msgid "Invalid font specified in %s:" msgstr "" -#: git-gui.sh:779 +#: git-gui.sh:919 msgid "Main Font" msgstr "" -#: git-gui.sh:780 +#: git-gui.sh:920 msgid "Diff/Console Font" msgstr "" -#: git-gui.sh:794 +#: git-gui.sh:935 git-gui.sh:949 git-gui.sh:962 git-gui.sh:1052 git-gui.sh:1071 +#: git-gui.sh:3147 +msgid "git-gui: fatal error" +msgstr "" + +#: git-gui.sh:936 msgid "Cannot find git in PATH." msgstr "" -#: git-gui.sh:821 +#: git-gui.sh:963 msgid "Cannot parse Git version string:" msgstr "" -#: git-gui.sh:839 +#: git-gui.sh:988 #, tcl-format msgid "" "Git version cannot be determined.\n" @@ -54,473 +55,501 @@ msgid "" "Assume '%s' is version 1.5.0?\n" msgstr "" -#: git-gui.sh:1128 +#: git-gui.sh:1285 msgid "Git directory not found:" msgstr "" -#: git-gui.sh:1146 +#: git-gui.sh:1319 msgid "Cannot move to top of working directory:" msgstr "" -#: git-gui.sh:1154 +#: git-gui.sh:1327 msgid "Cannot use bare repository:" msgstr "" -#: git-gui.sh:1162 +#: git-gui.sh:1335 msgid "No working directory" msgstr "" -#: git-gui.sh:1334 lib/checkout_op.tcl:306 +#: git-gui.sh:1507 lib/checkout_op.tcl:306 msgid "Refreshing file status..." msgstr "" -#: git-gui.sh:1390 +#: git-gui.sh:1567 msgid "Scanning for modified files ..." msgstr "" -#: git-gui.sh:1454 +#: git-gui.sh:1645 msgid "Calling prepare-commit-msg hook..." msgstr "" -#: git-gui.sh:1471 +#: git-gui.sh:1662 msgid "Commit declined by prepare-commit-msg hook." msgstr "" -#: git-gui.sh:1629 lib/browser.tcl:246 +#: git-gui.sh:1820 lib/browser.tcl:252 msgid "Ready." msgstr "" -#: git-gui.sh:1787 +#: git-gui.sh:1984 #, tcl-format -msgid "Displaying only %s of %s files." +msgid "" +"Display limit (gui.maxfilesdisplayed = %s) reached, not showing all %s files." msgstr "" -#: git-gui.sh:1913 +#: git-gui.sh:2107 msgid "Unmodified" msgstr "" -#: git-gui.sh:1915 +#: git-gui.sh:2109 msgid "Modified, not staged" msgstr "" -#: git-gui.sh:1916 git-gui.sh:1924 +#: git-gui.sh:2110 git-gui.sh:2122 msgid "Staged for commit" msgstr "" -#: git-gui.sh:1917 git-gui.sh:1925 +#: git-gui.sh:2111 git-gui.sh:2123 msgid "Portions staged for commit" msgstr "" -#: git-gui.sh:1918 git-gui.sh:1926 +#: git-gui.sh:2112 git-gui.sh:2124 msgid "Staged for commit, missing" msgstr "" -#: git-gui.sh:1920 +#: git-gui.sh:2114 msgid "File type changed, not staged" msgstr "" -#: git-gui.sh:1921 +#: git-gui.sh:2115 git-gui.sh:2116 +msgid "File type changed, old type staged for commit" +msgstr "" + +#: git-gui.sh:2117 msgid "File type changed, staged" msgstr "" -#: git-gui.sh:1923 +#: git-gui.sh:2118 +msgid "File type change staged, modification not staged" +msgstr "" + +#: git-gui.sh:2119 +msgid "File type change staged, file missing" +msgstr "" + +#: git-gui.sh:2121 msgid "Untracked, not staged" msgstr "" -#: git-gui.sh:1928 +#: git-gui.sh:2126 msgid "Missing" msgstr "" -#: git-gui.sh:1929 +#: git-gui.sh:2127 msgid "Staged for removal" msgstr "" -#: git-gui.sh:1930 +#: git-gui.sh:2128 msgid "Staged for removal, still present" msgstr "" -#: git-gui.sh:1932 git-gui.sh:1933 git-gui.sh:1934 git-gui.sh:1935 -#: git-gui.sh:1936 git-gui.sh:1937 +#: git-gui.sh:2130 git-gui.sh:2131 gi
[PATCH] gitk: Update Russian translation
I updated Russian translation for gitk. Please feel free to add any sugessions on Git Russian Localization Project: https://www.transifex.com/djm00n/git-po-ru/language/ru/ Patch is against current git://ozlabs.org/~paulus/gitk master branch. Dimitriy Ryazantcev (1): gitk: Update Russian translation po/ru.po | 401 +-- 1 file changed, 161 insertions(+), 240 deletions(-) -- 2.6.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] gitk: Update Russian translation
Signed-off-by: Dimitriy Ryazantcev --- po/ru.po | 401 +-- 1 file changed, 161 insertions(+), 240 deletions(-) diff --git a/po/ru.po b/po/ru.po index f1bac87..4bec810 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1,18 +1,24 @@ -# # Translation of gitk to Russian. -# +# +# Translators: +# 0xAX , 2014 +# Alex Riesen , 2015 +# Dimitriy Ryazantcev , 2015 +# Dmitry Potapov , 2009 +# Skip , 2011 msgid "" msgstr "" -"Project-Id-Version: gitk\n" +"Project-Id-Version: Git Russian Localization Project\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-17 14:32+1000\n" -"PO-Revision-Date: 2009-04-24 16:00+0200\n" -"Last-Translator: Alex Riesen \n" -"Language-Team: Russian\n" -"Language: \n" +"PO-Revision-Date: 2015-10-12 10:14+\n" +"Last-Translator: Dimitriy Ryazantcev \n" +"Language-Team: Russian (http://www.transifex.com/djm00n/git-po-ru/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" #: gitk:140 msgid "Couldn't get list of unmerged files:" @@ -20,15 +26,15 @@ msgstr "Невозможно получить список файлов неза #: gitk:212 gitk:2381 msgid "Color words" -msgstr "" +msgstr "Цветные слова" #: gitk:217 gitk:2381 gitk:8220 gitk:8253 msgid "Markup words" -msgstr "" +msgstr "Помеченые слова" #: gitk:324 msgid "Error parsing revisions:" -msgstr "Ошибка в идентификаторе версии:" +msgstr "Ошибка при разборе редакции:" #: gitk:380 msgid "Error executing --argscmd command:" @@ -36,17 +42,13 @@ msgstr "Ошибка выполнения команды заданной --args #: gitk:393 msgid "No files selected: --merge specified but no files are unmerged." -msgstr "" -"Файлы не выбраны: указан --merge, но не было найдено ни одного файла где эта " -"операция должна быть завершена." +msgstr "Файлы не выбраны: указан --merge, но не было найдено ни одного файла где эта операция должна быть завершена." #: gitk:396 msgid "" "No files selected: --merge specified but no unmerged files are within file " "limit." -msgstr "" -"Файлы не выбраны: указан --merge, но в рамках указанного ограничения на " -"имена файлов нет ни одного где эта операция должна быть завершена." +msgstr "Файлы не выбраны: указан --merge, но в рамках указанного ограничения на имена файлов нет ни одного где эта операция должна быть завершена." #: gitk:418 gitk:566 msgid "Error executing git log:" @@ -58,7 +60,7 @@ msgstr "Чтение" #: gitk:496 gitk:4525 msgid "Reading commits..." -msgstr "Чтение версий..." +msgstr "Чтение коммитов..." #: gitk:499 gitk:1637 gitk:4528 msgid "No commits selected" @@ -74,7 +76,7 @@ msgstr "Ошибка обработки вывода команды git log:" #: gitk:1740 msgid "No commit information available" -msgstr "Нет информации о состоянии" +msgstr "Нет информации о коммите" #: gitk:1903 gitk:1932 gitk:4315 gitk:9669 gitk:11241 gitk:11521 msgid "OK" @@ -167,7 +169,7 @@ msgstr "Поиск" #: gitk:2295 msgid "commit" -msgstr "состояние" +msgstr "коммит" #: gitk:2299 gitk:2301 gitk:4687 gitk:4710 gitk:4734 gitk:6755 gitk:6827 #: gitk:6912 @@ -184,7 +186,7 @@ msgstr "добавив/удалив строку:" #: gitk:2304 gitk:4779 msgid "changing lines matching:" -msgstr "" +msgstr "изменяя совпадающие строки:" #: gitk:2313 gitk:2315 gitk:4766 msgid "Exact" @@ -217,7 +219,7 @@ msgstr "Автор" #: gitk:2319 gitk:4871 gitk:6786 gitk:7326 msgid "Committer" -msgstr "Сохранивший состояние" +msgstr "Коммитер" #: gitk:2350 msgid "Search" @@ -245,7 +247,7 @@ msgstr "Игнорировать пробелы" #: gitk:2378 gitk:2380 gitk:7959 gitk:8206 msgid "Line diff" -msgstr "" +msgstr "Изменения строк" #: gitk:2445 msgid "Patch" @@ -257,11 +259,11 @@ msgstr "Файлы" #: gitk:2617 gitk:2637 msgid "Diff this -> selected" -msgstr "Сравнить это состояние с выделенным" +msgstr "Сравнить этот коммит с выделенным" #: gitk:2618 gitk:2638 msgid "Diff selected -> this" -msgstr "Сравнит
[PATCH] git-gui: Update Russian translation
I updated Russian translation for git-gui. Please feel free to add any sugessions on Git Russian Localization Project: https://www.transifex.com/djm00n/git-po-ru/language/ru/ Patch is against current git://repo.or.cz/git-gui.git master branch. Dimitriy Ryazantcev (1): git-gui: Update Russian translation po/ru.po | 675 +++ 1 file changed, 247 insertions(+), 428 deletions(-) -- 2.6.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] git-gui: Update Russian translation
>This section seems wrong as it replaces the existing copyright notice >with some auto-generated junk. As it is a translation I should think the >copyright is with the translators but it should not be using default >placeholders. Sorry for that. It seems that a Transifex bug, I uploaded po with copyrights to them. Sent a mail to Transifex support. For now I replaced it manually. Dimitriy Ryazantcev (1): git-gui: Update Russian translation po/ru.po | 668 +++ 1 file changed, 243 insertions(+), 425 deletions(-) -- 2.6.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] l10n: localizable upload progress messages
Signed-off-by: Dimitriy Ryazantcev --- progress.c | 3 ++- strbuf.c | 8 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..3d47c06495 100644 --- a/progress.c +++ b/progress.c @@ -151,7 +151,8 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + /* TRANSLATORS: per second */ + strbuf_addstr(buf, _("/s")); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..c309df1f5e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -814,19 +814,19 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + strbuf_addf(buf, _("%u.%2.2u GiB"), (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + strbuf_addf(buf, _("%u.%2.2u MiB"), x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + strbuf_addf(buf, _("%u.%2.2u KiB"), x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + strbuf_addf(buf, _("%u bytes"), (unsigned)bytes); } } -- 2.22.0
[PATCH v2] l10n: localizable upload progress messages
Signed-off-by: Dimitriy Ryazantcev --- progress.c | 4 +++- strbuf.c | 16 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..61d8cf5d04 100644 --- a/progress.c +++ b/progress.c @@ -151,7 +151,9 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + strbuf_addstr(buf, "/"); + /* TRANSLATORS: IEC 8-13:2008, subclause 13-12.b: second */ + strbuf_addstr(buf, _("s")); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..62144e755c 100644 --- a/strbuf.c +++ b/strbuf.c @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + strbuf_addf(buf, "%u.%2.2u ", (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: gibi */ + strbuf_addf(buf, _("Gi")); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: mebi */ + strbuf_addf(buf, _("Mi")); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: kibi */ + strbuf_addf(buf, _("Ki")); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + strbuf_addf(buf, "%u ", (unsigned)bytes); } + /* TRANSLATORS: ISO/IEC 8-13:2008, subclause 13-9.c: byte */ + strbuf_addf(buf, _("B")); } void strbuf_add_absolute_path(struct strbuf *sb, const char *path) -- 2.22.0
[PATCH v3] l10n: localizable upload progress messages
Signed-off-by: Dimitriy Ryazantcev --- progress.c | 4 +++- strbuf.c | 16 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..61d8cf5d04 100644 --- a/progress.c +++ b/progress.c @@ -151,7 +151,9 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + strbuf_addstr(buf, "/"); + /* TRANSLATORS: IEC 8-13:2008, subclause 13-12.b: second */ + strbuf_addstr(buf, _("s")); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..0a3ebc3749 100644 --- a/strbuf.c +++ b/strbuf.c @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + strbuf_addf(buf, "%u.%2.2u ", (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: gibi */ + strbuf_addstr(buf, _("Gi")); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: mebi */ + strbuf_addstr(buf, _("Mi")); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); + /* TRANSLATORS: ISO/IEC 8-13:2008, clause 4: kibi */ + strbuf_addstr(buf, _("Ki")); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + strbuf_addf(buf, "%u ", (unsigned)bytes); } + /* TRANSLATORS: ISO/IEC 8-13:2008, subclause 13-9.c: byte */ + strbuf_addstr(buf, _("B")); } void strbuf_add_absolute_path(struct strbuf *sb, const char *path) -- 2.22.0
[PATCH v4] l10n: localizable upload progress messages
Signed-off-by: Dimitriy Ryazantcev --- progress.c | 4 +++- strbuf.c | 16 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..fc62941fa4 100644 --- a/progress.c +++ b/progress.c @@ -151,7 +151,9 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + strbuf_addstr(buf, "/"); + /* TRANSLATORS: unit symbol for IEC 8-13:2008 second */ + strbuf_addstr(buf, _("s")); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..706b3b8e42 100644 --- a/strbuf.c +++ b/strbuf.c @@ -814,19 +814,27 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + strbuf_addf(buf, "%u.%2.2u ", (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); + /* TRANSLATORS: unit symbol for IEC 8-13:2008 gibibyte */ + strbuf_addstr(buf, _("GiB")); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); + /* TRANSLATORS: unit symbol for IEC 8-13:2008 mebibyte */ + strbuf_addstr(buf, _("MiB")); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + strbuf_addf(buf, "%u.%2.2u ", x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); + /* TRANSLATORS: unit symbol for IEC 8-13:2008 kibibyte */ + strbuf_addstr(buf, _("KiB")); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + strbuf_addf(buf, "%u ", (unsigned)bytes); + /* TRANSLATORS: unit symbol for IEC 8-13:2008 byte */ + strbuf_addstr(buf, _("B")); } } -- 2.22.0
[PATCH v5] l10n: localizable upload progress messages
Currenly the data rate in throughput_string(...) method is output by simple strbuf_humanise_bytes(...) call and '/s' append. But for proper translation of such string the translator needs full context. Add strbuf_humanise_rate(...) method to properly print out localizable version of data rate ('3.5 MiB/s' etc) with full context. Strings with the units in strbuf_humanise_bytes(...) are marked for translation. Signed-off-by: Dimitriy Ryazantcev --- progress.c | 3 +-- strbuf.c | 37 + strbuf.h | 6 ++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..951f7c7461 100644 --- a/progress.c +++ b/progress.c @@ -150,8 +150,7 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_addstr(buf, ", "); strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); - strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + strbuf_humanise_rate(buf, rate * 1024); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..785c9e5b55 100644 --- a/strbuf.c +++ b/strbuf.c @@ -814,19 +814,48 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + /* TRANSLATORS: IEC 8-13:2008 gibibyte */ + strbuf_addf(buf, _("%u.%2.2u GiB"), (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + /* TRANSLATORS: IEC 8-13:2008 mebibyte */ + strbuf_addf(buf, _("%u.%2.2u MiB"), x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); + strbuf_addstr(buf, _("")); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + /* TRANSLATORS: IEC 8-13:2008 kibibyte */ + strbuf_addf(buf, _("%u.%2.2u KiB"), x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + /* TRANSLATORS: IEC 8-13:2008 byte */ + strbuf_addf(buf, Q_("%u byte", "%u bytes", (unsigned)bytes), (unsigned)bytes); + } +} + +void strbuf_humanise_rate(struct strbuf *buf, off_t bytes) +{ + if (bytes > 1 << 30) { + /* TRANSLATORS: IEC 8-13:2008 gibibyte/second */ + strbuf_addf(buf, _("%u.%2.2u GiB/s"), + (unsigned)(bytes >> 30), + (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); + } else if (bytes > 1 << 20) { + unsigned x = bytes + 5243; /* for rounding */ + /* TRANSLATORS: IEC 8-13:2008 mebibyte/second */ + strbuf_addf(buf, _("%u.%2.2u MiB/s"), + x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); + strbuf_addstr(buf, _("")); + } else if (bytes > 1 << 10) { + unsigned x = bytes + 5; /* for rounding */ + /* TRANSLATORS: IEC 8-13:2008 kibibyte/second */ + strbuf_addf(buf, _("%u.%2.2u KiB/s"), + x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); + } else { + /* TRANSLATORS: IEC 8-13:2008 byte/second */ + strbuf_addf(buf, Q_("%u byte/s", "%u bytes/s", (unsigned)bytes), (unsigned)bytes); } } diff --git a/strbuf.h b/strbuf.h index c8d98dfb95..f62278a0be 100644 --- a/strbuf.h +++ b/strbuf.h @@ -372,6 +372,12 @@ void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src); */ void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes); +/** + * Append the given byte rate as a human-readable string (i.e. 12.23 KiB/s, + * 3.50 MiB/s). + */ +void strbuf_humanise_rate(struct strbuf *buf, off_t bytes); + /** * Add a formatted string to the buffer. */ -- 2.22.0
[PATCH v6] l10n: localizable upload progress messages
Currenly the data rate in throughput_string(...) method is output by simple strbuf_humanise_bytes(...) call and '/s' append. But for proper translation of such string the translator needs full context. Add strbuf_humanise_rate(...) method to properly print out localizable version of data rate ('3.5 MiB/s' etc) with full context. Strings with the units in strbuf_humanise_bytes(...) are marked for translation. Signed-off-by: Dimitriy Ryazantcev --- progress.c | 3 +-- strbuf.c | 42 +- strbuf.h | 6 ++ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/progress.c b/progress.c index a2e8cf64a8..951f7c7461 100644 --- a/progress.c +++ b/progress.c @@ -150,8 +150,7 @@ static void throughput_string(struct strbuf *buf, uint64_t total, strbuf_addstr(buf, ", "); strbuf_humanise_bytes(buf, total); strbuf_addstr(buf, " | "); - strbuf_humanise_bytes(buf, rate * 1024); - strbuf_addstr(buf, "/s"); + strbuf_humanise_rate(buf, rate * 1024); } void display_throughput(struct progress *progress, uint64_t total) diff --git a/strbuf.c b/strbuf.c index 0e18b259ce..d30f916858 100644 --- a/strbuf.c +++ b/strbuf.c @@ -811,25 +811,57 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, strbuf_add_urlencode(sb, s, strlen(s), reserved); } -void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) +static void strbuf_humanise(struct strbuf *buf, off_t bytes, +int humanise_rate) { if (bytes > 1 << 30) { - strbuf_addf(buf, "%u.%2.2u GiB", + strbuf_addf(buf, + humanise_rate == 0 ? + /* TRANSLATORS: IEC 8-13:2008 gibibyte */ + _("%u.%2.2u GiB") : + /* TRANSLATORS: IEC 8-13:2008 gibibyte/second */ + _("%u.%2.2u GiB/s"), (unsigned)(bytes >> 30), (unsigned)(bytes & ((1 << 30) - 1)) / 10737419); } else if (bytes > 1 << 20) { unsigned x = bytes + 5243; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u MiB", + strbuf_addf(buf, + humanise_rate == 0 ? + /* TRANSLATORS: IEC 8-13:2008 mebibyte */ + _("%u.%2.2u MiB") : + /* TRANSLATORS: IEC 8-13:2008 mebibyte/second */ + _("%u.%2.2u MiB/s"), x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20); } else if (bytes > 1 << 10) { unsigned x = bytes + 5; /* for rounding */ - strbuf_addf(buf, "%u.%2.2u KiB", + strbuf_addf(buf, + humanise_rate == 0 ? + /* TRANSLATORS: IEC 8-13:2008 kibibyte */ + _("%u.%2.2u KiB") : + /* TRANSLATORS: IEC 8-13:2008 kibibyte/second */ + _("%u.%2.2u KiB/s"), x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); } else { - strbuf_addf(buf, "%u bytes", (unsigned)bytes); + strbuf_addf(buf, + humanise_rate == 0 ? + /* TRANSLATORS: IEC 8-13:2008 byte */ + Q_("%u byte", "%u bytes", (unsigned)bytes) : + /* TRANSLATORS: IEC 8-13:2008 byte/second */ + Q_("%u byte/s", "%u bytes/s", (unsigned)bytes), + (unsigned)bytes); } } +void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes) +{ + strbuf_humanise(buf, bytes, 0); +} + +void strbuf_humanise_rate(struct strbuf *buf, off_t bytes) +{ + strbuf_humanise(buf, bytes, 1); +} + void strbuf_add_absolute_path(struct strbuf *sb, const char *path) { if (!*path) diff --git a/strbuf.h b/strbuf.h index c8d98dfb95..f62278a0be 100644 --- a/strbuf.h +++ b/strbuf.h @@ -372,6 +372,12 @@ void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src); */ void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes); +/** + * Append the given byte rate as a human-readable string (i.e. 12.23 KiB/s, + * 3.50 MiB/s). + */ +void strbuf_humanise_rate(struct strbuf *buf, off_t bytes); + /** * Add a formatted string to the buffer. */ -- 2.22.0