From e3f54bff43e61934643108ee26bfe1ad0c19c6a3 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:58:58 +0000 Subject: i18n: blame: mark error messages for translation Mark error messages for translation passed to die() function. Change "Cannot" to lowercase following the usual style. Reflect changes to test by using test_i18ngrep. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/blame.c b/builtin/blame.c index a5bbf91..27aea79 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2601,7 +2601,7 @@ parse_done: if (incremental || (output_option & OUTPUT_PORCELAIN)) { if (show_progress > 0) - die("--progress can't be used with --incremental or porcelain formats"); + die(_("--progress can't be used with --incremental or porcelain formats")); show_progress = 0; } else if (show_progress < 0) show_progress = isatty(2); @@ -2727,7 +2727,7 @@ parse_done: sb.commits.compare = compare_commits_by_commit_date; } else if (contents_from) - die("--contents and --reverse do not blend well."); + die(_("--contents and --reverse do not blend well.")); else { final_commit_name = prepare_initial(&sb); sb.commits.compare = compare_commits_by_reverse_commit_date; @@ -2747,12 +2747,12 @@ parse_done: add_pending_object(&revs, &(sb.final->object), ":"); } else if (contents_from) - die("Cannot use --contents with final commit object name"); + die(_("cannot use --contents with final commit object name")); if (reverse && revs.first_parent_only) { final_commit = find_single_final(sb.revs, NULL); if (!final_commit) - die("--reverse and --first-parent together require specified latest commit"); + die(_("--reverse and --first-parent together require specified latest commit")); } /* @@ -2779,7 +2779,7 @@ parse_done: } if (oidcmp(&c->object.oid, &sb.final->object.oid)) - die("--reverse --first-parent together require range along first-parent chain"); + die(_("--reverse --first-parent together require range along first-parent chain")); } if (is_null_oid(&sb.final->object.oid)) { @@ -2790,7 +2790,7 @@ parse_done: else { o = get_origin(&sb, sb.final, path); if (fill_blob_sha1_and_mode(o)) - die("no such path %s in %s", path, final_commit_name); + die(_("no such path %s in %s"), path, final_commit_name); if (DIFF_OPT_TST(&sb.revs->diffopt, ALLOW_TEXTCONV) && textconv_object(path, o->mode, o->blob_sha1, 1, (char **) &sb.final_buf, @@ -2801,7 +2801,7 @@ parse_done: &sb.final_buf_size); if (!sb.final_buf) - die("Cannot read blob %s for path %s", + die(_("cannot read blob %s for path %s"), sha1_to_hex(o->blob_sha1), path); } @@ -2820,7 +2820,9 @@ parse_done: &bottom, &top, sb.path)) usage(blame_usage); if (lno < top || ((lno || bottom) && lno < bottom)) - die("file %s has only %lu lines", path, lno); + die(Q_("file %s has only %lu line", + "file %s has only %lu lines", + lno), path, lno); if (bottom < 1) bottom = 1; if (top < 1) diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index e48370d..661f9d4 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -212,12 +212,12 @@ EOF test_expect_success 'blame -L with invalid start' ' test_must_fail git blame -L5 tres 2>errors && - grep "has only 2 lines" errors + test_i18ngrep "has only 2 lines" errors ' test_expect_success 'blame -L with invalid end' ' test_must_fail git blame -L1,5 tres 2>errors && - grep "has only 2 lines" errors + test_i18ngrep "has only 2 lines" errors ' test_expect_success 'blame parses part of -L' ' -- cgit v0.10.2-6-g49f6 From fb4cc6a9cb9b701fb2f7d30b20d0c3c4ceea5882 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:58:59 +0000 Subject: i18n: branch: mark option description for translation Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/branch.c b/builtin/branch.c index 7df0543..d5d93a8 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -657,7 +657,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT_SET_INT( 0, "set-upstream", &track, N_("change upstream info"), BRANCH_TRACK_OVERRIDE), OPT_STRING('u', "set-upstream-to", &new_upstream, N_("upstream"), N_("change the upstream info")), - OPT_BOOL(0, "unset-upstream", &unset_upstream, "Unset the upstream info"), + OPT_BOOL(0, "unset-upstream", &unset_upstream, N_("Unset the upstream info")), OPT__COLOR(&branch_use_color, N_("use colored output")), OPT_SET_INT('r', "remotes", &filter.kind, N_("act on remote-tracking branches"), FILTER_REFS_REMOTES), -- cgit v0.10.2-6-g49f6 From ccf638015418d59aafa475b181334f12c1b916df Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:00 +0000 Subject: i18n: config: mark error message for translation Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/config.c b/builtin/config.c index 6cbf733..05843a0 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -622,8 +622,8 @@ int cmd_config(int argc, const char **argv, const char *prefix) value = normalize_value(argv[0], argv[1]); ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value); if (ret == CONFIG_NOTHING_SET) - error("cannot overwrite multiple values with a single value\n" - " Use a regexp, --add or --replace-all to change %s.", argv[0]); + error(_("cannot overwrite multiple values with a single value\n" + " Use a regexp, --add or --replace-all to change %s."), argv[0]); return ret; } else if (actions == ACTION_SET_ALL) { -- cgit v0.10.2-6-g49f6 From ccf7813139f0cb8800b0490d572a22c864a2f0f6 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:01 +0000 Subject: i18n: merge-recursive: mark error messages for translation Spell the first word of such error messages in lowercase, following the usual style. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index fd2c455..3b09610 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -42,30 +42,33 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) if (!arg[2]) break; if (parse_merge_opt(&o, arg + 2)) - die("Unknown option %s", arg); + die(_("unknown option %s"), arg); continue; } if (bases_count < ARRAY_SIZE(bases)-1) { struct object_id *oid = xmalloc(sizeof(struct object_id)); if (get_oid(argv[i], oid)) - die("Could not parse object '%s'", argv[i]); + die(_("could not parse object '%s'"), argv[i]); bases[bases_count++] = oid; } else - warning("Cannot handle more than %d bases. " - "Ignoring %s.", + warning(Q_("cannot handle more than %d base. " + "Ignoring %s.", + "cannot handle more than %d bases. " + "Ignoring %s.", + (int)ARRAY_SIZE(bases)-1), (int)ARRAY_SIZE(bases)-1, argv[i]); } if (argc - i != 3) /* "--" "" "" */ - die("Not handling anything other than two heads merge."); + die(_("not handling anything other than two heads merge.")); o.branch1 = argv[++i]; o.branch2 = argv[++i]; if (get_oid(o.branch1, &h1)) - die("Could not resolve ref '%s'", o.branch1); + die(_("could not resolve ref '%s'"), o.branch1); if (get_oid(o.branch2, &h2)) - die("Could not resolve ref '%s'", o.branch2); + die(_("could not resolve ref '%s'"), o.branch2); o.branch1 = better_branch_name(o.branch1); o.branch2 = better_branch_name(o.branch2); -- cgit v0.10.2-6-g49f6 From 765773c8397800218e7389fd3e9431cfbfdb6ad1 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:02 +0000 Subject: i18n: merge-recursive: mark verbose message for translation Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index 3b09610..0dd9021 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -74,7 +74,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) o.branch2 = better_branch_name(o.branch2); if (o.verbosity >= 3) - printf("Merging %s with %s\n", o.branch1, o.branch2); + printf(_("Merging %s with %s\n"), o.branch1, o.branch2); failed = merge_recursive_generic(&o, &h1, &h2, bases_count, bases, &result); if (failed < 0) -- cgit v0.10.2-6-g49f6 From 2d1252dade6cdc32be071aabddc0b9fc5ca9af46 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:03 +0000 Subject: i18n: notes: mark error messages for translation Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/notes.c b/builtin/notes.c index f848b89..229ad6d 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -340,7 +340,9 @@ static struct notes_tree *init_notes_check(const char *subcommand, ref = (flags & NOTES_INIT_WRITABLE) ? t->update_ref : t->ref; if (!starts_with(ref, "refs/notes/")) - die("Refusing to %s notes in %s (outside of refs/notes/)", + /* TRANSLATORS: the first %s will be replaced by a + git notes command: 'add', 'merge', 'remove', etc.*/ + die(_("Refusing to %s notes in %s (outside of refs/notes/)"), subcommand, ref); return t; } @@ -680,11 +682,11 @@ static int merge_abort(struct notes_merge_options *o) */ if (delete_ref("NOTES_MERGE_PARTIAL", NULL, 0)) - ret += error("Failed to delete ref NOTES_MERGE_PARTIAL"); + ret += error(_("Failed to delete ref NOTES_MERGE_PARTIAL")); if (delete_ref("NOTES_MERGE_REF", NULL, REF_NODEREF)) - ret += error("Failed to delete ref NOTES_MERGE_REF"); + ret += error(_("Failed to delete ref NOTES_MERGE_REF")); if (notes_merge_abort(o)) - ret += error("Failed to remove 'git notes merge' worktree"); + ret += error(_("Failed to remove 'git notes merge' worktree")); return ret; } @@ -704,11 +706,11 @@ static int merge_commit(struct notes_merge_options *o) */ if (get_sha1("NOTES_MERGE_PARTIAL", sha1)) - die("Failed to read ref NOTES_MERGE_PARTIAL"); + die(_("Failed to read ref NOTES_MERGE_PARTIAL")); else if (!(partial = lookup_commit_reference(sha1))) - die("Could not find commit from NOTES_MERGE_PARTIAL."); + die(_("Could not find commit from NOTES_MERGE_PARTIAL.")); else if (parse_commit(partial)) - die("Could not parse commit from NOTES_MERGE_PARTIAL."); + die(_("Could not parse commit from NOTES_MERGE_PARTIAL.")); if (partial->parents) hashcpy(parent_sha1, partial->parents->item->object.oid.hash); @@ -721,10 +723,10 @@ static int merge_commit(struct notes_merge_options *o) o->local_ref = local_ref_to_free = resolve_refdup("NOTES_MERGE_REF", 0, sha1, NULL); if (!o->local_ref) - die("Failed to resolve NOTES_MERGE_REF"); + die(_("Failed to resolve NOTES_MERGE_REF")); if (notes_merge_commit(o, t, partial, sha1)) - die("Failed to finalize notes merge"); + die(_("Failed to finalize notes merge")); /* Reuse existing commit message in reflog message */ memset(&pretty_ctx, 0, sizeof(pretty_ctx)); -- cgit v0.10.2-6-g49f6 From 8d79589ad61132e038dd7312ab018c6d6518ead7 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:04 +0000 Subject: notes: spell first word of error messages in lowercase That's the usual style. Update one test to reflect these changes. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/notes.c b/builtin/notes.c index 229ad6d..5248a9b 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -191,7 +191,7 @@ static void prepare_note_data(const unsigned char *object, struct note_data *d, strbuf_reset(&d->buf); if (launch_editor(d->edit_path, &d->buf, NULL)) { - die(_("Please supply the note contents using either -m or -F option")); + die(_("please supply the note contents using either -m or -F option")); } strbuf_stripspace(&d->buf, 1); } @@ -202,7 +202,7 @@ static void write_note_data(struct note_data *d, unsigned char *sha1) if (write_sha1_file(d->buf.buf, d->buf.len, blob_type, sha1)) { error(_("unable to write note object")); if (d->edit_path) - error(_("The note contents have been left in %s"), + error(_("the note contents have been left in %s"), d->edit_path); exit(128); } @@ -251,14 +251,14 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset) strbuf_addch(&d->buf, '\n'); if (get_sha1(arg, object)) - die(_("Failed to resolve '%s' as a valid ref."), arg); + die(_("failed to resolve '%s' as a valid ref."), arg); if (!(buf = read_sha1_file(object, &type, &len))) { free(buf); - die(_("Failed to read object '%s'."), arg); + die(_("failed to read object '%s'."), arg); } if (type != OBJ_BLOB) { free(buf); - die(_("Cannot read note data from non-blob object '%s'."), arg); + die(_("cannot read note data from non-blob object '%s'."), arg); } strbuf_add(&d->buf, buf, len); free(buf); @@ -298,13 +298,13 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd) split = strbuf_split(&buf, ' '); if (!split[0] || !split[1]) - die(_("Malformed input line: '%s'."), buf.buf); + die(_("malformed input line: '%s'."), buf.buf); strbuf_rtrim(split[0]); strbuf_rtrim(split[1]); if (get_sha1(split[0]->buf, from_obj)) - die(_("Failed to resolve '%s' as a valid ref."), split[0]->buf); + die(_("failed to resolve '%s' as a valid ref."), split[0]->buf); if (get_sha1(split[1]->buf, to_obj)) - die(_("Failed to resolve '%s' as a valid ref."), split[1]->buf); + die(_("failed to resolve '%s' as a valid ref."), split[1]->buf); if (rewrite_cmd) err = copy_note_for_rewrite(c, from_obj, to_obj); @@ -313,7 +313,7 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd) combine_notes_overwrite); if (err) { - error(_("Failed to copy notes from '%s' to '%s'"), + error(_("failed to copy notes from '%s' to '%s'"), split[0]->buf, split[1]->buf); ret = 1; } @@ -342,7 +342,7 @@ static struct notes_tree *init_notes_check(const char *subcommand, if (!starts_with(ref, "refs/notes/")) /* TRANSLATORS: the first %s will be replaced by a git notes command: 'add', 'merge', 'remove', etc.*/ - die(_("Refusing to %s notes in %s (outside of refs/notes/)"), + die(_("refusing to %s notes in %s (outside of refs/notes/)"), subcommand, ref); return t; } @@ -369,13 +369,13 @@ static int list(int argc, const char **argv, const char *prefix) t = init_notes_check("list", 0); if (argc) { if (get_sha1(argv[0], object)) - die(_("Failed to resolve '%s' as a valid ref."), argv[0]); + die(_("failed to resolve '%s' as a valid ref."), argv[0]); note = get_note(t, object); if (note) { puts(sha1_to_hex(note)); retval = 0; } else - retval = error(_("No note found for object %s."), + retval = error(_("no note found for object %s."), sha1_to_hex(object)); } else retval = for_each_note(t, 0, list_each_note, NULL); @@ -424,7 +424,7 @@ static int add(int argc, const char **argv, const char *prefix) object_ref = argc > 1 ? argv[1] : "HEAD"; if (get_sha1(object_ref, object)) - die(_("Failed to resolve '%s' as a valid ref."), object_ref); + die(_("failed to resolve '%s' as a valid ref."), object_ref); t = init_notes_check("add", NOTES_INIT_WRITABLE); note = get_note(t, object); @@ -510,12 +510,12 @@ static int copy(int argc, const char **argv, const char *prefix) } if (get_sha1(argv[0], from_obj)) - die(_("Failed to resolve '%s' as a valid ref."), argv[0]); + die(_("failed to resolve '%s' as a valid ref."), argv[0]); object_ref = 1 < argc ? argv[1] : "HEAD"; if (get_sha1(object_ref, object)) - die(_("Failed to resolve '%s' as a valid ref."), object_ref); + die(_("failed to resolve '%s' as a valid ref."), object_ref); t = init_notes_check("copy", NOTES_INIT_WRITABLE); note = get_note(t, object); @@ -534,7 +534,7 @@ static int copy(int argc, const char **argv, const char *prefix) from_note = get_note(t, from_obj); if (!from_note) { - retval = error(_("Missing notes on source object %s. Cannot " + retval = error(_("missing notes on source object %s. Cannot " "copy."), sha1_to_hex(from_obj)); goto out; } @@ -593,7 +593,7 @@ static int append_edit(int argc, const char **argv, const char *prefix) object_ref = 1 < argc ? argv[1] : "HEAD"; if (get_sha1(object_ref, object)) - die(_("Failed to resolve '%s' as a valid ref."), object_ref); + die(_("failed to resolve '%s' as a valid ref."), object_ref); t = init_notes_check(argv[0], NOTES_INIT_WRITABLE); note = get_note(t, object); @@ -656,13 +656,13 @@ static int show(int argc, const char **argv, const char *prefix) object_ref = argc ? argv[0] : "HEAD"; if (get_sha1(object_ref, object)) - die(_("Failed to resolve '%s' as a valid ref."), object_ref); + die(_("failed to resolve '%s' as a valid ref."), object_ref); t = init_notes_check("show", 0); note = get_note(t, object); if (!note) - retval = error(_("No note found for object %s."), + retval = error(_("no note found for object %s."), sha1_to_hex(object)); else { const char *show_args[3] = {"show", sha1_to_hex(note), NULL}; @@ -682,11 +682,11 @@ static int merge_abort(struct notes_merge_options *o) */ if (delete_ref("NOTES_MERGE_PARTIAL", NULL, 0)) - ret += error(_("Failed to delete ref NOTES_MERGE_PARTIAL")); + ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL")); if (delete_ref("NOTES_MERGE_REF", NULL, REF_NODEREF)) - ret += error(_("Failed to delete ref NOTES_MERGE_REF")); + ret += error(_("failed to delete ref NOTES_MERGE_REF")); if (notes_merge_abort(o)) - ret += error(_("Failed to remove 'git notes merge' worktree")); + ret += error(_("failed to remove 'git notes merge' worktree")); return ret; } @@ -706,11 +706,11 @@ static int merge_commit(struct notes_merge_options *o) */ if (get_sha1("NOTES_MERGE_PARTIAL", sha1)) - die(_("Failed to read ref NOTES_MERGE_PARTIAL")); + die(_("failed to read ref NOTES_MERGE_PARTIAL")); else if (!(partial = lookup_commit_reference(sha1))) - die(_("Could not find commit from NOTES_MERGE_PARTIAL.")); + die(_("could not find commit from NOTES_MERGE_PARTIAL.")); else if (parse_commit(partial)) - die(_("Could not parse commit from NOTES_MERGE_PARTIAL.")); + die(_("could not parse commit from NOTES_MERGE_PARTIAL.")); if (partial->parents) hashcpy(parent_sha1, partial->parents->item->object.oid.hash); @@ -723,10 +723,10 @@ static int merge_commit(struct notes_merge_options *o) o->local_ref = local_ref_to_free = resolve_refdup("NOTES_MERGE_REF", 0, sha1, NULL); if (!o->local_ref) - die(_("Failed to resolve NOTES_MERGE_REF")); + die(_("failed to resolve NOTES_MERGE_REF")); if (notes_merge_commit(o, t, partial, sha1)) - die(_("Failed to finalize notes merge")); + die(_("failed to finalize notes merge")); /* Reuse existing commit message in reflog message */ memset(&pretty_ctx, 0, sizeof(pretty_ctx)); @@ -796,7 +796,7 @@ static int merge(int argc, const char **argv, const char *prefix) } if (do_merge && argc != 1) { - error(_("Must specify a notes ref to merge")); + error(_("must specify a notes ref to merge")); usage_with_options(git_notes_merge_usage, options); } else if (!do_merge && argc) { error(_("too many parameters")); @@ -820,7 +820,7 @@ static int merge(int argc, const char **argv, const char *prefix) if (strategy) { if (parse_notes_merge_strategy(strategy, &o.strategy)) { - error(_("Unknown -s/--strategy: %s"), strategy); + error(_("unknown -s/--strategy: %s"), strategy); usage_with_options(git_notes_merge_usage, options); } } else { @@ -857,10 +857,10 @@ static int merge(int argc, const char **argv, const char *prefix) /* Store ref-to-be-updated into .git/NOTES_MERGE_REF */ wt = find_shared_symref("NOTES_MERGE_REF", default_notes_ref()); if (wt) - die(_("A notes merge into %s is already in-progress at %s"), + die(_("a notes merge into %s is already in-progress at %s"), default_notes_ref(), wt->path); if (create_symref("NOTES_MERGE_REF", default_notes_ref(), NULL)) - die(_("Failed to store link to current notes ref (%s)"), + die(_("failed to store link to current notes ref (%s)"), default_notes_ref()); printf(_("Automatic notes merge failed. Fix conflicts in %s and " "commit the result with 'git notes merge --commit', or " @@ -1016,7 +1016,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix) else if (!strcmp(argv[0], "get-ref")) result = get_ref(argc, argv, prefix); else { - result = error(_("Unknown subcommand: %s"), argv[0]); + result = error(_("unknown subcommand: %s"), argv[0]); usage_with_options(git_notes_usage, options); } diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh index 6e05115..b9c3bc2 100755 --- a/t/t3320-notes-merge-worktrees.sh +++ b/t/t3320-notes-merge-worktrees.sh @@ -52,7 +52,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' ' cd worktree && git config core.notesRef refs/notes/y && test_must_fail git notes merge z 2>err && - test_i18ngrep "A notes merge into refs/notes/y is already in-progress at" err + test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err ) && test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF ' -- cgit v0.10.2-6-g49f6 From 8ba35a2dc696c1b9eb95976a690b61d375a083d5 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:05 +0000 Subject: i18n: receive-pack: mark messages for translation Mark messages refuse_unconfigured_deny_msg and refuse_unconfigured_deny_delete_current_msg for translation. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 011db00..79839d0 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -775,47 +775,39 @@ static int is_ref_checked_out(const char *ref) return !strcmp(head_name, ref); } -static char *refuse_unconfigured_deny_msg[] = { - "By default, updating the current branch in a non-bare repository", - "is denied, because it will make the index and work tree inconsistent", - "with what you pushed, and will require 'git reset --hard' to match", - "the work tree to HEAD.", - "", - "You can set 'receive.denyCurrentBranch' configuration variable to", - "'ignore' or 'warn' in the remote repository to allow pushing into", - "its current branch; however, this is not recommended unless you", - "arranged to update its work tree to match what you pushed in some", - "other way.", - "", - "To squelch this message and still keep the default behaviour, set", - "'receive.denyCurrentBranch' configuration variable to 'refuse'." -}; +static char *refuse_unconfigured_deny_msg = + N_("By default, updating the current branch in a non-bare repository\n" + "is denied, because it will make the index and work tree inconsistent\n" + "with what you pushed, and will require 'git reset --hard' to match\n" + "the work tree to HEAD.\n" + "\n" + "You can set 'receive.denyCurrentBranch' configuration variable to\n" + "'ignore' or 'warn' in the remote repository to allow pushing into\n" + "its current branch; however, this is not recommended unless you\n" + "arranged to update its work tree to match what you pushed in some\n" + "other way.\n" + "\n" + "To squelch this message and still keep the default behaviour, set\n" + "'receive.denyCurrentBranch' configuration variable to 'refuse'."); static void refuse_unconfigured_deny(void) { - int i; - for (i = 0; i < ARRAY_SIZE(refuse_unconfigured_deny_msg); i++) - rp_error("%s", refuse_unconfigured_deny_msg[i]); + rp_error("%s", _(refuse_unconfigured_deny_msg)); } -static char *refuse_unconfigured_deny_delete_current_msg[] = { - "By default, deleting the current branch is denied, because the next", - "'git clone' won't result in any file checked out, causing confusion.", - "", - "You can set 'receive.denyDeleteCurrent' configuration variable to", - "'warn' or 'ignore' in the remote repository to allow deleting the", - "current branch, with or without a warning message.", - "", - "To squelch this message, you can set it to 'refuse'." -}; +static char *refuse_unconfigured_deny_delete_current_msg = + N_("By default, deleting the current branch is denied, because the next\n" + "'git clone' won't result in any file checked out, causing confusion.\n" + "\n" + "You can set 'receive.denyDeleteCurrent' configuration variable to\n" + "'warn' or 'ignore' in the remote repository to allow deleting the\n" + "current branch, with or without a warning message.\n" + "\n" + "To squelch this message, you can set it to 'refuse'."); static void refuse_unconfigured_deny_delete_current(void) { - int i; - for (i = 0; - i < ARRAY_SIZE(refuse_unconfigured_deny_delete_current_msg); - i++) - rp_error("%s", refuse_unconfigured_deny_delete_current_msg[i]); + rp_error("%s", _(refuse_unconfigured_deny_delete_current_msg)); } static int command_singleton_iterator(void *cb_data, unsigned char sha1[20]); -- cgit v0.10.2-6-g49f6 From 8a78d462c9d47a362b27b0386b40a44e192695d4 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:06 +0000 Subject: i18n: show-branch: mark error messages for translation Spell the first word of messages in lowercase, following the usual style. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 2566935..5809371 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -538,7 +538,7 @@ static void append_one_rev(const char *av) for_each_ref(append_matching_ref, NULL); if (saved_matches == ref_name_cnt && ref_name_cnt < MAX_REVS) - error("no matching refs with %s", av); + error(_("no matching refs with %s"), av); if (saved_matches + 1 < ref_name_cnt) sort_ref_range(saved_matches, ref_name_cnt); return; @@ -701,8 +701,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) * * Also --all and --remotes do not make sense either. */ - die("--reflog is incompatible with --all, --remotes, " - "--independent or --merge-base"); + die(_("--reflog is incompatible with --all, --remotes, " + "--independent or --merge-base")); } /* If nothing is specified, show all branches by default */ @@ -725,16 +725,16 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) av = fake_av; ac = 1; if (!*av) - die("no branches given, and HEAD is not valid"); + die(_("no branches given, and HEAD is not valid")); } if (ac != 1) - die("--reflog option needs one branch name"); + die(_("--reflog option needs one branch name")); if (MAX_REVS < reflog) die("Only %d entries can be shown at one time.", MAX_REVS); if (!dwim_ref(*av, strlen(*av), oid.hash, &ref)) - die("No such ref %s", *av); + die(_("no such ref %s"), *av); /* Has the base been specified? */ if (reflog_base) { @@ -828,10 +828,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) if (MAX_REVS <= num_rev) die("cannot handle more than %d revs.", MAX_REVS); if (get_sha1(ref_name[num_rev], revkey.hash)) - die("'%s' is not a valid ref.", ref_name[num_rev]); + die(_("'%s' is not a valid ref."), ref_name[num_rev]); commit = lookup_commit_reference(revkey.hash); if (!commit) - die("cannot find commit %s (%s)", + die(_("cannot find commit %s (%s)"), ref_name[num_rev], oid_to_hex(&revkey)); parse_commit(commit); mark_seen(commit, &seen); -- cgit v0.10.2-6-g49f6 From 205d13451d52722420cba32cebd5962e0d92793e Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:07 +0000 Subject: i18n: show-branch: mark plural strings for translation Mark plural string for translation using Q_(). Although we already know that the plural sentence is always used in the English source, other languages have complex plural rules they must comply according to the value of MAX_REVS. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 5809371..623ca56 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -373,8 +373,9 @@ static int append_ref(const char *refname, const struct object_id *oid, return 0; } if (MAX_REVS <= ref_name_cnt) { - warning("ignoring %s; cannot handle more than %d refs", - refname, MAX_REVS); + warning(Q_("ignoring %s; cannot handle more than %d ref", + "ignoring %s; cannot handle more than %d refs", + MAX_REVS), refname, MAX_REVS); return 0; } ref_name[ref_name_cnt++] = xstrdup(refname); @@ -731,8 +732,9 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) die(_("--reflog option needs one branch name")); if (MAX_REVS < reflog) - die("Only %d entries can be shown at one time.", - MAX_REVS); + die(Q_("only %d entry can be shown at one time.", + "only %d entries can be shown at one time.", + MAX_REVS), MAX_REVS); if (!dwim_ref(*av, strlen(*av), oid.hash, &ref)) die(_("no such ref %s"), *av); @@ -826,7 +828,9 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) unsigned int flag = 1u << (num_rev + REV_SHIFT); if (MAX_REVS <= num_rev) - die("cannot handle more than %d revs.", MAX_REVS); + die(Q_("cannot handle more than %d rev.", + "cannot handle more than %d revs.", + MAX_REVS), MAX_REVS); if (get_sha1(ref_name[num_rev], revkey.hash)) die(_("'%s' is not a valid ref."), ref_name[num_rev]); commit = lookup_commit_reference(revkey.hash); -- cgit v0.10.2-6-g49f6 From 43073f89848d4683656a0770e8ee8d1e1734e6e3 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Thu, 15 Sep 2016 14:59:08 +0000 Subject: i18n: update-index: mark warnings for translation Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano diff --git a/builtin/update-index.c b/builtin/update-index.c index ba04b19..7a17ce1 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1127,9 +1127,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) break; case UC_DISABLE: if (git_config_get_untracked_cache() == 1) - warning("core.untrackedCache is set to true; " - "remove or change it, if you really want to " - "disable the untracked cache"); + warning(_("core.untrackedCache is set to true; " + "remove or change it, if you really want to " + "disable the untracked cache")); remove_untracked_cache(&the_index); report(_("Untracked cache disabled")); break; @@ -1139,9 +1139,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) case UC_ENABLE: case UC_FORCE: if (git_config_get_untracked_cache() == 0) - warning("core.untrackedCache is set to false; " - "remove or change it, if you really want to " - "enable the untracked cache"); + warning(_("core.untrackedCache is set to false; " + "remove or change it, if you really want to " + "enable the untracked cache")); add_untracked_cache(&the_index); report(_("Untracked cache enabled for '%s'"), get_git_work_tree()); break; -- cgit v0.10.2-6-g49f6