i18n: apply: 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
3638eb431bad28aa2bce0ad80ccb6458c97840d3
1 file changed
+91
-83
builtin/apply.c
+91
-83
@@ -103,7 +103,7 @@ static void parse_whitespace_option(const char *option)
103
ws_error_action = correct_ws_error;
104
return;
105
}
106
- die("unrecognized whitespace option '%s'", option);
106
+ die(_("unrecognized whitespace option '%s'"), option);
107
}
108
109
static void parse_ignorewhitespace_option(const char *option)
@@ -118,7 +118,7 @@ static void parse_ignorewhitespace_option(const char *option)
118
ws_ignore_action = ignore_ws_change;
119
return;
120
}
121
- die("unrecognized whitespace ignore option '%s'", option);
121
+ die(_("unrecognized whitespace ignore option '%s'"), option);
122
}
123
124
static void set_default_whitespace_mode(const char *whitespace_option)
@@ -770,7 +770,7 @@ static int has_epoch_timestamp(const char *nameline)
770
if (!stamp) {
771
stamp = xmalloc(sizeof(*stamp));
772
if (regcomp(stamp, stamp_regexp, REG_EXTENDED)) {
773
- warning("Cannot prepare timestamp regexp %s",
773
+ warning(_("Cannot prepare timestamp regexp %s"),
774
stamp_regexp);
775
return 0;
776
}
@@ -779,7 +779,7 @@ static int has_epoch_timestamp(const char *nameline)
779
status = regexec(stamp, timestamp, ARRAY_SIZE(m), m, 0);
780
if (status) {
781
if (status != REG_NOMATCH)
782
- warning("regexec returned %d for input: %s",
782
+ warning(_("regexec returned %d for input: %s"),
783
status, timestamp);
784
return 0;
785
}
@@ -857,7 +857,7 @@ static void parse_traditional_patch(const char *first, const char *second, struc
857
}
858
}
859
if (!name)
860
- die("unable to find filename in patch at line %d", linenr);
860
+ die(_("unable to find filename in patch at line %d"), linenr);
861
}
862
863
static int gitdiff_hdrend(const char *line, struct patch *patch)
@@ -886,17 +886,17 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
886
name = orig_name;
887
len = strlen(name);
888
if (isnull)
889
- die("git apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
889
+ die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr);
890
another = find_name(line, NULL, p_value, TERM_TAB);
891
if (!another || memcmp(another, name, len + 1))
892
- die("git apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
892
+ die(_("git apply: bad git-diff - inconsistent %s filename on line %d"), oldnew, linenr);
893
free(another);
894
return orig_name;
895
}
896
else {
897
/* expect "/dev/null" */
898
if (memcmp("/dev/null", line, 9) || line[9] != '\n')
899
- die("git apply: bad git-diff - expected /dev/null on line %d", linenr);
899
+ die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr);
900
return NULL;
901
}
902
}
@@ -1327,7 +1327,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
1327
break;
1328
}
1329
if (ret) {
1330
- warning("recount: unexpected line: %.*s",
1330
+ warning(_("recount: unexpected line: %.*s"),
1331
(int)linelen(line, size), line);
1332
return;
1333
}
@@ -1384,7 +1384,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
1384
struct fragment dummy;
1385
if (parse_fragment_header(line, len, &dummy) < 0)
1386
continue;
1387
- die("patch fragment without header at line %d: %.*s",
1387
+ die(_("patch fragment without header at line %d: %.*s"),
1388
linenr, (int)len-1, line);
1389
}
1390
@@ -1401,8 +1401,12 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
1401
continue;
1402
if (!patch->old_name && !patch->new_name) {
1403
if (!patch->def_name)
1404
- die("git diff header lacks filename information when removing "
1405
- "%d leading pathname components (line %d)" , p_value, linenr);
1404
+ die(Q_("git diff header lacks filename information when removing "
1405
+ "%d leading pathname component (line %d)",
1406
+ "git diff header lacks filename information when removing "
1407
+ "%d leading pathname components (line %d)",
1408
+ p_value),
1409
+ p_value, linenr);
1410
patch->old_name = patch->new_name = patch->def_name;
1411
}
1412
if (!patch->is_delete && !patch->new_name)
@@ -1556,9 +1560,9 @@ static int parse_fragment(char *line, unsigned long size,
1560
patch->lines_deleted += deleted;
1561
1562
if (0 < patch->is_new && oldlines)
1559
- return error("new file depends on old contents");
1563
+ return error(_("new file depends on old contents"));
1564
if (0 < patch->is_delete && newlines)
1561
- return error("deleted file still has contents");
1565
+ return error(_("deleted file still has contents"));
1566
return offset;
1567
}
1568
@@ -1576,7 +1580,7 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
1580
fragment->linenr = linenr;
1581
len = parse_fragment(line, size, patch, fragment);
1582
if (len <= 0)
1579
- die("corrupt patch at line %d", linenr);
1583
+ die(_("corrupt patch at line %d"), linenr);
1584
fragment->patch = line;
1585
fragment->size = len;
1586
oldlines += fragment->oldlines;
@@ -1612,12 +1616,14 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
1616
patch->is_delete = 0;
1617
1618
if (0 < patch->is_new && oldlines)
1615
- die("new file %s depends on old contents", patch->new_name);
1619
+ die(_("new file %s depends on old contents"), patch->new_name);
1620
if (0 < patch->is_delete && newlines)
1617
- die("deleted file %s still has contents", patch->old_name);
1621
+ die(_("deleted file %s still has contents"), patch->old_name);
1622
if (!patch->is_delete && !newlines && context)
1619
- fprintf(stderr, "** warning: file %s becomes empty but "
1620
- "is not deleted\n", patch->new_name);
1623
+ fprintf_ln(stderr,
1624
+ _("** warning: "
1625
+ "file %s becomes empty but is not deleted"),
1626
+ patch->new_name);
1627
1628
return offset;
1629
}
@@ -1755,7 +1761,7 @@ static struct fragment *parse_binary_hunk(char **buf_p,
1761
corrupt:
1762
free(data);
1763
*status_p = -1;
1758
- error("corrupt binary patch at line %d: %.*s",
1764
+ error(_("corrupt binary patch at line %d: %.*s"),
1765
linenr-1, llen-1, buffer);
1766
return NULL;
1767
}
@@ -1784,7 +1790,7 @@ static int parse_binary(char *buffer, unsigned long size, struct patch *patch)
1790
forward = parse_binary_hunk(&buffer, &size, &status, &used);
1791
if (!forward && !status)
1792
/* there has to be one hunk (forward hunk) */
1787
- return error("unrecognized binary patch at line %d", linenr-1);
1793
+ return error(_("unrecognized binary patch at line %d"), linenr-1);
1794
if (status)
1795
/* otherwise we already gave an error message */
1796
return status;
@@ -1863,7 +1869,7 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
1869
*/
1870
if ((apply || check) &&
1871
(!patch->is_binary && !metadata_changes(patch)))
1866
- die("patch with only garbage at line %d", linenr);
1872
+ die(_("patch with only garbage at line %d"), linenr);
1873
}
1874
1875
return offset + hdrsize + patchsize;
@@ -1953,11 +1959,11 @@ static int read_old_data(struct stat *st, const char *path, struct strbuf *buf)
1959
switch (st->st_mode & S_IFMT) {
1960
case S_IFLNK:
1961
if (strbuf_readlink(buf, path, st->st_size) < 0)
1956
- return error("unable to read symlink %s", path);
1962
+ return error(_("unable to read symlink %s"), path);
1963
return 0;
1964
case S_IFREG:
1965
if (strbuf_read_file(buf, path, st->st_size) != st->st_size)
1960
- return error("unable to open or read %s", path);
1966
+ return error(_("unable to open or read %s"), path);
1967
convert_to_git(path, buf->buf, buf->len, buf, 0);
1968
return 0;
1969
default:
@@ -2028,7 +2034,7 @@ static void update_pre_post_images(struct image *preimage,
2034
ctx++;
2035
}
2036
if (preimage->nr <= ctx)
2031
- die("oops");
2037
+ die(_("oops"));
2038
2039
/* and copy it in, while fixing the line length */
2040
len = preimage->line[ctx].len;
@@ -2540,7 +2546,7 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
2546
break;
2547
default:
2548
if (apply_verbosely)
2543
- error("invalid start of line: '%c'", first);
2549
+ error(_("invalid start of line: '%c'"), first);
2550
return -1;
2551
}
2552
if (added_blank_line) {
@@ -2657,9 +2663,11 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
2663
int offset = applied_pos - pos;
2664
if (apply_in_reverse)
2665
offset = 0 - offset;
2660
- fprintf(stderr,
2661
- "Hunk #%d succeeded at %d (offset %d lines).\n",
2662
- nth_fragment, applied_pos + 1, offset);
2666
+ fprintf_ln(stderr,
2667
+ Q_("Hunk #%d succeeded at %d (offset %d line).",
2668
+ "Hunk #%d succeeded at %d (offset %d lines).",
2669
+ offset),
2670
+ nth_fragment, applied_pos + 1, offset);
2671
}
2672
2673
/*
@@ -2668,13 +2676,13 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
2676
*/
2677
if ((leading != frag->leading) ||
2678
(trailing != frag->trailing))
2671
- fprintf(stderr, "Context reduced to (%ld/%ld)"
2672
- " to apply fragment at %d\n",
2673
- leading, trailing, applied_pos+1);
2679
+ fprintf_ln(stderr, _("Context reduced to (%ld/%ld)"
2680
+ " to apply fragment at %d"),
2681
+ leading, trailing, applied_pos+1);
2682
update_image(img, applied_pos, &preimage, &postimage);
2683
} else {
2684
if (apply_verbosely)
2677
- error("while searching for:\n%.*s",
2685
+ error(_("while searching for:\n%.*s"),
2686
(int)(old - oldlines), oldlines);
2687
}
2688
@@ -2693,7 +2701,7 @@ static int apply_binary_fragment(struct image *img, struct patch *patch)
2701
void *dst;
2702
2703
if (!fragment)
2696
- return error("missing binary patch data for '%s'",
2704
+ return error(_("missing binary patch data for '%s'"),
2705
patch->new_name ?
2706
patch->new_name :
2707
patch->old_name);
@@ -2790,13 +2798,13 @@ static int apply_binary(struct image *img, struct patch *patch)
2798
* in the patch->fragments->{patch,size}.
2799
*/
2800
if (apply_binary_fragment(img, patch))
2793
- return error("binary patch does not apply to '%s'",
2801
+ return error(_("binary patch does not apply to '%s'"),
2802
name);
2803
2804
/* verify that the result matches */
2805
hash_sha1_file(img->buf, img->len, blob_type, sha1);
2806
if (strcmp(sha1_to_hex(sha1), patch->new_sha1_prefix))
2799
- return error("binary patch to '%s' creates incorrect result (expecting %s, got %s)",
2807
+ return error(_("binary patch to '%s' creates incorrect result (expecting %s, got %s)"),
2808
name, patch->new_sha1_prefix, sha1_to_hex(sha1));
2809
}
2810
@@ -2817,7 +2825,7 @@ static int apply_fragments(struct image *img, struct patch *patch)
2825
while (frag) {
2826
nth++;
2827
if (apply_one_fragment(img, frag, inaccurate_eof, ws_rule, nth)) {
2820
- error("patch failed: %s:%ld", name, frag->oldpos);
2828
+ error(_("patch failed: %s:%ld"), name, frag->oldpos);
2829
if (!apply_with_reject)
2830
return -1;
2831
frag->rejected = 1;
@@ -2932,14 +2940,14 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
2940
if (!(patch->is_copy || patch->is_rename) &&
2941
(tpatch = in_fn_table(patch->old_name)) != NULL && !to_be_deleted(tpatch)) {
2942
if (was_deleted(tpatch)) {
2935
- return error("patch %s has been renamed/deleted",
2943
+ return error(_("patch %s has been renamed/deleted"),
2944
patch->old_name);
2945
}
2946
/* We have a patched copy in memory use that */
2947
strbuf_add(&buf, tpatch->result, tpatch->resultsize);
2948
} else if (cached) {
2949
if (read_file_or_gitlink(ce, &buf))
2942
- return error("read of %s failed", patch->old_name);
2950
+ return error(_("read of %s failed"), patch->old_name);
2951
} else if (patch->old_name) {
2952
if (S_ISGITLINK(patch->old_mode)) {
2953
if (ce) {
@@ -2953,7 +2961,7 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
2961
}
2962
} else {
2963
if (read_old_data(st, patch->old_name, &buf))
2956
- return error("read of %s failed", patch->old_name);
2964
+ return error(_("read of %s failed"), patch->old_name);
2965
}
2966
}
2967
@@ -2968,7 +2976,7 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
2976
free(image.line_allocated);
2977
2978
if (0 < patch->is_delete && patch->resultsize)
2971
- return error("removal patch leaves file contents");
2979
+ return error(_("removal patch leaves file contents"));
2980
2981
return 0;
2982
}
@@ -2989,7 +2997,7 @@ static int check_to_create_blob(const char *new_name, int ok_if_exists)
2997
if (has_symlink_leading_path(new_name, strlen(new_name)))
2998
return 0;
2999
2992
- return error("%s: already exists in working directory", new_name);
3000
+ return error(_("%s: already exists in working directory"), new_name);
3001
}
3002
else if ((errno != ENOENT) && (errno != ENOTDIR))
3003
return error("%s: %s", new_name, strerror(errno));
@@ -3027,12 +3035,12 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
3035
if (!(patch->is_copy || patch->is_rename) &&
3036
(tpatch = in_fn_table(old_name)) != NULL && !to_be_deleted(tpatch)) {
3037
if (was_deleted(tpatch))
3030
- return error("%s: has been deleted/renamed", old_name);
3038
+ return error(_("%s: has been deleted/renamed"), old_name);
3039
st_mode = tpatch->new_mode;
3040
} else if (!cached) {
3041
stat_ret = lstat(old_name, st);
3042
if (stat_ret && errno != ENOENT)
3035
- return error("%s: %s", old_name, strerror(errno));
3043
+ return error(_("%s: %s"), old_name, strerror(errno));
3044
}
3045
3046
if (to_be_deleted(tpatch))
@@ -3043,7 +3051,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
3051
if (pos < 0) {
3052
if (patch->is_new < 0)
3053
goto is_new;
3046
- return error("%s: does not exist in index", old_name);
3054
+ return error(_("%s: does not exist in index"), old_name);
3055
}
3056
*ce = active_cache[pos];
3057
if (stat_ret < 0) {
@@ -3057,13 +3065,13 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
3065
return -1;
3066
}
3067
if (!cached && verify_index_match(*ce, st))
3060
- return error("%s: does not match index", old_name);
3068
+ return error(_("%s: does not match index"), old_name);
3069
if (cached)
3070
st_mode = (*ce)->ce_mode;
3071
} else if (stat_ret < 0) {
3072
if (patch->is_new < 0)
3073
goto is_new;
3066
- return error("%s: %s", old_name, strerror(errno));
3074
+ return error(_("%s: %s"), old_name, strerror(errno));
3075
}
3076
3077
if (!cached && !tpatch)
@@ -3074,9 +3082,9 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
3082
if (!patch->old_mode)
3083
patch->old_mode = st_mode;
3084
if ((st_mode ^ patch->old_mode) & S_IFMT)
3077
- return error("%s: wrong type", old_name);
3085
+ return error(_("%s: wrong type"), old_name);
3086
if (st_mode != patch->old_mode)
3079
- warning("%s has type %o, expected %o",
3087
+ warning(_("%s has type %o, expected %o"),
3088
old_name, st_mode, patch->old_mode);
3089
if (!patch->new_mode && !patch->is_delete)
3090
patch->new_mode = st_mode;
@@ -3126,7 +3134,7 @@ static int check_patch(struct patch *patch)
3134
if (check_index &&
3135
cache_name_pos(new_name, strlen(new_name)) >= 0 &&
3136
!ok_if_exists)
3129
- return error("%s: already exists in index", new_name);
3137
+ return error(_("%s: already exists in index"), new_name);
3138
if (!cached) {
3139
int err = check_to_create_blob(new_name, ok_if_exists);
3140
if (err)
@@ -3145,13 +3153,13 @@ static int check_patch(struct patch *patch)
3153
if (!patch->new_mode)
3154
patch->new_mode = patch->old_mode;
3155
if ((patch->old_mode ^ patch->new_mode) & S_IFMT)
3148
- return error("new mode (%o) of %s does not match old mode (%o)%s%s",
3156
+ return error(_("new mode (%o) of %s does not match old mode (%o)%s%s"),
3157
patch->new_mode, new_name, patch->old_mode,
3158
same ? "" : " of ", same ? "" : old_name);
3159
}
3160
3161
if (apply_data(patch, &st, ce) < 0)
3154
- return error("%s: patch does not apply", name);
3162
+ return error(_("%s: patch does not apply"), name);
3163
patch->rejected = 0;
3164
return 0;
3165
}
@@ -3219,7 +3227,7 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
3227
3228
ce = make_cache_entry(patch->old_mode, sha1_ptr, name, 0, 0);
3229
if (!ce)
3222
- die("make_cache_entry failed for path '%s'", name);
3230
+ die(_("make_cache_entry failed for path '%s'"), name);
3231
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD))
3232
die ("Could not add %s to temporary index", name);
3233
}
@@ -3362,7 +3370,7 @@ static void remove_file(struct patch *patch, int rmdir_empty)
3370
{
3371
if (update_index) {
3372
if (remove_file_from_cache(patch->old_name) < 0)
3365
- die("unable to remove %s from index", patch->old_name);
3373
+ die(_("unable to remove %s from index"), patch->old_name);
3374
}
3375
if (!cached) {
3376
if (!remove_or_warn(patch->old_mode, patch->old_name) && rmdir_empty) {
@@ -3389,19 +3397,19 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
3397
const char *s = buf;
3398
3399
if (get_sha1_hex(s + strlen("Subproject commit "), ce->sha1))
3392
- die("corrupt patch for subproject %s", path);
3400
+ die(_("corrupt patch for subproject %s"), path);
3401
} else {
3402
if (!cached) {
3403
if (lstat(path, &st) < 0)
3396
- die_errno("unable to stat newly created file '%s'",
3404
+ die_errno(_("unable to stat newly created file '%s'"),
3405
path);
3406
fill_stat_cache_info(ce, &st);
3407
}
3408
if (write_sha1_file(buf, size, blob_type, ce->sha1) < 0)
3401
- die("unable to create backing store for newly created file %s", path);
3409
+ die(_("unable to create backing store for newly created file %s"), path);
3410
}
3411
if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD) < 0)
3404
- die("unable to add cache entry for %s", path);
3412
+ die(_("unable to add cache entry for %s"), path);
3413
}
3414
3415
static int try_create_file(const char *path, unsigned int mode, const char *buf, unsigned long size)
@@ -3434,7 +3442,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
3442
strbuf_release(&nbuf);
3443
3444
if (close(fd) < 0)
3437
- die_errno("closing file '%s'", path);
3445
+ die_errno(_("closing file '%s'"), path);
3446
return 0;
3447
}
3448
@@ -3483,7 +3491,7 @@ static void create_one_file(char *path, unsigned mode, const char *buf, unsigned
3491
++nr;
3492
}
3493
}
3486
- die_errno("unable to write file '%s' mode %o", path, mode);
3494
+ die_errno(_("unable to write file '%s' mode %o"), path, mode);
3495
}
3496
3497
static void create_file(struct patch *patch)
@@ -3546,7 +3554,7 @@ static int write_out_one_reject(struct patch *patch)
3554
* contents are marked "rejected" at the patch level.
3555
*/
3556
if (!patch->new_name)
3549
- die("internal error");
3557
+ die(_("internal error"));
3558
3559
/* Say this even without --verbose */
3560
say_patch_name(stderr, "Applying patch ", patch, " with");
@@ -3555,7 +3563,7 @@ static int write_out_one_reject(struct patch *patch)
3563
cnt = strlen(patch->new_name);
3564
if (ARRAY_SIZE(namebuf) <= cnt + 5) {
3565
cnt = ARRAY_SIZE(namebuf) - 5;
3558
- warning("truncating .rej filename to %.*s.rej",
3566
+ warning(_("truncating .rej filename to %.*s.rej"),
3567
cnt - 1, patch->new_name);
3568
}
3569
memcpy(namebuf, patch->new_name, cnt);
@@ -3563,7 +3571,7 @@ static int write_out_one_reject(struct patch *patch)
3571
3572
rej = fopen(namebuf, "w");
3573
if (!rej)
3566
- return error("cannot open %s: %s", namebuf, strerror(errno));
3574
+ return error(_("cannot open %s: %s"), namebuf, strerror(errno));
3575
3576
/* Normal git tools never deal with .rej, so do not pretend
3577
* this is a git patch by saying --git nor give extended
@@ -3576,10 +3584,10 @@ static int write_out_one_reject(struct patch *patch)
3584
frag;
3585
cnt++, frag = frag->next) {
3586
if (!frag->rejected) {
3579
- fprintf(stderr, "Hunk #%d applied cleanly.\n", cnt);
3587
+ fprintf_ln(stderr, _("Hunk #%d applied cleanly."), cnt);
3588
continue;
3589
}
3582
- fprintf(stderr, "Rejected hunk #%d.\n", cnt);
3590
+ fprintf_ln(stderr, _("Rejected hunk #%d."), cnt);
3591
fprintf(rej, "%.*s", frag->size, frag->patch);
3592
if (frag->patch[frag->size-1] != '\n')
3593
fputc('\n', rej);
@@ -3720,7 +3728,7 @@ static int apply_patch(int fd, const char *filename, int options)
3728
}
3729
3730
if (!list && !skipped_patch)
3723
- die("unrecognized input");
3731
+ die(_("unrecognized input"));
3732
3733
if (whitespace_error && (ws_error_action == die_on_ws_error))
3734
apply = 0;
@@ -3731,7 +3739,7 @@ static int apply_patch(int fd, const char *filename, int options)
3739
3740
if (check_index) {
3741
if (read_cache() < 0)
3734
- die("unable to read index file");
3742
+ die(_("unable to read index file"));
3743
}
3744
3745
if ((check || apply) &&
@@ -3924,10 +3932,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
3932
if (!force_apply && (diffstat || numstat || summary || check || fake_ancestor))
3933
apply = 0;
3934
if (check_index && is_not_gitdir)
3927
- die("--index outside a repository");
3935
+ die(_("--index outside a repository"));
3936
if (cached) {
3937
if (is_not_gitdir)
3930
- die("--cached outside a repository");
3938
+ die(_("--cached outside a repository"));
3939
check_index = 1;
3940
}
3941
for (i = 0; i < argc; i++) {
@@ -3943,7 +3951,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
3951
3952
fd = open(arg, O_RDONLY);
3953
if (fd < 0)
3946
- die_errno("can't open patch '%s'", arg);
3954
+ die_errno(_("can't open patch '%s'"), arg);
3955
read_stdin = 0;
3956
set_default_whitespace_mode(whitespace_option);
3957
errs |= apply_patch(fd, arg, options);
@@ -3957,32 +3965,32 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
3965
squelch_whitespace_errors < whitespace_error) {
3966
int squelched =
3967
whitespace_error - squelch_whitespace_errors;
3960
- warning("squelched %d "
3961
- "whitespace error%s",
3962
- squelched,
3963
- squelched == 1 ? "" : "s");
3968
+ warning(Q_("squelched %d whitespace error",
3969
+ "squelched %d whitespace errors",
3970
+ squelched),
3971
+ squelched);
3972
}
3973
if (ws_error_action == die_on_ws_error)
3966
- die("%d line%s add%s whitespace errors.",
3967
- whitespace_error,
3968
- whitespace_error == 1 ? "" : "s",
3969
- whitespace_error == 1 ? "s" : "");
3974
+ die(Q_("%d line adds whitespace errors.",
3975
+ "%d lines add whitespace errors.",
3976
+ whitespace_error),
3977
+ whitespace_error);
3978
if (applied_after_fixing_ws && apply)
3979
warning("%d line%s applied after"
3980
" fixing whitespace errors.",
3981
applied_after_fixing_ws,
3982
applied_after_fixing_ws == 1 ? "" : "s");
3983
else if (whitespace_error)
3976
- warning("%d line%s add%s whitespace errors.",
3977
- whitespace_error,
3978
- whitespace_error == 1 ? "" : "s",
3979
- whitespace_error == 1 ? "s" : "");
3984
+ warning(Q_("%d line adds whitespace errors.",
3985
+ "%d lines add whitespace errors.",
3986
+ whitespace_error),
3987
+ whitespace_error);
3988
}
3989
3990
if (update_index) {
3991
if (write_cache(newfd, active_cache, active_nr) ||
3992
commit_locked_index(&lock_file))
3985
- die("Unable to write new index file");
3993
+ die(_("Unable to write new index file"));
3994
}
3995
3996
return !!errs;