Skip to content

Commit d53287b

Browse files
chriscoolgitster
authored andcommitted
fast-export: mark strings for translation
Some error or warning messages in "builtin/fast-export.c" are marked for translation, but many are not. To be more consistent and provide a better experience to people using a translated version, let's mark all the remaining error or warning messages for translation. While at it: - improve how some arguments to some error functions are indented, - remove "Error:" at the start of an error message, - downcase error and warning messages that start with an uppercase. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2d7cc86 commit d53287b

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

builtin/fast-export.c

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int parse_opt_sign_mode(const struct option *opt,
6565
return 0;
6666

6767
if (parse_sign_mode(arg, val))
68-
return error("Unknown %s mode: %s", opt->long_name, arg);
68+
return error(_("unknown %s mode: %s"), opt->long_name, arg);
6969

7070
return 0;
7171
}
@@ -82,7 +82,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt,
8282
else if (!strcmp(arg, "rewrite"))
8383
*val = REWRITE;
8484
else
85-
return error("Unknown tag-of-filtered mode: %s", arg);
85+
return error(_("unknown tag-of-filtered mode: %s"), arg);
8686
return 0;
8787
}
8888

@@ -107,7 +107,7 @@ static int parse_opt_reencode_mode(const struct option *opt,
107107
if (!strcasecmp(arg, "abort"))
108108
*val = REENCODE_ABORT;
109109
else
110-
return error("Unknown reencoding mode: %s", arg);
110+
return error(_("unknown reencoding mode: %s"), arg);
111111
}
112112

113113
return 0;
@@ -318,16 +318,16 @@ static void export_blob(const struct object_id *oid)
318318
} else {
319319
buf = odb_read_object(the_repository->objects, oid, &type, &size);
320320
if (!buf)
321-
die("could not read blob %s", oid_to_hex(oid));
321+
die(_("could not read blob %s"), oid_to_hex(oid));
322322
if (check_object_signature(the_repository, oid, buf, size,
323323
type) < 0)
324-
die("oid mismatch in blob %s", oid_to_hex(oid));
324+
die(_("oid mismatch in blob %s"), oid_to_hex(oid));
325325
object = parse_object_buffer(the_repository, oid, type,
326326
size, buf, &eaten);
327327
}
328328

329329
if (!object)
330-
die("Could not read blob %s", oid_to_hex(oid));
330+
die(_("could not read blob %s"), oid_to_hex(oid));
331331

332332
mark_next_object(object);
333333

@@ -336,7 +336,7 @@ static void export_blob(const struct object_id *oid)
336336
printf("original-oid %s\n", oid_to_hex(oid));
337337
printf("data %"PRIuMAX"\n", (uintmax_t)size);
338338
if (size && fwrite(buf, size, 1, stdout) != 1)
339-
die_errno("could not write blob '%s'", oid_to_hex(oid));
339+
die_errno(_("could not write blob '%s'"), oid_to_hex(oid));
340340
printf("\n");
341341

342342
show_progress();
@@ -499,10 +499,10 @@ static void show_filemodify(struct diff_queue_struct *q,
499499
break;
500500

501501
default:
502-
die("Unexpected comparison status '%c' for %s, %s",
503-
q->queue[i]->status,
504-
ospec->path ? ospec->path : "none",
505-
spec->path ? spec->path : "none");
502+
die(_("unexpected comparison status '%c' for %s, %s"),
503+
q->queue[i]->status,
504+
ospec->path ? ospec->path : _("none"),
505+
spec->path ? spec->path : _("none"));
506506
}
507507
}
508508
}
@@ -699,14 +699,14 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
699699

700700
author = strstr(commit_buffer_cursor, "\nauthor ");
701701
if (!author)
702-
die("could not find author in commit %s",
702+
die(_("could not find author in commit %s"),
703703
oid_to_hex(&commit->object.oid));
704704
author++;
705705
commit_buffer_cursor = author_end = strchrnul(author, '\n');
706706

707707
committer = strstr(commit_buffer_cursor, "\ncommitter ");
708708
if (!committer)
709-
die("could not find committer in commit %s",
709+
die(_("could not find committer in commit %s"),
710710
oid_to_hex(&commit->object.oid));
711711
committer++;
712712
commit_buffer_cursor = committer_end = strchrnul(committer, '\n');
@@ -781,8 +781,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
781781
case REENCODE_NO:
782782
break;
783783
case REENCODE_ABORT:
784-
die("Encountered commit-specific encoding %.*s in commit "
785-
"%s; use --reencode=[yes|no] to handle it",
784+
die(_("encountered commit-specific encoding %.*s in commit "
785+
"%s; use --reencode=[yes|no] to handle it"),
786786
(int)encoding_len, encoding,
787787
oid_to_hex(&commit->object.oid));
788788
}
@@ -798,11 +798,11 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
798798
if (signatures.nr) {
799799
switch (signed_commit_mode) {
800800
case SIGN_ABORT:
801-
die("encountered signed commit %s; use "
802-
"--signed-commits=<mode> to handle it",
801+
die(_("encountered signed commit %s; use "
802+
"--signed-commits=<mode> to handle it"),
803803
oid_to_hex(&commit->object.oid));
804804
case SIGN_WARN_VERBATIM:
805-
warning("exporting %"PRIuMAX" signature(s) for commit %s",
805+
warning(_("exporting %"PRIuMAX" signature(s) for commit %s"),
806806
(uintmax_t)signatures.nr, oid_to_hex(&commit->object.oid));
807807
/* fallthru */
808808
case SIGN_VERBATIM:
@@ -812,7 +812,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
812812
}
813813
break;
814814
case SIGN_WARN_STRIP:
815-
warning("stripping signature(s) from commit %s",
815+
warning(_("stripping signature(s) from commit %s"),
816816
oid_to_hex(&commit->object.oid));
817817
/* fallthru */
818818
case SIGN_STRIP:
@@ -890,15 +890,16 @@ static void handle_tag(const char *name, struct tag *tag)
890890
tagged = ((struct tag *)tagged)->tagged;
891891
}
892892
if (tagged->type == OBJ_TREE) {
893-
warning("Omitting tag %s,\nsince tags of trees (or tags of tags of trees, etc.) are not supported.",
893+
warning(_("omitting tag %s,\nsince tags of trees (or tags "
894+
"of tags of trees, etc.) are not supported."),
894895
oid_to_hex(&tag->object.oid));
895896
return;
896897
}
897898

898899
buf = odb_read_object(the_repository->objects, &tag->object.oid,
899900
&type, &size);
900901
if (!buf)
901-
die("could not read tag %s", oid_to_hex(&tag->object.oid));
902+
die(_("could not read tag %s"), oid_to_hex(&tag->object.oid));
902903
message = memmem(buf, size, "\n\n", 2);
903904
if (message) {
904905
message += 2;
@@ -936,17 +937,17 @@ static void handle_tag(const char *name, struct tag *tag)
936937
if (signature)
937938
switch (signed_tag_mode) {
938939
case SIGN_ABORT:
939-
die("encountered signed tag %s; use "
940-
"--signed-tags=<mode> to handle it",
940+
die(_("encountered signed tag %s; use "
941+
"--signed-tags=<mode> to handle it"),
941942
oid_to_hex(&tag->object.oid));
942943
case SIGN_WARN_VERBATIM:
943-
warning("exporting signed tag %s",
944+
warning(_("exporting signed tag %s"),
944945
oid_to_hex(&tag->object.oid));
945946
/* fallthru */
946947
case SIGN_VERBATIM:
947948
break;
948949
case SIGN_WARN_STRIP:
949-
warning("stripping signature from tag %s",
950+
warning(_("stripping signature from tag %s"),
950951
oid_to_hex(&tag->object.oid));
951952
/* fallthru */
952953
case SIGN_STRIP:
@@ -961,16 +962,16 @@ static void handle_tag(const char *name, struct tag *tag)
961962
if (!tagged_mark) {
962963
switch (tag_of_filtered_mode) {
963964
case TAG_FILTERING_ABORT:
964-
die("tag %s tags unexported object; use "
965-
"--tag-of-filtered-object=<mode> to handle it",
965+
die(_("tag %s tags unexported object; use "
966+
"--tag-of-filtered-object=<mode> to handle it"),
966967
oid_to_hex(&tag->object.oid));
967968
case DROP:
968969
/* Ignore this tag altogether */
969970
free(buf);
970971
return;
971972
case REWRITE:
972973
if (tagged->type == OBJ_TAG && !mark_tags) {
973-
die(_("Error: Cannot export nested tags unless --mark-tags is specified."));
974+
die(_("cannot export nested tags unless --mark-tags is specified."));
974975
} else if (tagged->type == OBJ_COMMIT) {
975976
p = rewrite_commit((struct commit *)tagged);
976977
if (!p) {
@@ -1026,7 +1027,7 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_n
10261027
tag = (struct tag *)tag->tagged;
10271028
}
10281029
if (!tag)
1029-
die("Tag %s points nowhere?", e->name);
1030+
die(_("tag %s points nowhere?"), e->name);
10301031
return (struct commit *)tag;
10311032
}
10321033
default:
@@ -1064,7 +1065,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
10641065

10651066
commit = get_commit(e, full_name);
10661067
if (!commit) {
1067-
warning("%s: Unexpected object of type %s, skipping.",
1068+
warning(_("%s: unexpected object of type %s, skipping."),
10681069
e->name,
10691070
type_name(e->item->type));
10701071
free(full_name);
@@ -1079,7 +1080,7 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
10791080
free(full_name);
10801081
continue;
10811082
default: /* OBJ_TAG (nested tags) is already handled */
1082-
warning("Tag points to object of unexpected type %s, skipping.",
1083+
warning(_("tag points to object of unexpected type %s, skipping."),
10831084
type_name(commit->object.type));
10841085
free(full_name);
10851086
continue;
@@ -1175,7 +1176,7 @@ static void export_marks(char *file)
11751176

11761177
f = fopen_for_writing(file);
11771178
if (!f)
1178-
die_errno("Unable to open marks file %s for writing.", file);
1179+
die_errno(_("unable to open marks file %s for writing."), file);
11791180

11801181
for (i = 0; i < idnums.size; i++) {
11811182
if (deco->base && deco->base->type == 1) {
@@ -1192,7 +1193,7 @@ static void export_marks(char *file)
11921193
e |= ferror(f);
11931194
e |= fclose(f);
11941195
if (e)
1195-
error("Unable to write marks file %s.", file);
1196+
error(_("unable to write marks file %s."), file);
11961197
}
11971198

11981199
static void import_marks(char *input_file, int check_exists)
@@ -1215,33 +1216,33 @@ static void import_marks(char *input_file, int check_exists)
12151216

12161217
line_end = strchr(line, '\n');
12171218
if (line[0] != ':' || !line_end)
1218-
die("corrupt mark line: %s", line);
1219+
die(_("corrupt mark line: %s"), line);
12191220
*line_end = '\0';
12201221

12211222
mark = strtoumax(line + 1, &mark_end, 10);
12221223
if (!mark || mark_end == line + 1
12231224
|| *mark_end != ' ' || get_oid_hex(mark_end + 1, &oid))
1224-
die("corrupt mark line: %s", line);
1225+
die(_("corrupt mark line: %s"), line);
12251226

12261227
if (last_idnum < mark)
12271228
last_idnum = mark;
12281229

12291230
type = odb_read_object_info(the_repository->objects, &oid, NULL);
12301231
if (type < 0)
1231-
die("object not found: %s", oid_to_hex(&oid));
1232+
die(_("object not found: %s"), oid_to_hex(&oid));
12321233

12331234
if (type != OBJ_COMMIT)
12341235
/* only commits */
12351236
continue;
12361237

12371238
commit = lookup_commit(the_repository, &oid);
12381239
if (!commit)
1239-
die("not a commit? can't happen: %s", oid_to_hex(&oid));
1240+
die(_("not a commit? can't happen: %s"), oid_to_hex(&oid));
12401241

12411242
object = &commit->object;
12421243

12431244
if (object->flags & SHOWN)
1244-
error("Object %s already has a mark", oid_to_hex(&oid));
1245+
error(_("object %s already has a mark"), oid_to_hex(&oid));
12451246

12461247
mark_object(object, mark);
12471248

@@ -1395,7 +1396,7 @@ int cmd_fast_export(int argc,
13951396
get_tags_and_duplicates(&revs.cmdline);
13961397

13971398
if (prepare_revision_walk(&revs))
1398-
die("revision walk setup failed");
1399+
die(_("revision walk setup failed"));
13991400

14001401
revs.reverse = 1;
14011402
revs.diffopt.format_callback = show_filemodify;

0 commit comments

Comments
 (0)