Skip to content

Commit 2340bb3

Browse files
bitigchiflatcap
andcommitted
i18n: Localisation for percentages
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. Co-authored-by: Richard Russon <rich@flatcap.org>
1 parent 91f6b70 commit 2340bb3

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

pager/pbar.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ static int pbar_recalc(struct MuttWindow *win)
110110

111111
if (offset < (priv->st.st_size - 1))
112112
{
113-
snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%",
114-
(100 * offset / priv->st.st_size));
113+
const long percent = (100 * offset) / priv->st.st_size;
114+
/* L10N: Pager position percentage.
115+
`%ld` is the number, `%%` is the percent symbol.
116+
They may be reordered, or space inserted, if you wish. */
117+
snprintf(pager_progress_str, sizeof(pager_progress_str), _("%ld%%"), percent);
115118
}
116119
else
117120
{

progress/window.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,28 @@ static int progress_window_repaint(struct MuttWindow *win)
162162

163163
if (wdata->size == 0)
164164
{
165-
message_bar(wdata->win, wdata->display_percent, "%s %zu (%d%%)", wdata->msg,
165+
/* L10N: Progress bar: `%s` loading text, `%zu` item count,
166+
`%d` percentage, `%%` is the percent symbol.
167+
`%d` and `%%` may be reordered, or space inserted, if you wish. */
168+
message_bar(wdata->win, wdata->display_percent, _("%s %zu (%d%%)"), wdata->msg,
166169
wdata->display_pos, wdata->display_percent);
167170
}
168171
else
169172
{
170173
if (wdata->is_bytes)
171174
{
172-
message_bar(wdata->win, wdata->display_percent, "%s %s/%s (%d%%)", wdata->msg,
175+
/* L10N: Progress bar: `%s` loading text, `%s/%s` position/size,
176+
`%d` is the number, `%%` is the percent symbol.
177+
`%d` and `%%` may be reordered, or space inserted, if you wish. */
178+
message_bar(wdata->win, wdata->display_percent, _("%s %s/%s (%d%%)"), wdata->msg,
173179
wdata->pretty_pos, wdata->pretty_size, wdata->display_percent);
174180
}
175181
else
176182
{
177-
message_bar(wdata->win, wdata->display_percent, "%s %zu/%zu (%d%%)", wdata->msg,
183+
/* L10N: Progress bar: `%s` loading text, `%zu/%zu` position/size,
184+
`%d` is the number, `%%` is the percent symbol.
185+
`%d` and `%%` may be reordered, or space inserted, if you wish. */
186+
message_bar(wdata->win, wdata->display_percent, _("%s %zu/%zu (%d%%)"), wdata->msg,
178187
wdata->display_pos, wdata->size, wdata->display_percent);
179188
}
180189
}

status.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
296296
else
297297
{
298298
int count = (100 * (menu->top + menu->page_len)) / menu->max;
299-
snprintf(tmp, sizeof(tmp), "%d%%", count);
299+
/* L10N: Status bar, percentage of way through index.
300+
`%d` is the number, `%%` is the percent symbol.
301+
They may be reordered, or space inserted, if you wish. */
302+
snprintf(tmp, sizeof(tmp), _("%d%%"), count);
300303
cp = tmp;
301304
}
302305
snprintf(fmt, sizeof(fmt), "%%%ss", prec);

0 commit comments

Comments
 (0)