Re: [L10N] Kickoff of translation for Git 2.10.0 round 1

6 messages, 3 authors, 2016-08-21 · open the first message on its own page

Re: [L10N] Kickoff of translation for Git 2.10.0 round 1

From: Junio C Hamano <hidden>
Date: 2016-08-20 18:03:09

Jean-Noël AVILA [off-list ref] writes:
1.  In config.c, the changes to the function die_bad_number tried to flatten the 
translated strings (no message building logic). I think it went too far, and 
the reason of the failure can be factorized so that we don't have to 
retranslate each time. I might be wrong on this one, but I have no example of 
language where we would need differentiated error reasons.
I do not have a strong opinion on this one.  I think it is an
attempt to avoid language-lego.
2.  in sequencer.c, there is a mistake in the original string to translate 
"Cannot revert during a another revert"
This should be corrected. Thanks for spotting.
3. git-rebase--interactive, in this_nth_commit_message and 
skip_nth_commit_message are not localizable,
As the "TRANSLATORS" comment alludes to, "This is the Nth thing" can
be rephrased to "This is the thing N" or "This is the thing #N"
easily, and if that form without ordinal is acceptable for many
languages, we should say that it is also OK in C-locale without
translation.  So I agree that the recent change was pointless (even
though the result may be localizable).

In an ideal world, I would imagine that this would be done by using
Q_("This is the first thing", "This is the thing #%d", nth) aka
ngettext, but

    (1) I haven't seen ngettext used from shell scripts; and

    (2) I do not think po files are set up to express "for this
        message, this language has 4 variants and here are the local
        rules to decide which one to use depending on the number,
        but the rules apply only to this message".  The Plural-Forms
        rule [*1*] seems to be global to a .po file, unfortunately.

so I do not think we cannot do it with ngettext().

[Reference]

*1* https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html

Re: [L10N] Kickoff of translation for Git 2.10.0 round 1

From: Jean-Noël AVILA <hidden>
Date: 2016-08-20 18:39:28

On samedi 20 août 2016 11:03:00 CEST Junio C Hamano wrote:
Jean-Noël AVILA [off-list ref] writes:
quoted
1.  In config.c, the changes to the function die_bad_number tried to
flatten the translated strings (no message building logic). I think it
went too far, and the reason of the failure can be factorized so that we
don't have to retranslate each time. I might be wrong on this one, but I
have no example of language where we would need differentiated error
reasons.
I do not have a strong opinion on this one.  I think it is an
attempt to avoid language-lego.
No problem with the changes for blob, files, command line. It's just about 
dividing by two the number of strings to translate by factorizing "out of 
range" and "invalid unit", which are invariable anyway.  		
quoted
2.  in sequencer.c, there is a mistake in the original string to translate
"Cannot revert during a another revert"
This should be corrected. Thanks for spotting.
I also spotted a missing capitals. Will propose a patch.
quoted
3. git-rebase--interactive, in this_nth_commit_message and
skip_nth_commit_message are not localizable,
As the "TRANSLATORS" comment alludes to, "This is the Nth thing" can
be rephrased to "This is the thing N" or "This is the thing #N"
easily, and if that form without ordinal is acceptable for many
languages, we should say that it is also OK in C-locale without
translation.  So I agree that the recent change was pointless (even
though the result may be localizable).

In an ideal world, I would imagine that this would be done by using
Q_("This is the first thing", "This is the thing #%d", nth) aka
ngettext, but

    (1) I haven't seen ngettext used from shell scripts; and
There's a use_ngettext macro
    (2) I do not think po files are set up to express "for this
        message, this language has 4 variants and here are the local
        rules to decide which one to use depending on the number,
        but the rules apply only to this message".  The Plural-Forms
        rule [*1*] seems to be global to a .po file, unfortunately.
so I do not think we cannot do it with ngettext().
Let's cut it like this : first ten are literally translated, the following ones 
fall back to a general rule. All languages are treated equally. With more than 
10 squashed commit, you no longer really care if the numbering is pedantically 
correct.
[Reference]

*1*
https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-> forms.html

[PATCH 1/3] i18n: fix typos for translation

From: Jean-Noel Avila <hidden>
Date: 2016-08-21 14:51:09

Signed-off-by: Jean-Noel Avila <redacted>
---
 bisect.c    | 10 +++++-----
 sequencer.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bisect.c b/bisect.c
index 6f512c2..b9a0701 100644
--- a/bisect.c
+++ b/bisect.c
@@ -760,7 +760,7 @@ static void handle_skipped_merge_base(const unsigned char *mb)
 	char *bad_hex = oid_to_hex(current_bad_oid);
 	char *good_hex = join_sha1_array_hex(&good_revs, ' ');
 
-	warning(_("the merge base between %s and [%s] "
+	warning(_("The merge base between %s and [%s] "
 		"must be skipped.\n"
 		"So we cannot be sure the first %s commit is "
 		"between %s and %s.\n"
@@ -846,7 +846,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
 	int fd;
 
 	if (!current_bad_oid)
-		die(_("a %s revision is needed"), term_bad);
+		die(_("A %s revision is needed"), term_bad);
 
 	/* Check if file BISECT_ANCESTORS_OK exists. */
 	if (!stat(filename, &st) && S_ISREG(st.st_mode))
@@ -863,7 +863,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
 	/* Create file BISECT_ANCESTORS_OK. */
 	fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
 	if (fd < 0)
-		warning_errno(_("could not create file '%s'"),
+		warning_errno(_("Could not create file '%s'"),
 			      filename);
 	else
 		close(fd);
@@ -914,7 +914,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
 			*read_good = "good";
 			return;
 		} else {
-			die_errno(_("could not read file '%s'"), filename);
+			die_errno(_("Could not read file '%s'"), filename);
 		}
 	} else {
 		strbuf_getline_lf(&str, fp);
@@ -944,7 +944,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
 	read_bisect_terms(&term_bad, &term_good);
 	if (read_bisect_refs())
-		die(_("reading bisect refs failed"));
+		die(_("Reading bisect refs failed"));
 
 	check_good_are_ancestors_of_bad(prefix, no_checkout);
 
diff --git a/sequencer.c b/sequencer.c
index 2e9c7d0..3804fa9 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -702,7 +702,7 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *
 	if (action != opts->action) {
 		if (action == REPLAY_REVERT)
 		      error((opts->action == REPLAY_REVERT)
-			    ? _("Cannot revert during a another revert.")
+			    ? _("Cannot revert during another revert.")
 			    : _("Cannot revert during a cherry-pick."));
 		else
 		      error((opts->action == REPLAY_REVERT)
-- 
2.10.0.rc0.37.gd7d1c14.dirty

[PATCH 2/3] i18n: fix git rebase interactive commit messages

From: Jean-Noel Avila <hidden>
Date: 2016-08-21 14:51:12

For proper i18n, the logic cannot embed english specific processing.

Signed-off-by: Jean-Noel Avila <redacted>
---
 git-rebase--interactive.sh | 16 ----------------
 1 file changed, 16 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index e2da524..7baf5f4 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -415,14 +415,6 @@ this_nth_commit_message () {
 	8) gettext "This is the 8th commit message:";;
 	9) gettext "This is the 9th commit message:";;
 	10) gettext "This is the 10th commit message:";;
-	# TRANSLATORS: if the language you are translating into
-	# doesn't allow you to compose a sentence in this fashion,
-	# consider translating as if this and the following few strings
-	# were "This is the commit message ${n}:"
-	*1[0-9]|*[04-9]) eval_gettext "This is the \${n}th commit message:";;
-	*1) eval_gettext "This is the \${n}st commit message:";;
-	*2) eval_gettext "This is the \${n}nd commit message:";;
-	*3) eval_gettext "This is the \${n}rd commit message:";;
 	*) eval_gettext "This is the commit message \${n}:";;
 	esac
 }
@@ -439,14 +431,6 @@ skip_nth_commit_message () {
 	8) gettext "The 8th commit message will be skipped:";;
 	9) gettext "The 9th commit message will be skipped:";;
 	10) gettext "The 10th commit message will be skipped:";;
-	# TRANSLATORS: if the language you are translating into
-	# doesn't allow you to compose a sentence in this fashion,
-	# consider translating as if this and the following few strings
-	# were "The commit message ${n} will be skipped:"
-	*1[0-9]|*[04-9]) eval_gettext "The \${n}th commit message will be skipped:";;
-	*1) eval_gettext "The \${n}st commit message will be skipped:";;
-	*2) eval_gettext "The \${n}nd commit message will be skipped:";;
-	*3) eval_gettext "The \${n}rd commit message will be skipped:";;
 	*) eval_gettext "The commit message \${n} will be skipped:";;
 	esac
 }
-- 
2.10.0.rc0.37.gd7d1c14.dirty

[PATCH 3/3] i18n: simplify numeric error reporting

From: Jean-Noel Avila <hidden>
Date: 2016-08-21 14:51:14

Signed-off-by: Jean-Noel Avila <redacted>
---
 config.c | 43 +++++++++++++++----------------------------
 1 file changed, 15 insertions(+), 28 deletions(-)
diff --git a/config.c b/config.c
index 584cacf..e33c703 100644
--- a/config.c
+++ b/config.c
@@ -655,43 +655,30 @@ static void die_bad_number(const char *name, const char *value)
 	if (!value)
 		value = "";
 
+	const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit");
 	if (!(cf && cf->name))
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s': out of range")
-		    : _("bad numeric config value '%s' for '%s': invalid unit"),
-		    value, name);
+		die(_("bad numeric config value '%s' for '%s': %s"),
+		    value, name, error_type);
 
 	switch (cf->origin_type) {
 	case CONFIG_ORIGIN_BLOB:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in blob %s: out of range")
-		    : _("bad numeric config value '%s' for '%s' in blob %s: invalid unit"),
-		    value, name, cf->name);
+		die(_("bad numeric config value '%s' for '%s' in blob %s: %s"),
+		    value, name, cf->name, error_type);
 	case CONFIG_ORIGIN_FILE:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in file %s: out of range")
-		    : _("bad numeric config value '%s' for '%s' in file %s: invalid unit"),
-		    value, name, cf->name);
+		die(_("bad numeric config value '%s' for '%s' in file %s: %s"),
+		    value, name, cf->name, error_type);
 	case CONFIG_ORIGIN_STDIN:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in standard input: out of range")
-		    : _("bad numeric config value '%s' for '%s' in standard input: invalid unit"),
-		    value, name);
+		die(_("bad numeric config value '%s' for '%s' in standard input: %s"),
+		    value, name, error_type);
 	case CONFIG_ORIGIN_SUBMODULE_BLOB:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in submodule-blob %s: out of range")
-		    : _("bad numeric config value '%s' for '%s' in submodule-blob %s: invalid unit"),
-		    value, name, cf->name);
+		die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"),
+		    value, name, cf->name, error_type);
 	case CONFIG_ORIGIN_CMDLINE:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in command line %s: out of range")
-		    : _("bad numeric config value '%s' for '%s' in command line %s: invalid unit"),
-		    value, name, cf->name);
+		die(_("bad numeric config value '%s' for '%s' in command line %s: %s"),
+		    value, name, cf->name, error_type);
 	default:
-		die(errno == ERANGE
-		    ? _("bad numeric config value '%s' for '%s' in %s: out of range")
-		    : _("bad numeric config value '%s' for '%s' in %s: invalid unit"),
-		    value, name, cf->name);
+		die(_("bad numeric config value '%s' for '%s' in %s: %s"),
+		    value, name, cf->name, error_type);
 	}
 }
 
-- 
2.10.0.rc0.37.gd7d1c14.dirty

Re: [L10N] Kickoff of translation for Git 2.10.0 round 1

From: Jiang Xin <hidden>
Date: 2016-08-21 15:46:11

2016-08-21 2:38 GMT+08:00 Jean-Noël AVILA [off-list ref]:
On samedi 20 août 2016 11:03:00 CEST Junio C Hamano wrote:
quoted
Jean-Noël AVILA [off-list ref] writes:
quoted
1.  In config.c, the changes to the function die_bad_number tried to
flatten the translated strings (no message building logic). I think it
went too far, and the reason of the failure can be factorized so that we
don't have to retranslate each time. I might be wrong on this one, but I
have no example of language where we would need differentiated error
reasons.
I do not have a strong opinion on this one.  I think it is an
attempt to avoid language-lego.
No problem with the changes for blob, files, command line. It's just about
dividing by two the number of strings to translate by factorizing "out of
range" and "invalid unit", which are invariable anyway.
I agree with you.  It maybe not a good solution to expanded string "reason"
in commit 1b8132d:

    -       const char *reason = errno == ERANGE ?
    -                            "out of range" :
    -                            "invalid unit";

quoted
quoted
3. git-rebase--interactive, in this_nth_commit_message and
skip_nth_commit_message are not localizable,
As the "TRANSLATORS" comment alludes to, "This is the Nth thing" can
be rephrased to "This is the thing N" or "This is the thing #N"
easily, and if that form without ordinal is acceptable for many
languages, we should say that it is also OK in C-locale without
translation.  So I agree that the recent change was pointless (even
though the result may be localizable).

In an ideal world, I would imagine that this would be done by using
Q_("This is the first thing", "This is the thing #%d", nth) aka
ngettext, but

    (1) I haven't seen ngettext used from shell scripts; and
There's a use_ngettext macro
quoted
    (2) I do not think po files are set up to express "for this
        message, this language has 4 variants and here are the local
        rules to decide which one to use depending on the number,
        but the rules apply only to this message".  The Plural-Forms
        rule [*1*] seems to be global to a .po file, unfortunately.
quoted
so I do not think we cannot do it with ngettext().
Let's cut it like this : first ten are literally translated, the following ones
fall back to a general rule. All languages are treated equally. With more than
10 squashed commit, you no longer really care if the numbering is pedantically
correct.

It's boring to translate all these 30 messages, I prefer #N like:

    gettext "The commit message #\${n} will be skipped:"
    gettext "This is the commit message #\${n}:"


-- 
Jiang Xin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help