{"thread":{"id":"59750","subject":"[PATCH] i18n: Enable percentage l10n for more strings","startedAt":"2023-05-16T10:25:38Z","lastAt":"2023-06-02T19:36:45Z","messageCount":2,"participants":["Emir SARI"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"477382","messageId":"20230516101911.93809-1-emir_sari@icloud.com","threadId":"59750","inReplyTo":null,"subject":"[PATCH] i18n: Enable percentage l10n for more strings","fromName":"Emir SARI","fromEmail":"emir_sari@icloud.com","sentAt":"2023-05-16T10:19:11Z","receivedAt":"2023-05-16T10:25:38Z","isPatch":true,"sender":{"key":"emir_sari@icloud.com","avatar":"https://avatars.githubusercontent.com/u/2769571?v=4"},"body":"This enables percentage localization in more progress views, and\nprovides a more cohesive l10n environment among the translated messages.\n---\n apply.c    |  8 ++++----\n progress.c | 18 ++++++++++++++++--\n 2 files changed, 20 insertions(+), 6 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 6212ab3..3e1d08d 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -4247,11 +4247,11 @@ static void show_rename_copy(struct patch *p)\n \t * new_name through the end of names are renames\n \t */\n \tif (old_name != p->old_name)\n-\t\tprintf(\" %s %.*s{%s => %s} (%d%%)\\n\", renamecopy,\n+\t\tprintf(_(\" %s %.*s{%s => %s} (%d%%)\\n\"), renamecopy,\n \t\t       (int)(old_name - p->old_name), p->old_name,\n \t\t       old_name, new_name, p->score);\n \telse\n-\t\tprintf(\" %s %s => %s (%d%%)\\n\", renamecopy,\n+\t\tprintf(_(\" %s %s => %s (%d%%)\\n\"), renamecopy,\n \t\t       p->old_name, p->new_name, p->score);\n \tshow_mode_change(p, 0);\n }\n@@ -4270,8 +4270,8 @@ static void summary_patch_list(struct patch *patch)\n \t\t\t\tshow_rename_copy(p);\n \t\t\telse {\n \t\t\t\tif (p->score) {\n-\t\t\t\t\tprintf(\" rewrite %s (%d%%)\\n\",\n-\t\t\t\t\t       p->new_name, p->score);\n+\t\t\t\t\tprintf(\" rewrite %s \", p->new_name);\n+\t\t\t\t\tprintf(_(\"(%d%%)\\n\"), p->score);\n \t\t\t\t\tshow_mode_change(p, 0);\n \t\t\t\t}\n \t\t\t\telse\ndiff --git a/progress.c b/progress.c\nindex f695798..1f8d372 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -124,10 +124,24 @@ static void display(struct progress *progress, uint64_t n, const char *done)\n \t\t\tprogress->last_percent = percent;\n \n \t\t\tstrbuf_reset(counters_sb);\n-\t\t\tstrbuf_addf(counters_sb,\n-\t\t\t\t    \"%3u%% (%\"PRIuMAX\"/%\"PRIuMAX\")%s\", percent,\n+\n+\t\t\tstruct strbuf progress_sb = STRBUF_INIT;\n+\t\t\tstrbuf_addf(&progress_sb,\n+\t\t\t\t_(\"%u%% (%\"PRIuMAX\"/%\"PRIuMAX\")%s\"), percent,\n \t\t\t\t    (uintmax_t)n, (uintmax_t)progress->total,\n \t\t\t\t    tp);\n+\t\t\tstruct strbuf progress_str = STRBUF_INIT;\n+\t\t\tstrbuf_addstr(&progress_str, progress_sb.buf);\n+\t\t\tstrbuf_release(&progress_sb);\n+\n+\t\t\tif (percent < 10)\n+\t\t\t    strbuf_insert(&progress_str, 0, \"  \", 2);\n+\t\t\telse if (percent < 100)\n+\t\t\t    strbuf_insert(&progress_str, 0, \" \", 1);\n+\n+\t\t\tstrbuf_addf(counters_sb, \"%s\", progress_str.buf);\n+\t\t\tstrbuf_release(&progress_str);\n+\n \t\t\tshow_update = 1;\n \t\t}\n \t} else if (progress_update) {\n-- \n2.40.1\n\n"},{"id":"477984","messageId":"9C76C476-0E54-4980-8138-EB9077E00523@icloud.com","threadId":"59750","inReplyTo":"20230516101911.93809-1-emir_sari@icloud.com","subject":"Re: [PATCH] i18n: Enable percentage l10n for more strings","fromName":"Emir SARI","fromEmail":"emir_sari@icloud.com","sentAt":"2023-06-02T19:36:08Z","receivedAt":"2023-06-02T19:36:45Z","isPatch":true,"sender":{"key":"emir_sari@icloud.com","avatar":"https://avatars.githubusercontent.com/u/2769571?v=4"},"body":"Hello,\n\nPing, in case this got buried down the list.\n\n> Emir SARI <emir_sari@icloud.com> şunları yazdı (16 May 2023 13:19):\n> \n> This enables percentage localization in more progress views, and\n> provides a more cohesive l10n environment among the translated messages.\n> ---\n> apply.c    |  8 ++++----\n> progress.c | 18 ++++++++++++++++--\n> 2 files changed, 20 insertions(+), 6 deletions(-)\n> \n> diff --git a/apply.c b/apply.c\n> index 6212ab3..3e1d08d 100644\n> --- a/apply.c\n> +++ b/apply.c\n> @@ -4247,11 +4247,11 @@ static void show_rename_copy(struct patch *p)\n> * new_name through the end of names are renames\n> */\n> if (old_name != p->old_name)\n> - printf(\" %s %.*s{%s => %s} (%d%%)\\n\", renamecopy,\n> + printf(_(\" %s %.*s{%s => %s} (%d%%)\\n\"), renamecopy,\n>       (int)(old_name - p->old_name), p->old_name,\n>       old_name, new_name, p->score);\n> else\n> - printf(\" %s %s => %s (%d%%)\\n\", renamecopy,\n> + printf(_(\" %s %s => %s (%d%%)\\n\"), renamecopy,\n>       p->old_name, p->new_name, p->score);\n> show_mode_change(p, 0);\n> }\n> @@ -4270,8 +4270,8 @@ static void summary_patch_list(struct patch *patch)\n> show_rename_copy(p);\n> else {\n> if (p->score) {\n> - printf(\" rewrite %s (%d%%)\\n\",\n> -       p->new_name, p->score);\n> + printf(\" rewrite %s \", p->new_name);\n> + printf(_(\"(%d%%)\\n\"), p->score);\n> show_mode_change(p, 0);\n> }\n> else\n> diff --git a/progress.c b/progress.c\n> index f695798..1f8d372 100644\n> --- a/progress.c\n> +++ b/progress.c\n> @@ -124,10 +124,24 @@ static void display(struct progress *progress, uint64_t n, const char *done)\n> progress->last_percent = percent;\n> \n> strbuf_reset(counters_sb);\n> - strbuf_addf(counters_sb,\n> -    \"%3u%% (%\"PRIuMAX\"/%\"PRIuMAX\")%s\", percent,\n> +\n> + struct strbuf progress_sb = STRBUF_INIT;\n> + strbuf_addf(&progress_sb,\n> + _(\"%u%% (%\"PRIuMAX\"/%\"PRIuMAX\")%s\"), percent,\n>    (uintmax_t)n, (uintmax_t)progress->total,\n>    tp);\n> + struct strbuf progress_str = STRBUF_INIT;\n> + strbuf_addstr(&progress_str, progress_sb.buf);\n> + strbuf_release(&progress_sb);\n> +\n> + if (percent < 10)\n> +    strbuf_insert(&progress_str, 0, \"  \", 2);\n> + else if (percent < 100)\n> +    strbuf_insert(&progress_str, 0, \" \", 1);\n> +\n> + strbuf_addf(counters_sb, \"%s\", progress_str.buf);\n> + strbuf_release(&progress_str);\n> +\n> show_update = 1;\n> }\n> } else if (progress_update) {\n> -- \n> 2.40.1\n> \n\nBest regards,\nEmir (𐰽𐰺𐰍)\n\n** E-mail needs to stay simple\n** Use plain text e-mail\n\n"}]}