* [PATCH v2] i18n: Enable percentage l10n for more strings
@ 2023-06-23 19:48 Emir SARI
0 siblings, 0 replies; only message in thread
From: Emir SARI @ 2023-06-23 19:48 UTC (permalink / raw
To: git; +Cc: Emir SARI
This enables percentage localization in more progress views, and
provides a more cohesive l10n environment among the translated messages.
---
progress.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/progress.c b/progress.c
index f695798aca..1f8d372284 100644
--- a/progress.c
+++ b/progress.c
@@ -124,10 +124,24 @@ static void display(struct progress *progress, uint64_t n, const char *done)
progress->last_percent = percent;
strbuf_reset(counters_sb);
- strbuf_addf(counters_sb,
- "%3u%% (%"PRIuMAX"/%"PRIuMAX")%s", percent,
+
+ struct strbuf progress_sb = STRBUF_INIT;
+ strbuf_addf(&progress_sb,
+ _("%u%% (%"PRIuMAX"/%"PRIuMAX")%s"), percent,
(uintmax_t)n, (uintmax_t)progress->total,
tp);
+ struct strbuf progress_str = STRBUF_INIT;
+ strbuf_addstr(&progress_str, progress_sb.buf);
+ strbuf_release(&progress_sb);
+
+ if (percent < 10)
+ strbuf_insert(&progress_str, 0, " ", 2);
+ else if (percent < 100)
+ strbuf_insert(&progress_str, 0, " ", 1);
+
+ strbuf_addf(counters_sb, "%s", progress_str.buf);
+ strbuf_release(&progress_str);
+
show_update = 1;
}
} else if (progress_update) {
--
2.41.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-23 19:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23 19:48 [PATCH v2] i18n: Enable percentage l10n for more strings Emir SARI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).