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>
Nguyễn Thái Ngọc Duy committed
Apr 23, 2012 at 19:30 UTC
8a1e7eac689c53f15d986e8525484ca9bd640553
1 file changed
+21
-17
bundle.c
+21
-17
@@ -33,7 +33,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
33
if (strbuf_getwholeline_fd(&buf, fd, '\n') ||
34
strcmp(buf.buf, bundle_signature)) {
35
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"),
37
report_path);
38
status = -1;
39
goto abort;
@@ -60,7 +60,7 @@ static int parse_bundle_header(int fd, struct bundle_header *header,
60
(40 <= buf.len && !isspace(buf.buf[40])) ||
61
(!is_prereq && buf.len <= 40)) {
62
if (report_path)
63
- error("unrecognized header: %s%s (%d)",
63
+ error(_("unrecognized header: %s%s (%d)"),
64
(is_prereq ? "-" : ""), buf.buf, (int)buf.len);
65
status = -1;
66
break;
@@ -86,7 +86,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
86
int fd = open(path, O_RDONLY);
87
88
if (fd < 0)
89
- return error("could not open '%s'", path);
89
+ return error(_("could not open '%s'"), path);
90
return parse_bundle_header(fd, header, path);
91
}
92
@@ -137,7 +137,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
137
struct object_array refs;
138
struct commit *commit;
139
int i, ret = 0, req_nr;
140
- const char *message = "Repository lacks these prerequisite commits:";
140
+ const char *message = _("Repository lacks these prerequisite commits:");
141
142
init_revisions(&revs, NULL);
143
for (i = 0; i < p->nr; i++) {
@@ -161,7 +161,7 @@ int verify_bundle(struct bundle_header *header, int verbose)
161
revs.leak_pending = 1;
162
163
if (prepare_revision_walk(&revs))
164
- die("revision walk setup failed");
164
+ die(_("revision walk setup failed"));
165
166
i = req_nr;
167
while (i && (commit = get_revision(&revs)))
@@ -183,12 +183,16 @@ int verify_bundle(struct bundle_header *header, int verbose)
183
struct ref_list *r;
184
185
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);
190
list_refs(r, 0, NULL);
191
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);
196
list_refs(r, 0, NULL);
197
}
198
return ret;
@@ -283,13 +287,13 @@ int create_bundle(struct bundle_header *header, const char *path,
287
strbuf_release(&buf);
288
fclose(rls_fout);
289
if (finish_command(&rls))
286
- return error("rev-list died");
290
+ return error(_("rev-list died"));
291
292
/* write references */
293
argc = setup_revisions(argc, argv, &revs, NULL);
294
295
if (argc > 1)
292
- return error("unrecognized argument: %s'", argv[1]);
296
+ return error(_("unrecognized argument: %s'"), argv[1]);
297
298
object_array_remove_duplicates(&revs.pending);
299
@@ -324,7 +328,7 @@ int create_bundle(struct bundle_header *header, const char *path,
328
* constraints.
329
*/
330
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"),
332
e->name);
333
free(ref);
334
continue;
@@ -369,7 +373,7 @@ int create_bundle(struct bundle_header *header, const char *path,
373
free(ref);
374
}
375
if (!ref_count)
372
- die ("Refusing to create empty bundle.");
376
+ die(_("Refusing to create empty bundle."));
377
378
/* end header */
379
write_or_die(bundle_fd, "\n", 1);
@@ -387,7 +391,7 @@ int create_bundle(struct bundle_header *header, const char *path,
391
rls.out = bundle_fd;
392
rls.git_cmd = 1;
393
if (start_command(&rls))
390
- return error("Could not spawn pack-objects");
394
+ return error(_("Could not spawn pack-objects"));
395
396
/*
397
* start_command closed bundle_fd if it was > 1
@@ -405,10 +409,10 @@ int create_bundle(struct bundle_header *header, const char *path,
409
}
410
close(rls.in);
411
if (finish_command(&rls))
408
- return error ("pack-objects died");
412
+ return error(_("pack-objects died"));
413
if (!bundle_to_stdout) {
414
if (commit_lock_file(&lock))
411
- die_errno("cannot create '%s'", path);
415
+ die_errno(_("cannot create '%s'"), path);
416
}
417
return 0;
418
}
@@ -430,6 +434,6 @@ int unbundle(struct bundle_header *header, int bundle_fd, int flags)
434
ip.no_stdout = 1;
435
ip.git_cmd = 1;
436
if (run_command(&ip))
433
- return error("index-pack died");
437
+ return error(_("index-pack died"));
438
return 0;
439
}