Skip to content

Commit 2703572

Browse files
committed
Merge branch 'va/i18n-even-more'
More markings of messages for i18n, with updates to various tests to pass GETTEXT_POISON tests. One patch from the original submission dropped due to conflicts with jk/upload-pack-hook, which is still in flux. * va/i18n-even-more: (38 commits) t5541: become resilient to GETTEXT_POISON i18n: branch: mark comment when editing branch description for translation i18n: unmark die messages for translation i18n: submodule: escape shell variables inside eval_gettext i18n: submodule: join strings marked for translation i18n: init-db: join message pieces i18n: remote: allow translations to reorder message i18n: remote: mark URL fallback text for translation i18n: standardise messages i18n: sequencer: add period to error message i18n: merge: change command option help to lowercase i18n: merge: mark messages for translation i18n: notes: mark options for translation i18n: notes: mark strings for translation i18n: transport-helper.c: change N_() call to _() i18n: bisect: mark strings for translation t5523: use test_i18ngrep for negation t4153: fix negated test_i18ngrep call t9003: become resilient to GETTEXT_POISON tests: unpack-trees: update to use test_i18n* functions ...
2 parents b1ec08f + 415c7dd commit 2703572

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+516
-380
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,10 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
20632063
--keyword=gettextln --keyword=eval_gettextln
20642064
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
20652065
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
2066-
LOCALIZED_SH = $(SCRIPT_SH) git-parse-remote.sh
2066+
LOCALIZED_SH = $(SCRIPT_SH)
2067+
LOCALIZED_SH += git-parse-remote.sh
2068+
LOCALIZED_SH += git-rebase--interactive.sh
2069+
LOCALIZED_SH += git-sh-setup.sh
20672070
LOCALIZED_PERL = $(SCRIPT_PERL)
20682071

20692072
ifdef XGETTEXT_INCLUDE_TESTS

advice.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)
7979

8080
int error_resolve_conflict(const char *me)
8181
{
82-
error("%s is not possible because you have unmerged files.", me);
82+
if (!strcmp(me, "cherry-pick"))
83+
error(_("Cherry-picking is not possible because you have unmerged files."));
84+
else if (!strcmp(me, "commit"))
85+
error(_("Committing is not possible because you have unmerged files."));
86+
else if (!strcmp(me, "merge"))
87+
error(_("Merging is not possible because you have unmerged files."));
88+
else if (!strcmp(me, "pull"))
89+
error(_("Pulling is not possible because you have unmerged files."));
90+
else if (!strcmp(me, "revert"))
91+
error(_("Reverting is not possible because you have unmerged files."));
92+
else
93+
error(_("It is not possible to %s because you have unmerged files."),
94+
me);
95+
8396
if (advice_resolve_conflict)
8497
/*
8598
* Message used both when 'git commit' fails and when
@@ -93,7 +106,7 @@ int error_resolve_conflict(const char *me)
93106
void NORETURN die_resolve_conflict(const char *me)
94107
{
95108
error_resolve_conflict(me);
96-
die("Exiting because of an unresolved conflict.");
109+
die(_("Exiting because of an unresolved conflict."));
97110
}
98111

99112
void NORETURN die_conclude_merge(void)
@@ -106,14 +119,14 @@ void NORETURN die_conclude_merge(void)
106119

107120
void detach_advice(const char *new_name)
108121
{
109-
const char fmt[] =
110-
"Note: checking out '%s'.\n\n"
122+
const char *fmt =
123+
_("Note: checking out '%s'.\n\n"
111124
"You are in 'detached HEAD' state. You can look around, make experimental\n"
112125
"changes and commit them, and you can discard any commits you make in this\n"
113126
"state without impacting any branches by performing another checkout.\n\n"
114127
"If you want to create a new branch to retain commits you create, you may\n"
115128
"do so (now or later) by using -b with the checkout command again. Example:\n\n"
116-
" git checkout -b <new-branch-name>\n\n";
129+
" git checkout -b <new-branch-name>\n\n");
117130

118131
fprintf(stderr, fmt, new_name);
119132
}

bisect.c

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ static void read_bisect_paths(struct argv_array *array)
438438
FILE *fp = fopen(filename, "r");
439439

440440
if (!fp)
441-
die_errno("Could not open file '%s'", filename);
441+
die_errno(_("Could not open file '%s'"), filename);
442442

443443
while (strbuf_getline_lf(&str, fp) != EOF) {
444444
strbuf_trim(&str);
445445
if (sq_dequote_to_argv_array(str.buf, array))
446-
die("Badly quoted content in file '%s': %s",
446+
die(_("Badly quoted content in file '%s': %s"),
447447
filename, str.buf);
448448
}
449449

@@ -649,7 +649,7 @@ static void exit_if_skipped_commits(struct commit_list *tried,
649649
print_commit_list(tried, "%s\n", "%s\n");
650650
if (bad)
651651
printf("%s\n", oid_to_hex(bad));
652-
printf("We cannot bisect more!\n");
652+
printf(_("We cannot bisect more!\n"));
653653
exit(2);
654654
}
655655

@@ -702,7 +702,7 @@ static struct commit *get_commit_reference(const unsigned char *sha1)
702702
{
703703
struct commit *r = lookup_commit_reference(sha1);
704704
if (!r)
705-
die("Not a valid commit name %s", sha1_to_hex(sha1));
705+
die(_("Not a valid commit name %s"), sha1_to_hex(sha1));
706706
return r;
707707
}
708708

@@ -726,27 +726,27 @@ static void handle_bad_merge_base(void)
726726
char *bad_hex = oid_to_hex(current_bad_oid);
727727
char *good_hex = join_sha1_array_hex(&good_revs, ' ');
728728
if (!strcmp(term_bad, "bad") && !strcmp(term_good, "good")) {
729-
fprintf(stderr, "The merge base %s is bad.\n"
729+
fprintf(stderr, _("The merge base %s is bad.\n"
730730
"This means the bug has been fixed "
731-
"between %s and [%s].\n",
731+
"between %s and [%s].\n"),
732732
bad_hex, bad_hex, good_hex);
733733
} else if (!strcmp(term_bad, "new") && !strcmp(term_good, "old")) {
734-
fprintf(stderr, "The merge base %s is new.\n"
734+
fprintf(stderr, _("The merge base %s is new.\n"
735735
"The property has changed "
736-
"between %s and [%s].\n",
736+
"between %s and [%s].\n"),
737737
bad_hex, bad_hex, good_hex);
738738
} else {
739-
fprintf(stderr, "The merge base %s is %s.\n"
739+
fprintf(stderr, _("The merge base %s is %s.\n"
740740
"This means the first '%s' commit is "
741-
"between %s and [%s].\n",
741+
"between %s and [%s].\n"),
742742
bad_hex, term_bad, term_good, bad_hex, good_hex);
743743
}
744744
exit(3);
745745
}
746746

747-
fprintf(stderr, "Some %s revs are not ancestor of the %s rev.\n"
747+
fprintf(stderr, _("Some %s revs are not ancestor of the %s rev.\n"
748748
"git bisect cannot work properly in this case.\n"
749-
"Maybe you mistook %s and %s revs?\n",
749+
"Maybe you mistook %s and %s revs?\n"),
750750
term_good, term_bad, term_good, term_bad);
751751
exit(1);
752752
}
@@ -757,11 +757,11 @@ static void handle_skipped_merge_base(const unsigned char *mb)
757757
char *bad_hex = sha1_to_hex(current_bad_oid->hash);
758758
char *good_hex = join_sha1_array_hex(&good_revs, ' ');
759759

760-
warning("the merge base between %s and [%s] "
760+
warning(_("the merge base between %s and [%s] "
761761
"must be skipped.\n"
762762
"So we cannot be sure the first %s commit is "
763763
"between %s and %s.\n"
764-
"We continue anyway.",
764+
"We continue anyway."),
765765
bad_hex, good_hex, term_bad, mb_hex, bad_hex);
766766
free(good_hex);
767767
}
@@ -792,7 +792,7 @@ static void check_merge_bases(int no_checkout)
792792
} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {
793793
handle_skipped_merge_base(mb);
794794
} else {
795-
printf("Bisecting: a merge base must be tested\n");
795+
printf(_("Bisecting: a merge base must be tested\n"));
796796
exit(bisect_checkout(mb, no_checkout));
797797
}
798798
}
@@ -843,7 +843,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
843843
int fd;
844844

845845
if (!current_bad_oid)
846-
die("a %s revision is needed", term_bad);
846+
die(_("a %s revision is needed"), term_bad);
847847

848848
/* Check if file BISECT_ANCESTORS_OK exists. */
849849
if (!stat(filename, &st) && S_ISREG(st.st_mode))
@@ -860,7 +860,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
860860
/* Create file BISECT_ANCESTORS_OK. */
861861
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);
862862
if (fd < 0)
863-
warning_errno("could not create file '%s'",
863+
warning_errno(_("could not create file '%s'"),
864864
filename);
865865
else
866866
close(fd);
@@ -911,7 +911,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
911911
*read_good = "good";
912912
return;
913913
} else {
914-
die_errno("could not read file '%s'", filename);
914+
die_errno(_("could not read file '%s'"), filename);
915915
}
916916
} else {
917917
strbuf_getline_lf(&str, fp);
@@ -937,10 +937,11 @@ int bisect_next_all(const char *prefix, int no_checkout)
937937
struct commit_list *tried;
938938
int reaches = 0, all = 0, nr, steps;
939939
const unsigned char *bisect_rev;
940+
char steps_msg[32];
940941

941942
read_bisect_terms(&term_bad, &term_good);
942943
if (read_bisect_refs())
943-
die("reading bisect refs failed");
944+
die(_("reading bisect refs failed"));
944945

945946
check_good_are_ancestors_of_bad(prefix, no_checkout);
946947

@@ -960,16 +961,16 @@ int bisect_next_all(const char *prefix, int no_checkout)
960961
*/
961962
exit_if_skipped_commits(tried, NULL);
962963

963-
printf("%s was both %s and %s\n",
964+
printf(_("%s was both %s and %s\n"),
964965
oid_to_hex(current_bad_oid),
965966
term_good,
966967
term_bad);
967968
exit(1);
968969
}
969970

970971
if (!all) {
971-
fprintf(stderr, "No testable commit found.\n"
972-
"Maybe you started with bad path parameters?\n");
972+
fprintf(stderr, _("No testable commit found.\n"
973+
"Maybe you started with bad path parameters?\n"));
973974
exit(4);
974975
}
975976

@@ -986,9 +987,14 @@ int bisect_next_all(const char *prefix, int no_checkout)
986987

987988
nr = all - reaches - 1;
988989
steps = estimate_bisect_steps(all);
989-
printf("Bisecting: %d revision%s left to test after this "
990-
"(roughly %d step%s)\n", nr, (nr == 1 ? "" : "s"),
991-
steps, (steps == 1 ? "" : "s"));
990+
xsnprintf(steps_msg, sizeof(steps_msg),
991+
Q_("(roughly %d step)", "(roughly %d steps)", steps),
992+
steps);
993+
/* TRANSLATORS: the last %s will be replaced with
994+
"(roughly %d steps)" translation */
995+
printf(Q_("Bisecting: %d revision left to test after this %s\n",
996+
"Bisecting: %d revisions left to test after this %s\n",
997+
nr), nr, steps_msg);
992998

993999
return bisect_checkout(bisect_rev, no_checkout);
9941000
}

builtin/apply.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,7 +3359,7 @@ static int load_patch_target(struct apply_state *state,
33593359
{
33603360
if (state->cached || state->check_index) {
33613361
if (read_file_or_gitlink(ce, buf))
3362-
return error(_("read of %s failed"), name);
3362+
return error(_("failed to read %s"), name);
33633363
} else if (name) {
33643364
if (S_ISGITLINK(expected_mode)) {
33653365
if (ce)
@@ -3370,7 +3370,7 @@ static int load_patch_target(struct apply_state *state,
33703370
return error(_("reading from '%s' beyond a symbolic link"), name);
33713371
} else {
33723372
if (read_old_data(st, name, buf))
3373-
return error(_("read of %s failed"), name);
3373+
return error(_("failed to read %s"), name);
33743374
}
33753375
}
33763376
return 0;
@@ -3416,7 +3416,7 @@ static int load_preimage(struct apply_state *state,
34163416
free_fragment_list(patch->fragments);
34173417
patch->fragments = NULL;
34183418
} else if (status) {
3419-
return error(_("read of %s failed"), patch->old_name);
3419+
return error(_("failed to read %s"), patch->old_name);
34203420
}
34213421
}
34223422

builtin/branch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,9 @@ static int edit_branch_description(const char *branch_name)
614614
if (!buf.len || buf.buf[buf.len-1] != '\n')
615615
strbuf_addch(&buf, '\n');
616616
strbuf_commented_addf(&buf,
617-
"Please edit the description for the branch\n"
618-
" %s\n"
619-
"Lines starting with '%c' will be stripped.\n",
617+
_("Please edit the description for the branch\n"
618+
" %s\n"
619+
"Lines starting with '%c' will be stripped.\n"),
620620
branch_name, comment_line_char);
621621
if (write_file_gently(git_path(edit_description), "%s", buf.buf)) {
622622
strbuf_release(&buf);

builtin/checkout.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static int checkout_paths(const struct checkout_opts *opts,
276276

277277
hold_locked_index(lock_file, 1);
278278
if (read_cache_preload(&opts->pathspec) < 0)
279-
return error(_("corrupt index file"));
279+
return error(_("index file corrupt"));
280280

281281
if (opts->source_tree)
282282
read_tree_some(opts->source_tree, &opts->pathspec);
@@ -470,7 +470,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
470470

471471
hold_locked_index(lock_file, 1);
472472
if (read_cache_preload(NULL) < 0)
473-
return error(_("corrupt index file"));
473+
return error(_("index file corrupt"));
474474

475475
resolve_undo_clear();
476476
if (opts->force) {
@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
11381138
OPT_STRING('B', NULL, &opts.new_branch_force, N_("branch"),
11391139
N_("create/reset and checkout a branch")),
11401140
OPT_BOOL('l', NULL, &opts.new_branch_log, N_("create reflog for new branch")),
1141-
OPT_BOOL(0, "detach", &opts.force_detach, N_("detach the HEAD at named commit")),
1141+
OPT_BOOL(0, "detach", &opts.force_detach, N_("detach HEAD at named commit")),
11421142
OPT_SET_INT('t', "track", &opts.track, N_("set upstream info for new branch"),
11431143
BRANCH_TRACK_EXPLICIT),
11441144
OPT_STRING(0, "orphan", &opts.new_orphan_branch, N_("new-branch"), N_("new unparented branch")),

builtin/init-db.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,16 @@ int init_db(const char *template_dir, unsigned int flags)
397397
if (!(flags & INIT_DB_QUIET)) {
398398
int len = strlen(git_dir);
399399

400-
/* TRANSLATORS: The first '%s' is either "Reinitialized
401-
existing" or "Initialized empty", the second " shared" or
402-
"", and the last '%s%s' is the verbatim directory name. */
403-
printf(_("%s%s Git repository in %s%s\n"),
404-
reinit ? _("Reinitialized existing") : _("Initialized empty"),
405-
get_shared_repository() ? _(" shared") : "",
406-
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
400+
if (reinit)
401+
printf(get_shared_repository()
402+
? _("Reinitialized existing shared Git repository in %s%s\n")
403+
: _("Reinitialized existing Git repository in %s%s\n"),
404+
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
405+
else
406+
printf(get_shared_repository()
407+
? _("Initialized empty shared Git repository in %s%s\n")
408+
: _("Initialized empty Git repository in %s%s\n"),
409+
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
407410
}
408411

409412
return 0;

builtin/merge.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static struct option builtin_merge_options[] = {
211211
PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, FF_ONLY },
212212
OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
213213
OPT_BOOL(0, "verify-signatures", &verify_signatures,
214-
N_("Verify that the named commit has a valid GPG signature")),
214+
N_("verify that the named commit has a valid GPG signature")),
215215
OPT_CALLBACK('s', "strategy", &use_strategies, N_("strategy"),
216216
N_("merge strategy to use"), option_parse_strategy),
217217
OPT_CALLBACK('X', "strategy-option", &xopts, N_("option=value"),
@@ -1014,7 +1014,7 @@ static int default_edit_option(void)
10141014
if (e) {
10151015
int v = git_config_maybe_bool(name, e);
10161016
if (v < 0)
1017-
die("Bad value '%s' in environment '%s'", e, name);
1017+
die(_("Bad value '%s' in environment '%s'"), e, name);
10181018
return v;
10191019
}
10201020

@@ -1115,7 +1115,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge
11151115
if (!commit) {
11161116
if (ptr)
11171117
*ptr = '\0';
1118-
die("not something we can merge in %s: %s",
1118+
die(_("not something we can merge in %s: %s"),
11191119
filename, merge_names->buf + pos);
11201120
}
11211121
remotes = &commit_list_insert(commit, remotes)->next;
@@ -1149,7 +1149,7 @@ static struct commit_list *collect_parents(struct commit *head_commit,
11491149
struct commit *commit = get_merge_parent(argv[i]);
11501150
if (!commit)
11511151
help_unknown_ref(argv[i], "merge",
1152-
"not something we can merge");
1152+
_("not something we can merge"));
11531153
remotes = &commit_list_insert(commit, remotes)->next;
11541154
}
11551155
remoteheads = reduce_parents(head_commit, head_subsumed, remoteheads);
@@ -1421,7 +1421,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
14211421
* If head can reach all the merge then we are up to date.
14221422
* but first the most common case of merging one remote.
14231423
*/
1424-
finish_up_to_date("Already up-to-date.");
1424+
finish_up_to_date(_("Already up-to-date."));
14251425
goto done;
14261426
} else if (fast_forward != FF_NO && !remoteheads->next &&
14271427
!common->next &&
@@ -1506,7 +1506,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
15061506
}
15071507
}
15081508
if (up_to_date) {
1509-
finish_up_to_date("Already up-to-date. Yeeah!");
1509+
finish_up_to_date(_("Already up-to-date. Yeeah!"));
15101510
goto done;
15111511
}
15121512
}

0 commit comments

Comments
 (0)