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 <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dimitriy Ryazantcev
2019-07-02 21:22:48 +03:00
committed by Junio C Hamano
parent 8dca754b1e
commit 8f354a1fae
3 changed files with 44 additions and 7 deletions

View File

@ -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.
*/