[PATCH v2] i18n: Apply i18n for percentages
Emir SARI
emir_sari at icloud.com
Thu May 11 19:18:48 UTC 2023
Some languages, including Turkish, French etc. use a different
percentage display format like %100, 100 % respectively. Allowing
percentage i18n makes it more coherent with the system locale settings.
---
curs_lib.c | 11 ++++++++---
pager.c | 7 ++++++-
status.c | 5 ++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/curs_lib.c b/curs_lib.c
index 246cb6be..58d162f1 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -772,14 +772,19 @@ void mutt_progress_update (progress_t* progress, long pos, int percent)
if (progress->size > 0)
{
- mutt_message ("%s %s/%s (%d%%)", progress->msg, posstr, progress->sizestr,
- percent > 0 ? percent :
+ mutt_message ("%s %s/%s ", progress->msg, posstr, progress->sizestr);
+ /* L10N: Progress bar: `%d` is the number, `%%` is the percent symbol.
+ `%d` and `%%` may be reordered, or space inserted, if you wish. */
+ mutt_message (_("(%d%%)"), percent > 0 ? percent :
(int) (100.0 * (double) progress->pos / progress->size));
}
else
{
if (percent > 0)
- mutt_message ("%s %s (%d%%)", progress->msg, posstr, percent);
+ mutt_message ("%s %s ", progress->msg, posstr);
+ /* L10N: Progress bar: `%d` is the number, `%%` is the percent symbol.
+ `%d` and `%%` may be reordered, or space inserted, if you wish. */
+ mutt_message (_("(%d%%)"), percent);
else
mutt_message ("%s %s", progress->msg, posstr);
}
diff --git a/pager.c b/pager.c
index 8df571ab..67a75814 100644
--- a/pager.c
+++ b/pager.c
@@ -2014,7 +2014,12 @@ static void pager_menu_redraw (MUTTMENU *pager_menu)
hfi.pager_progress = pager_progress_str;
if (rd->last_pos < rd->sb.st_size - 1)
- snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * rd->last_offset / rd->sb.st_size));
+ const long percent = (100 * rd->last_offset) / rd->sb.st_size;
+ /* L10N: Pager position percentage.
+ `%ld` is the number, `%%` is the percent symbol.
+ They may be reordered, or space inserted, if you wish. */
+ snprintf(pager_progress_str, sizeof(pager_progress_str), _("%ld%%"),
+ percent);
else
strfcpy(pager_progress_str, (rd->topline == 0) ? "all" : "end", sizeof(pager_progress_str));
diff --git a/status.c b/status.c
index 107a739f..18dcde70 100644
--- a/status.c
+++ b/status.c
@@ -225,7 +225,10 @@ status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, cons
else
{
count = (100 * (menu->top + menu->pagelen)) / menu->max;
- snprintf (tmp, sizeof (tmp), "%d%%", count);
+ /* L10N: Status bar, percentage of way through index.
+ `%d` is the number, `%%` is the percent symbol.
+ They may be reordered, or space inserted, if you wish. */
+ snprintf (tmp, sizeof (tmp), _("%d%%"), count);
cp = tmp;
}
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
--
2.40.1
More information about the Mutt-po
mailing list