From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: pclouds@gmail.com
Cc: git@vger.kernel.org, gitster@pobox.com, szeder.dev@gmail.com
Subject: [PATCH v3 00/16] Mark more strings for translation
Date: Sat, 10 Nov 2018 06:15:59 +0100 [thread overview]
Message-ID: <20181110051615.8641-1-pclouds@gmail.com> (raw)
In-Reply-To: <20181105192059.20303-1-pclouds@gmail.com>
v3 is just small touchups here and there after the review comments
from v2.
Range-diff against v2:
1: e77c203313 ! 1: 936f84d4b3 git.c: mark more strings for translation
@@ -3,7 +3,7 @@
git.c: mark more strings for translation
One string is slightly updated to keep consistency with the rest:
- die() should with lowercase.
+ die() should begin with lowercase.
diff --git a/git.c b/git.c
--- a/git.c
2: 12c9468696 = 2: 8ff2de14bf alias.c: mark split_cmdline_strerror() strings for translation
3: bf662dc105 = 3: 8e147f6bff archive.c: mark more strings for translation
4: 1d032b0fdf = 4: 5d574460eb attr.c: mark more string for translation
5: 2c3ad8c262 = 5: 8e37efb756 read-cache.c: turn die("internal error") to BUG()
6: df25ac78b1 = 6: 83b7b6d029 read-cache.c: mark more strings for translation
7: 241e5a7450 = 7: 4bd085682d read-cache.c: add missing colon separators
8: 8f60728b0f = 8: fb72be3a1e reflog: mark strings for translation
9: 24d2ed6682 = 9: 711812d70b remote.c: turn some error() or die() to BUG()
10: 26e8cee291 = 10: 0213c1f5eb remote.c: mark messages for translation
11: 2409f76902 = 11: 85459c65ca repack: mark more strings for translation
12: afafe6771c ! 12: 21916a8fb4 parse-options: replace opterror() with optname()
@@ -2,6 +2,11 @@
parse-options: replace opterror() with optname()
+ Introduce optname() that does the early half of original opterror() to
+ come up with the name of the option reported back to the user, and use
+ it to kill opterror(). The callers of opterror() now directly call
+ error() using the string returned by opterror() instead.
+
There are a few issues with opterror()
- it tries to assemble an English sentence from pieces. This is not
@@ -14,8 +19,7 @@
- Since it takes a string instead of printf format, one call site has
to assemble the string manually before passing to it.
- Kill it and produce the option name with optname(). The user will use
- error() directly. This solves the second and third problems.
+ Using error() directly solves the second and third problems.
It kind helps the first problem as well because "%s does foo" does
give a translator a full sentence in a sense and let them reorder if
13: e8b4af8fac = 13: 8c9d2985b5 parse-options.c: turn some die() to BUG()
14: c3530e162e = 14: b81cdeda46 parse-options.c: mark more strings for translation
15: 644c56780c ! 15: dd872fc39b fsck: reduce word legos to help i18n
@@ -19,7 +19,7 @@
- static struct strbuf buf = STRBUF_INIT;
- char *name = name_objects ?
- lookup_decoration(fsck_walk_options.object_names, obj) : NULL;
-+ static struct strbuf bufs[4] = {
++ static struct strbuf bufs[] = {
+ STRBUF_INIT, STRBUF_INIT, STRBUF_INIT, STRBUF_INIT
+ };
+ static int b = 0;
@@ -69,15 +69,18 @@
{
- objreport(obj, (type == FSCK_WARN) ? "warning" : "error", message);
- return (type == FSCK_WARN) ? 0 : 1;
-+ if (type == FSCK_WARN) {
++ switch (type) {
++ case FSCK_WARN:
+ fprintf_ln(stderr, "warning in %s %s: %s",
+ printable_type(obj), describe_object(obj), message);
+ return 0;
++ case FSCK_ERROR:
++ fprintf_ln(stderr, "error in %s %s: %s",
++ printable_type(obj), describe_object(obj), message);
++ return 1;
++ default:
++ BUG("%d (FSCK_IGNORE?) should never trigger this callback", type);
+ }
-+
-+ fprintf_ln(stderr, "error in %s %s: %s",
-+ printable_type(obj), describe_object(obj), message);
-+ return 1;
}
static struct object_array pending;
16: 61af36567b ! 16: 8f1bbd1c65 fsck: mark strings for translation
@@ -28,22 +28,21 @@
return -1;
}
@@
- struct object *obj, int type, const char *message)
{
- if (type == FSCK_WARN) {
+ switch (type) {
+ case FSCK_WARN:
- fprintf_ln(stderr, "warning in %s %s: %s",
+ /* TRANSLATORS: e.g. warning in tree 01bfda: <more explanation> */
+ fprintf_ln(stderr, _("warning in %s %s: %s"),
printable_type(obj), describe_object(obj), message);
return 0;
- }
-
-- fprintf_ln(stderr, "error in %s %s: %s",
-+ /* TRANSLATORS: e.g. error in tree 01bfda: <more explanation> */
-+ fprintf_ln(stderr, _("error in %s %s: %s"),
- printable_type(obj), describe_object(obj), message);
- return 1;
- }
+ case FSCK_ERROR:
+- fprintf_ln(stderr, "error in %s %s: %s",
++ /* TRANSLATORS: e.g. error in tree 01bfda: <more explanation> */
++ fprintf_ln(stderr, _("error in %s %s: %s"),
+ printable_type(obj), describe_object(obj), message);
+ return 1;
+ default:
@@
*/
if (!obj) {
Nguyễn Thái Ngọc Duy (16):
git.c: mark more strings for translation
alias.c: mark split_cmdline_strerror() strings for translation
archive.c: mark more strings for translation
attr.c: mark more string for translation
read-cache.c: turn die("internal error") to BUG()
read-cache.c: mark more strings for translation
read-cache.c: add missing colon separators
reflog: mark strings for translation
remote.c: turn some error() or die() to BUG()
remote.c: mark messages for translation
repack: mark more strings for translation
parse-options: replace opterror() with optname()
parse-options.c: turn some die() to BUG()
parse-options.c: mark more strings for translation
fsck: reduce word legos to help i18n
fsck: mark strings for translation
alias.c | 4 +-
archive.c | 8 +-
attr.c | 4 +-
builtin/fsck.c | 159 +++++++++++++++++++++----------------
builtin/merge.c | 4 +-
builtin/reflog.c | 34 ++++----
builtin/repack.c | 26 +++---
builtin/revert.c | 3 +-
git.c | 32 ++++----
parse-options-cb.c | 7 +-
parse-options.c | 64 ++++++++-------
parse-options.h | 5 +-
read-cache.c | 73 ++++++++---------
ref-filter.c | 8 +-
remote.c | 49 ++++++------
t/t0040-parse-options.sh | 4 +-
t/t1410-reflog.sh | 6 +-
t/t1450-fsck.sh | 52 ++++++------
t/t4211-line-log.sh | 2 +-
t/t6050-replace.sh | 4 +-
t/t7415-submodule-names.sh | 6 +-
21 files changed, 295 insertions(+), 259 deletions(-)
--
2.19.1.1231.g84aef82467
next prev parent reply other threads:[~2018-11-10 5:39 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-28 6:51 [PATCH 00/12] Mark more strings for translation Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 01/12] git.c: mark " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 02/12] alias.c: mark split_cmdline_strerror() " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 03/12] archive.c: mark more " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 04/12] attr.c: mark more string " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 05/12] read-cache.c: mark more strings " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 06/12] read-cache.c: add missing colon separators Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 07/12] reflog: mark strings for translation Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 08/12] remote.c: mark messages " Nguyễn Thái Ngọc Duy
2018-10-29 7:56 ` Junio C Hamano
2018-10-29 16:16 ` Duy Nguyen
2018-10-28 6:51 ` [PATCH 09/12] repack: mark more strings " Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 10/12] parse-options: replace opterror() with optname() Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 11/12] parse-options.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-10-28 6:51 ` [PATCH 12/12] fsck: mark " Nguyễn Thái Ngọc Duy
2018-10-29 10:53 ` SZEDER Gábor
2018-10-29 14:09 ` Junio C Hamano
2018-10-29 16:14 ` Duy Nguyen
2018-10-29 17:38 ` Ævar Arnfjörð Bjarmason
2018-10-29 17:43 ` Ævar Arnfjörð Bjarmason
2018-11-01 1:36 ` Jiang Xin
2018-10-30 23:27 ` Jonathan Nieder
2018-11-05 17:21 ` Duy Nguyen
2018-11-05 19:20 ` [PATCH v2 00/16] Mark more " Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 01/16] git.c: mark " Nguyễn Thái Ngọc Duy
2018-11-06 2:02 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 02/16] alias.c: mark split_cmdline_strerror() " Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 03/16] archive.c: mark more " Nguyễn Thái Ngọc Duy
2018-11-06 2:09 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 04/16] attr.c: mark more string " Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 05/16] read-cache.c: turn die("internal error") to BUG() Nguyễn Thái Ngọc Duy
2018-11-06 2:10 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 06/16] read-cache.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 07/16] read-cache.c: add missing colon separators Nguyễn Thái Ngọc Duy
2018-11-06 2:12 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 08/16] reflog: mark strings for translation Nguyễn Thái Ngọc Duy
2018-11-06 2:13 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 09/16] remote.c: turn some error() or die() to BUG() Nguyễn Thái Ngọc Duy
2018-11-06 2:21 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 10/16] remote.c: mark messages for translation Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 11/16] repack: mark more strings " Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 12/16] parse-options: replace opterror() with optname() Nguyễn Thái Ngọc Duy
2018-11-06 2:33 ` Junio C Hamano
2018-11-06 14:02 ` Ramsay Jones
2018-11-06 19:08 ` Jeff King
2018-11-10 4:55 ` Duy Nguyen
2018-11-10 14:59 ` Ramsay Jones
2018-11-05 19:20 ` [PATCH v2 13/16] parse-options.c: turn some die() to BUG() Nguyễn Thái Ngọc Duy
2018-11-06 3:27 ` Junio C Hamano
2018-11-05 19:20 ` [PATCH v2 14/16] parse-options.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-11-05 19:20 ` [PATCH v2 15/16] fsck: reduce word legos to help i18n Nguyễn Thái Ngọc Duy
2018-11-06 3:41 ` Junio C Hamano
2018-11-10 4:59 ` Duy Nguyen
2018-11-05 19:20 ` [PATCH v2 16/16] fsck: mark strings for translation Nguyễn Thái Ngọc Duy
2018-11-10 5:15 ` Nguyễn Thái Ngọc Duy [this message]
2018-11-10 5:16 ` [PATCH v3 01/16] git.c: mark more " Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 02/16] alias.c: mark split_cmdline_strerror() " Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 03/16] archive.c: mark more " Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 04/16] attr.c: mark more string " Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 05/16] read-cache.c: turn die("internal error") to BUG() Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 06/16] read-cache.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 07/16] read-cache.c: add missing colon separators Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 08/16] reflog: mark strings for translation Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 09/16] remote.c: turn some error() or die() to BUG() Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 10/16] remote.c: mark messages for translation Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 11/16] repack: mark more strings " Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 12/16] parse-options: replace opterror() with optname() Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 13/16] parse-options.c: turn some die() to BUG() Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 14/16] parse-options.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 15/16] fsck: reduce word legos to help i18n Nguyễn Thái Ngọc Duy
2018-11-10 5:16 ` [PATCH v3 16/16] fsck: mark strings for translation Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181110051615.8641-1-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).