* [PATCH] i18n: apply: split to fix a partial i18n message
@ 2012-05-31 11:20 Jiang Xin
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
0 siblings, 1 reply; 19+ messages in thread
From: Jiang Xin @ 2012-05-31 11:20 UTC (permalink / raw)
To: Junio C Hamano
Cc: Git List, Ævar Arnfjörð Bjarmason,
Nguyễn Thái Ngọc Duy, Jonathan Nieder, Jiang Xin
The 4th arg of "new mode (%o) of %s does not match old mode (%o)%s%s"
is blank string or string " of ". Even mark the string " of " for a
complete i18n, this message is still hard to translate right.
Split it into two slight different messages would make l10n teams happy.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
---
builtin/apply.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index dda9ea0..b4428ea 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3262,10 +3262,18 @@ static int check_patch(struct patch *patch)
int same = !strcmp(old_name, new_name);
if (!patch->new_mode)
patch->new_mode = patch->old_mode;
- if ((patch->old_mode ^ patch->new_mode) & S_IFMT)
- return error(_("new mode (%o) of %s does not match old mode (%o)%s%s"),
- patch->new_mode, new_name, patch->old_mode,
- same ? "" : " of ", same ? "" : old_name);
+ if ((patch->old_mode ^ patch->new_mode) & S_IFMT) {
+ if (same)
+ return error(_("new mode (%o) of %s does not "
+ "match old mode (%o)"),
+ patch->new_mode, new_name,
+ patch->old_mode);
+ else
+ return error(_("new mode (%o) of %s does not "
+ "match old mode (%o) of %s"),
+ patch->new_mode, new_name,
+ patch->old_mode, old_name);
+ }
}
if (apply_data(patch, &st, ce) < 0)
--
1.7.10.2.559.g0ba0f00
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH] i18n: apply: split to fix a partial i18n message
2012-05-31 11:20 [PATCH] i18n: apply: split to fix a partial i18n message Jiang Xin
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
` (5 more replies)
0 siblings, 6 replies; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
On Thu, May 31, 2012 at 6:20 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
> The 4th arg of "new mode (%o) of %s does not match old mode (%o)%s%s"
> is blank string or string " of ". Even mark the string " of " for a
> complete i18n, this message is still hard to translate right.
Your patch looks good. I have a habit of looking for similar spots and
the following patches are the result. These messages are not marked
for translation because I think mass-marking by file or by command is
better.
Not sure if it's the right way to fix these though. For example, while
1/1 looks very good from i18n perspective, code-wise it's quite ugly.
Grouping format strings in array also prevents gcc from checking
correct parameters, I think.
Nguyễn Thái Ngọc Duy (6):
Remove i18n legos in notifying new branch tracking setup
reflog: remove i18n legos in pruning message
merge-recursive: remove i18n legos in conflict messages
notes-merge: remove i18n legos in merge result message
rerere: remove i18n legos in result message
unpack-trees: remove i18n legos in unpack's porcelain error messages
branch.c | 48 +++++++++++++++++++++++++++++++++---------------
builtin/reflog.c | 8 ++++++--
merge-recursive.c | 49 +++++++++++++++++++++++++++++++++----------------
notes-merge.c | 11 ++++++++---
rerere.c | 12 ++++++------
unpack-trees.c | 55 +++++++++++++++++++++++++++++++++----------------------
6 files changed, 119 insertions(+), 64 deletions(-)
--
1.7.10.2.549.g9354186
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 14:00 ` Jonathan Nieder
2012-05-31 13:04 ` [PATCH 2/6] reflog: remove i18n legos in pruning message Nguyễn Thái Ngọc Duy
` (4 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
branch.c | 48 +++++++++++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/branch.c b/branch.c
index eccdaf9..d8facf7 100644
--- a/branch.c
+++ b/branch.c
@@ -74,25 +74,43 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
strbuf_addf(&key, "branch.%s.rebase", local);
git_config_set(key.buf, "true");
}
+ strbuf_release(&key);
if (flag & BRANCH_CONFIG_VERBOSE) {
- strbuf_reset(&key);
-
- strbuf_addstr(&key, origin ? "remote" : "local");
-
- /* Are we tracking a proper "branch"? */
- if (remote_is_branch) {
- strbuf_addf(&key, " branch %s", shortname);
- if (origin)
- strbuf_addf(&key, " from %s", origin);
+ if (rebasing) {
+ if (remote_is_branch) {
+ if (origin)
+ printf("Branch %s set up to track remote branch %s from %s by rebasing.\n",
+ local, shortname, origin);
+ else
+ printf("Branch %s set up to track local branch %s by rebasing.\n",
+ local, shortname);
+ } else {
+ if (origin)
+ printf("Branch %s set up to track remote ref %s by rebasing.\n",
+ local, remote);
+ else
+ printf("Branch %s set up to track local ref %s by rebasing.\n",
+ local, remote);
+ }
+ } else {
+ if (remote_is_branch) {
+ if (origin)
+ printf("Branch %s set up to track remote branch %s from %s.\n",
+ local, shortname, origin);
+ else
+ printf("Branch %s set up to track local branch %s.\n",
+ local, shortname);
+ } else {
+ if (origin)
+ printf("Branch %s set up to track remote ref %s.\n",
+ local, remote);
+ else
+ printf("Branch %s set up to track local ref %s.\n",
+ local, remote);
+ }
}
- else
- strbuf_addf(&key, " ref %s", remote);
- printf("Branch %s set up to track %s%s.\n",
- local, key.buf,
- rebasing ? " by rebasing" : "");
}
- strbuf_release(&key);
}
/*
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:45 ` Jonathan Nieder
2012-05-31 13:04 ` [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages Nguyễn Thái Ngọc Duy
` (3 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
builtin/reflog.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 062d7da..6cedcec 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -330,8 +330,12 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
printf("keep %s", message);
return 0;
prune:
- if (!cb->newlog || cb->cmd->verbose)
- printf("%sprune %s", cb->newlog ? "" : "would ", message);
+ if (!cb->newlog || cb->cmd->verbose) {
+ if (cb->newlog)
+ printf("prune %s", message);
+ else
+ printf("would prune %s", message);
+ }
return 0;
}
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 2/6] reflog: remove i18n legos in pruning message Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:52 ` Jonathan Nieder
2012-05-31 13:04 ` [PATCH 4/6] notes-merge: remove i18n legos in merge result message Nguyễn Thái Ngọc Duy
` (2 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
merge-recursive.c | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 680937c..1cc6360 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1018,9 +1018,27 @@ static void handle_change_delete(struct merge_options *o,
const unsigned char *o_sha, int o_mode,
const unsigned char *a_sha, int a_mode,
const unsigned char *b_sha, int b_mode,
- const char *change, const char *change_past)
+ const char *change)
{
char *renamed = NULL;
+ int idx;
+
+ const char *msg[] = {
+ "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree.",
+ "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree.",
+ };
+ const char *renamed_msg[] = {
+ "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree at %s.",
+ "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree at %s.",
+ };
+
+ if (!strcmp(change, "rename"))
+ idx = 0;
+ else if (!strcmp(change, "modify"))
+ idx = 1;
+ else
+ die("BUG: unsupport action %s", change);
+
if (dir_in_way(path, !o->call_depth)) {
renamed = unique_path(o, path, a_sha ? o->branch1 : o->branch2);
}
@@ -1034,22 +1052,21 @@ static void handle_change_delete(struct merge_options *o,
remove_file_from_cache(path);
update_file(o, 0, o_sha, o_mode, renamed ? renamed : path);
} else if (!a_sha) {
- output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
- "and %s in %s. Version %s of %s left in tree%s%s.",
- change, path, o->branch1,
- change_past, o->branch2, o->branch2, path,
- NULL == renamed ? "" : " at ",
- NULL == renamed ? "" : renamed);
+ if (renamed)
+ output(o, 1, renamed_msg[idx], path, o->branch1,
+ o->branch2, o->branch2, path, renamed);
+ else
+ output(o, 1, msg[idx], path, o->branch1,
+ o->branch2, o->branch2, path);
update_file(o, 0, b_sha, b_mode, renamed ? renamed : path);
} else {
- output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
- "and %s in %s. Version %s of %s left in tree%s%s.",
- change, path, o->branch2,
- change_past, o->branch1, o->branch1, path,
- NULL == renamed ? "" : " at ",
- NULL == renamed ? "" : renamed);
- if (renamed)
+ if (renamed) {
+ output(o, 1, renamed_msg[idx], path, o->branch2,
+ o->branch1, o->branch1, path, renamed);
update_file(o, 0, a_sha, a_mode, renamed);
+ } else
+ output(o, 1, msg[idx], path, o->branch2,
+ o->branch1, o->branch1, path);
/*
* No need to call update_file() on path when !renamed, since
* that would needlessly touch path. We could call
@@ -1085,7 +1102,7 @@ static void conflict_rename_delete(struct merge_options *o,
orig->sha1, orig->mode,
a_sha, a_mode,
b_sha, b_mode,
- "rename", "renamed");
+ "rename");
if (o->call_depth) {
remove_file_from_cache(dest->path);
@@ -1568,7 +1585,7 @@ static void handle_modify_delete(struct merge_options *o,
o_sha, o_mode,
a_sha, a_mode,
b_sha, b_mode,
- "modify", "modified");
+ "modify");
}
static int merge_content(struct merge_options *o,
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/6] notes-merge: remove i18n legos in merge result message
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
` (2 preceding siblings ...)
2012-05-31 13:04 ` [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 5/6] rerere: remove i18n legos in " Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 6/6] unpack-trees: remove i18n legos in unpack's porcelain error messages Nguyễn Thái Ngọc Duy
5 siblings, 0 replies; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
notes-merge.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/notes-merge.c b/notes-merge.c
index 74aa77c..43d5ce0 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -523,9 +523,14 @@ static int merge_from_diffs(struct notes_merge_options *o,
conflicts = merge_changes(o, changes, &num_changes, t);
free(changes);
- if (o->verbosity >= 4)
- printf("Merge result: %i unmerged notes and a %s notes tree\n",
- conflicts, t->dirty ? "dirty" : "clean");
+ if (o->verbosity >= 4) {
+ if (t->dirty)
+ printf("Merge result: %i unmerged notes and a dirty notes tree\n",
+ conflicts);
+ else
+ printf("Merge result: %i unmerged notes and a clean notes tree\n",
+ conflicts);
+ }
return conflicts ? -1 : 1;
}
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/6] rerere: remove i18n legos in result message
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
` (3 preceding siblings ...)
2012-05-31 13:04 ` [PATCH 4/6] notes-merge: remove i18n legos in merge result message Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 6/6] unpack-trees: remove i18n legos in unpack's porcelain error messages Nguyễn Thái Ngọc Duy
5 siblings, 0 replies; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
rerere.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/rerere.c b/rerere.c
index dcb525a..da18fc3 100644
--- a/rerere.c
+++ b/rerere.c
@@ -544,13 +544,13 @@ static int do_plain_rerere(struct string_list *rr, int fd)
if (has_rerere_resolution(name)) {
if (!merge(name, path)) {
- if (rerere_autoupdate)
+ const char *msg;
+ if (rerere_autoupdate) {
string_list_insert(&update, path);
- fprintf(stderr,
- "%s '%s' using previous resolution.\n",
- rerere_autoupdate
- ? "Staged" : "Resolved",
- path);
+ msg = "Staged '%s' using previous resolution.\n";
+ } else
+ msg = "Resolved '%s' using previous resolution.\n";
+ fprintf(stderr, msg, path);
goto mark_resolved;
}
}
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 6/6] unpack-trees: remove i18n legos in unpack's porcelain error messages
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
` (4 preceding siblings ...)
2012-05-31 13:04 ` [PATCH 5/6] rerere: remove i18n legos in " Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
5 siblings, 0 replies; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-31 13:04 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
unpack-trees.c | 55 +++++++++++++++++++++++++++++++++----------------------
1 file changed, 33 insertions(+), 22 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index ad40109..41c5714 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -53,35 +53,46 @@ static const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
const char *cmd)
{
- int i;
+ int i, idx;
const char **msgs = opts->msgs;
- const char *msg;
- char *tmp;
- const char *cmd2 = strcmp(cmd, "checkout") ? cmd : "switch branches";
- if (advice_commit_before_merge)
- msg = "Your local changes to the following files would be overwritten by %s:\n%%s"
- "Please, commit your changes or stash them before you can %s.";
+ struct strbuf msg = STRBUF_INIT;
+ const char *overwrite_advice[] = {
+ "Please, commit your changes or stash them before you can merge.",
+ "Please, commit your changes or stash them before you can switch branches."
+ };
+ const char *remove_untracked_advice[] = {
+ "Please move or remove them before you can merge.",
+ "Please move or remove them before you can switch branches."
+ };
+
+ if (!strcmp(cmd, "merge"))
+ idx = 0;
+ else if (!strcmp(cmd, "checkout"))
+ idx = 1;
else
- msg = "Your local changes to the following files would be overwritten by %s:\n%%s";
- tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen(cmd2) - 2);
- sprintf(tmp, msg, cmd, cmd2);
- msgs[ERROR_WOULD_OVERWRITE] = tmp;
- msgs[ERROR_NOT_UPTODATE_FILE] = tmp;
+ die("BUG: unsupported command %s", cmd);
+
+ strbuf_addf(&msg, "Your local changes to the following files "
+ "would be overwritten by %s:\n%%s", cmd);
+ if (advice_commit_before_merge)
+ strbuf_addstr(&msg, overwrite_advice[idx]);
+ msgs[ERROR_WOULD_OVERWRITE] = strbuf_detach(&msg, NULL);
+ msgs[ERROR_NOT_UPTODATE_FILE] = msgs[ERROR_WOULD_OVERWRITE];
msgs[ERROR_NOT_UPTODATE_DIR] =
"Updating the following directories would lose untracked files in it:\n%s";
+ strbuf_addf(&msg, "The following untracked working tree "
+ "files would be removed by %s:\n%%s", cmd);
if (advice_commit_before_merge)
- msg = "The following untracked working tree files would be %s by %s:\n%%s"
- "Please move or remove them before you can %s.";
- else
- msg = "The following untracked working tree files would be %s by %s:\n%%s";
- tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen("removed") + strlen(cmd2) - 4);
- sprintf(tmp, msg, "removed", cmd, cmd2);
- msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = tmp;
- tmp = xmalloc(strlen(msg) + strlen(cmd) + strlen("overwritten") + strlen(cmd2) - 4);
- sprintf(tmp, msg, "overwritten", cmd, cmd2);
- msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = tmp;
+ strbuf_addstr(&msg, remove_untracked_advice[idx]);
+ msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = strbuf_detach(&msg, NULL);
+
+ strbuf_addf(&msg, "The following untracked working tree "
+ "files would be overwritten by %s:\n%%s", cmd);
+ if (advice_commit_before_merge)
+ strbuf_addstr(&msg, remove_untracked_advice[idx]);
+ msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = strbuf_detach(&msg, NULL);
/*
* Special case: ERROR_BIND_OVERLAP refers to a pair of paths, we
--
1.7.10.2.549.g9354186
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 13:04 ` [PATCH 2/6] reflog: remove i18n legos in pruning message Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:45 ` Jonathan Nieder
2012-05-31 14:00 ` Nguyen Thai Ngoc Duy
2012-05-31 17:56 ` Junio C Hamano
0 siblings, 2 replies; 19+ messages in thread
From: Jonathan Nieder @ 2012-05-31 13:45 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Junio C Hamano, Ævar Arnfjörð Bjarmason,
Jiang Xin
Nguyễn Thái Ngọc Duy wrote:
> --- a/builtin/reflog.c
> +++ b/builtin/reflog.c
> @@ -330,8 +330,12 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
> printf("keep %s", message);
> return 0;
> prune:
> - if (!cb->newlog || cb->cmd->verbose)
> - printf("%sprune %s", cb->newlog ? "" : "would ", message);
> + if (!cb->newlog || cb->cmd->verbose) {
> + if (cb->newlog)
> + printf("prune %s", message);
> + else
> + printf("would prune %s", message);
> + }
Thanks. Style: how about
if (!cb->newlog)
printf("would prune %s", message);
else if (cb->cmd->verbose)
printf("prune %s", message);
? I think that would be more readable than the lego original.
BTW I'm not sure if this message would be a good candidate for
translation. Especially in the --dry-run case, it feels like output
that is intended to be simple enough for scripts to parse. (Though on
the other hand, I don't know of any scripts or use cases that actually
parse it, so maybe nobody would mind.)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages
2012-05-31 13:04 ` [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages Nguyễn Thái Ngọc Duy
@ 2012-05-31 13:52 ` Jonathan Nieder
2012-05-31 13:56 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 19+ messages in thread
From: Jonathan Nieder @ 2012-05-31 13:52 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Junio C Hamano, Ævar Arnfjörð Bjarmason,
Jiang Xin
Nguyễn Thái Ngọc Duy wrote:
> + const char *msg[] = {
> + "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree.",
> + "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree.",
> + };
> + const char *renamed_msg[] = {
> + "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree at %s.",
> + "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree at %s.",
> + };
Is lego by sentence ok? i.e., having 4 translated messages:
CONFLICT (rename/delete): %s deleted in %s and renamed in %s.
CONFLICT (modify/delete): %s deleted in %s and modified in %s.
Version %s of %s left in tree.
Version %s of %s left in tree at %s.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages
2012-05-31 13:52 ` Jonathan Nieder
@ 2012-05-31 13:56 ` Nguyen Thai Ngoc Duy
0 siblings, 0 replies; 19+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-31 13:56 UTC (permalink / raw)
To: Jonathan Nieder
Cc: git, Junio C Hamano, Ævar Arnfjörð, Jiang Xin
On Thu, May 31, 2012 at 8:52 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Nguyễn Thái Ngọc Duy wrote:
>
>> + const char *msg[] = {
>> + "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree.",
>> + "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree.",
>> + };
>> + const char *renamed_msg[] = {
>> + "CONFLICT (rename/delete): %s deleted in %s and renamed in %s. Version %s of %s left in tree at %s.",
>> + "CONFLICT (modify/delete): %s deleted in %s and modified in %s. Version %s of %s left in tree at %s.",
>> + };
>
> Is lego by sentence ok? i.e., having 4 translated messages:
>
> CONFLICT (rename/delete): %s deleted in %s and renamed in %s.
> CONFLICT (modify/delete): %s deleted in %s and modified in %s.
> Version %s of %s left in tree.
> Version %s of %s left in tree at %s.
Yeah, should have separated these sentences, less work for translators.
--
Duy
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup
2012-05-31 13:04 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
@ 2012-05-31 14:00 ` Jonathan Nieder
0 siblings, 0 replies; 19+ messages in thread
From: Jonathan Nieder @ 2012-05-31 14:00 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Junio C Hamano, Ævar Arnfjörð Bjarmason,
Jiang Xin
Nguyễn Thái Ngọc Duy wrote:
> Not sure if it's the right way to fix these though. For example, while
> 1/1 looks very good from i18n perspective, code-wise it's quite ugly.
> Grouping format strings in array also prevents gcc from checking
> correct parameters, I think.
[...]
> --- a/branch.c
> +++ b/branch.c
> @@ -74,25 +74,43 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
[...]
> - strbuf_addstr(&key, origin ? "remote" : "local");
> -
> - /* Are we tracking a proper "branch"? */
> - if (remote_is_branch) {
> - strbuf_addf(&key, " branch %s", shortname);
> - if (origin)
> - strbuf_addf(&key, " from %s", origin);
> + if (rebasing) {
> + if (remote_is_branch) {
> + if (origin)
> + printf("Branch %s set up to track remote branch %s from %s by rebasing.\n",
> + local, shortname, origin);
> + else
[...]
> + } else {
> + if (origin)
[...]
> + }
> + } else {
> + if (remote_is_branch) {
[...]
I think a table-driven version of this switchboard would be much
easier to read, even if it would hurt gcc's -Wformat checking. If the
-Wformat safety is too precious to lose, would something like the
following work?
switch (tracking_msg_flags) {
case REBASING | REMOTE_IS_BRANCH | ORIGIN:
printf(_("Branch %s set up to track remote branch %s ..."),
...
break;
case REBASING | REMOTE_IS_BRANCH:
printf(_(...
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 13:45 ` Jonathan Nieder
@ 2012-05-31 14:00 ` Nguyen Thai Ngoc Duy
2012-05-31 14:10 ` Jonathan Nieder
2012-05-31 17:56 ` Junio C Hamano
1 sibling, 1 reply; 19+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-31 14:00 UTC (permalink / raw)
To: Jonathan Nieder
Cc: git, Junio C Hamano, Ævar Arnfjörð, Jiang Xin
On Thu, May 31, 2012 at 8:45 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Thanks. Style: how about
>
> if (!cb->newlog)
> printf("would prune %s", message);
> else if (cb->cmd->verbose)
> printf("prune %s", message);
>
> ? I think that would be more readable than the lego original.
thanks
> BTW I'm not sure if this message would be a good candidate for
> translation. Especially in the --dry-run case, it feels like output
> that is intended to be simple enough for scripts to parse. (Though on
> the other hand, I don't know of any scripts or use cases that actually
> parse it, so maybe nobody would mind.)
it's gray area. reflog is not categorized as plumbing. Maybe adding
--plumbing for scripts?
--
Duy
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 14:00 ` Nguyen Thai Ngoc Duy
@ 2012-05-31 14:10 ` Jonathan Nieder
2012-05-31 14:18 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 19+ messages in thread
From: Jonathan Nieder @ 2012-05-31 14:10 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy
Cc: git, Junio C Hamano, Ævar Arnfjörð Bjarmason,
Jiang Xin
Nguyen Thai Ngoc Duy wrote:
> Maybe adding
> --plumbing for scripts?
That wouldn't take care of existing scripts, and new scripts should
use LC_ALL=C to defend themselves when they don't want to be impacted
by i18n.
Do you have some other reason in mind that a script should choose to
pass --plumbing here? Is it an output format flag specific to 'git
reflog expire', in the spirit of status --porcelain, or a more generic
"I care about output stability" flag that spans multiple commands?
Jonathan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 14:10 ` Jonathan Nieder
@ 2012-05-31 14:18 ` Nguyen Thai Ngoc Duy
0 siblings, 0 replies; 19+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-31 14:18 UTC (permalink / raw)
To: Jonathan Nieder
Cc: git, Junio C Hamano, Ævar Arnfjörð, Jiang Xin
On Thu, May 31, 2012 at 9:10 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Nguyen Thai Ngoc Duy wrote:
>
>> Maybe adding
>> --plumbing for scripts?
>
> That wouldn't take care of existing scripts, and new scripts should
> use LC_ALL=C to defend themselves when they don't want to be impacted
> by i18n.
>
> Do you have some other reason in mind that a script should choose to
> pass --plumbing here? Is it an output format flag specific to 'git
> reflog expire', in the spirit of status --porcelain, or a more generic
> "I care about output stability" flag that spans multiple commands?
I was thinking (but without checking) that this is the only way a
script can check for expired reflog entries. Maybe something more
script friendly, like ref names only.
--
Duy
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 13:45 ` Jonathan Nieder
2012-05-31 14:00 ` Nguyen Thai Ngoc Duy
@ 2012-05-31 17:56 ` Junio C Hamano
2012-05-31 20:31 ` Jonathan Nieder
1 sibling, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2012-05-31 17:56 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Nguyễn Thái Ngọc Duy, git,
Ævar Arnfjörð Bjarmason, Jiang Xin
Jonathan Nieder <jrnieder@gmail.com> writes:
> Thanks. Style: how about
>
> if (!cb->newlog)
> printf("would prune %s", message);
> else if (cb->cmd->verbose)
> printf("prune %s", message);
>
> ? I think that would be more readable than the lego original.
That is very much more preferred.
> BTW I'm not sure if this message would be a good candidate for
> translation.
These are for human consumption; they used to go to standard error
stream back when it was written at 4264dc1 (git reflog expire,
2006-12-19).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/6] reflog: remove i18n legos in pruning message
2012-05-31 17:56 ` Junio C Hamano
@ 2012-05-31 20:31 ` Jonathan Nieder
0 siblings, 0 replies; 19+ messages in thread
From: Jonathan Nieder @ 2012-05-31 20:31 UTC (permalink / raw)
To: Junio C Hamano
Cc: Nguyễn Thái Ngọc Duy, git,
Ævar Arnfjörð Bjarmason, Jiang Xin
Junio C Hamano wrote:
> These are for human consumption; they used to go to standard error
> stream back when it was written at 4264dc1 (git reflog expire,
> 2006-12-19).
Good. Thanks for clarifying and for looking that up.
Why was this changed to write to standard output in 1389d9dd (reflog
expire --fix-stale, 2007-01-06)? Would changing it back some time
to follow the usual "progress and diagnostics go to stderr" pattern
be worthwhile?
---
builtin/reflog.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git i/builtin/reflog.c w/builtin/reflog.c
index 062d7dad..90e820a0 100644
--- i/builtin/reflog.c
+++ w/builtin/reflog.c
@@ -327,11 +327,11 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
hashcpy(cb->last_kept_sha1, nsha1);
}
if (cb->cmd->verbose)
- printf("keep %s", message);
+ fprintf(stderr, "keep %s", message);
return 0;
prune:
if (!cb->newlog || cb->cmd->verbose)
- printf("%sprune %s", cb->newlog ? "" : "would ", message);
+ fprintf(stderr, "%sprune %s", cb->newlog ? "" : "would ", message);
return 0;
}
@@ -646,10 +646,10 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
if (cb.stalefix) {
init_revisions(&cb.revs, prefix);
if (cb.verbose)
- printf("Marking reachable objects...");
+ fprintf(stderr, "Marking reachable objects...");
mark_reachable_objects(&cb.revs, 0, NULL);
if (cb.verbose)
- putchar('\n');
+ fputc('\n', stderr);
}
if (do_all) {
--
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup
[not found] <0001-Remove-i18n-legos-in-notifying-new-branch-tracking-s.patch>
@ 2012-06-07 12:05 ` Nguyễn Thái Ngọc Duy
2012-06-07 18:44 ` Junio C Hamano
0 siblings, 1 reply; 19+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-06-07 12:05 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Jonathan Niedier,
Ævar Arnfjörð Bjarmason, Jiang Xin,
Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
More compact code compared to the lasst version while maintaining
-Wformat's effectiveness.
branch.c | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/branch.c b/branch.c
index eccdaf9..2bef1e7 100644
--- a/branch.c
+++ b/branch.c
@@ -74,25 +74,33 @@ void install_branch_config(int flag, const char *local, const char *origin, cons
strbuf_addf(&key, "branch.%s.rebase", local);
git_config_set(key.buf, "true");
}
+ strbuf_release(&key);
if (flag & BRANCH_CONFIG_VERBOSE) {
- strbuf_reset(&key);
-
- strbuf_addstr(&key, origin ? "remote" : "local");
-
- /* Are we tracking a proper "branch"? */
- if (remote_is_branch) {
- strbuf_addf(&key, " branch %s", shortname);
- if (origin)
- strbuf_addf(&key, " from %s", origin);
- }
+ if (remote_is_branch && origin)
+ printf(rebasing ?
+ "Branch %s set up to track remote branch %s from %s by rebasing.\n" :
+ "Branch %s set up to track remote branch %s from %s.\n",
+ local, shortname, origin);
+ else if (remote_is_branch && !origin)
+ printf(rebasing ?
+ "Branch %s set up to track local branch %s by rebasing.\n" :
+ "Branch %s set up to track local branch %s.\n",
+ local, shortname);
+ else if (!remote_is_branch && origin)
+ printf(rebasing ?
+ "Branch %s set up to track remote ref %s by rebasing.\n" :
+ "Branch %s set up to track remote ref %s.\n",
+ local, remote);
+ else if (!remote_is_branch && !origin)
+ printf(rebasing ?
+ "Branch %s set up to track local ref %s by rebasing.\n" :
+ "Branch %s set up to track local ref %s.\n",
+ local, remote);
else
- strbuf_addf(&key, " ref %s", remote);
- printf("Branch %s set up to track %s%s.\n",
- local, key.buf,
- rebasing ? " by rebasing" : "");
+ die("BUG: impossible combination of %d and %p",
+ remote_is_branch, origin);
}
- strbuf_release(&key);
}
/*
--
1.7.8
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup
2012-06-07 12:05 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
@ 2012-06-07 18:44 ` Junio C Hamano
0 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2012-06-07 18:44 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Jonathan Niedier, Ævar Arnfjörð Bjarmason,
Jiang Xin
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> More compact code compared to the lasst version while maintaining
> -Wformat's effectiveness.
I'd hesitate to burden translators with new set of strings this late
in the cycle. The changes look reasonable, though. Let's merge
this early in the next cycle and mark the strings for translation.
Thanks.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2012-06-07 18:44 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 11:20 [PATCH] i18n: apply: split to fix a partial i18n message Jiang Xin
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
2012-05-31 14:00 ` Jonathan Nieder
2012-05-31 13:04 ` [PATCH 2/6] reflog: remove i18n legos in pruning message Nguyễn Thái Ngọc Duy
2012-05-31 13:45 ` Jonathan Nieder
2012-05-31 14:00 ` Nguyen Thai Ngoc Duy
2012-05-31 14:10 ` Jonathan Nieder
2012-05-31 14:18 ` Nguyen Thai Ngoc Duy
2012-05-31 17:56 ` Junio C Hamano
2012-05-31 20:31 ` Jonathan Nieder
2012-05-31 13:04 ` [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages Nguyễn Thái Ngọc Duy
2012-05-31 13:52 ` Jonathan Nieder
2012-05-31 13:56 ` Nguyen Thai Ngoc Duy
2012-05-31 13:04 ` [PATCH 4/6] notes-merge: remove i18n legos in merge result message Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 5/6] rerere: remove i18n legos in " Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 6/6] unpack-trees: remove i18n legos in unpack's porcelain error messages Nguyễn Thái Ngọc Duy
[not found] <0001-Remove-i18n-legos-in-notifying-new-branch-tracking-s.patch>
2012-06-07 12:05 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
2012-06-07 18:44 ` Junio C Hamano
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).