Skip to content

Commit 8a1e7ea

Browse files
pcloudsgitster
authored andcommitted
i18n: bundle: mark strings for translation
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c2b97ec commit 8a1e7ea

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

bundle.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
3333
if (strbuf_getwholeline_fd(&buf, fd, '\n') ||
3434
strcmp(buf.buf, bundle_signature)) {
3535
if (report_path)
36-
error("'%s' does not look like a v2 bundle file",
36+
error(_("'%s' does not look like a v2 bundle file"),
3737
report_path);
3838
status = -1;
3939
goto abort;
@@ -60,7 +60,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
6060
(40 <= buf.len && !isspace(buf.buf[40])) ||
6161
(!is_prereq && buf.len <= 40)) {
6262
if (report_path)
63-
error("unrecognized header: %s%s (%d)",
63+
error(_("unrecognized header: %s%s (%d)"),
6464
(is_prereq ? "-" : ""), buf.buf, (int)buf.len);
6565
status = -1;
6666
break;
@@ -86,7 +86,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
8686
int fd = open(path, O_RDONLY);
8787

8888
if (fd < 0)
89-
return error("could not open '%s'", path);
89+
return error(_("could not open '%s'"), path);
9090
return parse_bundle_header(fd, header, path);
9191
}
9292

@@ -137,7 +137,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
137137
struct object_array refs;
138138
struct commit *commit;
139139
int i, ret = 0, req_nr;
140-
const char *message = "Repository lacks these prerequisite commits:";
140+
const char *message = _("Repository lacks these prerequisite commits:");
141141

142142
init_revisions(&revs, NULL);
143143
for (i = 0; i < p->nr; i++) {
@@ -161,7 +161,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
161161
revs.leak_pending = 1;
162162

163163
if (prepare_revision_walk(&revs))
164-
die("revision walk setup failed");
164+
die(_("revision walk setup failed"));
165165

166166
i = req_nr;
167167
while (i && (commit = get_revision(&revs)))
@@ -183,12 +183,16 @@ int verify_bundle(struct bundle_header *header, int verbose)
183183
struct ref_list *r;
184184

185185
r = &header->references;
186-
printf("The bundle contains %d ref%s\n",
187-
r->nr, (1 < r->nr) ? "s" : "");
186+
printf_ln(Q_("The bundle contains %d ref",
187+
"The bundle contains %d refs",
188+
r->nr),
189+
r->nr);
188190
list_refs(r, 0, NULL);
189191
r = &header->prerequisites;
190-
printf("The bundle requires these %d ref%s\n",
191-
r->nr, (1 < r->nr) ? "s" : "");
192+
printf_ln(Q_("The bundle requires this ref",
193+
"The bundle requires these %d refs",
194+
r->nr),
195+
r->nr);
192196
list_refs(r, 0, NULL);
193197
}
194198
return ret;
@@ -283,13 +287,13 @@ int create_bundle(struct bundle_header *header, const char *path,
283287
strbuf_release(&buf);
284288
fclose(rls_fout);
285289
if (finish_command(&rls))
286-
return error("rev-list died");
290+
return error(_("rev-list died"));
287291

288292
/* write references */
289293
argc = setup_revisions(argc, argv, &revs, NULL);
290294

291295
if (argc > 1)
292-
return error("unrecognized argument: %s'", argv[1]);
296+
return error(_("unrecognized argument: %s'"), argv[1]);
293297

294298
object_array_remove_duplicates(&revs.pending);
295299

@@ -324,7 +328,7 @@ int create_bundle(struct bundle_header *header, const char *path,
324328
* constraints.
325329
*/
326330
if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {
327-
warning("ref '%s' is excluded by the rev-list options",
331+
warning(_("ref '%s' is excluded by the rev-list options"),
328332
e->name);
329333
free(ref);
330334
continue;
@@ -369,7 +373,7 @@ int create_bundle(struct bundle_header *header, const char *path,
369373
free(ref);
370374
}
371375
if (!ref_count)
372-
die ("Refusing to create empty bundle.");
376+
die(_("Refusing to create empty bundle."));
373377

374378
/* end header */
375379
write_or_die(bundle_fd, "\n", 1);
@@ -387,7 +391,7 @@ int create_bundle(struct bundle_header *header, const char *path,
387391
rls.out = bundle_fd;
388392
rls.git_cmd = 1;
389393
if (start_command(&rls))
390-
return error("Could not spawn pack-objects");
394+
return error(_("Could not spawn pack-objects"));
391395

392396
/*
393397
* start_command closed bundle_fd if it was > 1
@@ -405,10 +409,10 @@ int create_bundle(struct bundle_header *header, const char *path,
405409
}
406410
close(rls.in);
407411
if (finish_command(&rls))
408-
return error ("pack-objects died");
412+
return error(_("pack-objects died"));
409413
if (!bundle_to_stdout) {
410414
if (commit_lock_file(&lock))
411-
die_errno("cannot create '%s'", path);
415+
die_errno(_("cannot create '%s'"), path);
412416
}
413417
return 0;
414418
}
@@ -430,6 +434,6 @@ int unbundle(struct bundle_header *header, int bundle_fd, int flags)
430434
ip.no_stdout = 1;
431435
ip.git_cmd = 1;
432436
if (run_command(&ip))
433-
return error("index-pack died");
437+
return error(_("index-pack died"));
434438
return 0;
435439
}

0 commit comments

Comments
 (0)