Skip to content

Commit d26a328

Browse files
pcloudsgitster
authored andcommitted
convert.c: mark more strings for translation
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aad6fdd commit d26a328

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

convert.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static enum eol output_eol(enum crlf_action crlf_action)
190190
/* fall through */
191191
return text_eol_is_crlf() ? EOL_CRLF : EOL_LF;
192192
}
193-
warning("illegal crlf_action %d", (int)crlf_action);
193+
warning(_("illegal crlf_action %d"), (int)crlf_action);
194194
return core_eol;
195195
}
196196

@@ -207,7 +207,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_
207207
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
208208
warning(_("CRLF will be replaced by LF in %s.\n"
209209
"The file will have its original line"
210-
" endings in your working directory."), path);
210+
" endings in your working directory"), path);
211211
} else if (old_stats->lonelf && !new_stats->lonelf ) {
212212
/*
213213
* CRLFs would be added by checkout
@@ -217,7 +217,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_
217217
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
218218
warning(_("LF will be replaced by CRLF in %s.\n"
219219
"The file will have its original line"
220-
" endings in your working directory."), path);
220+
" endings in your working directory"), path);
221221
}
222222
}
223223

@@ -492,7 +492,7 @@ static int encode_to_worktree(const char *path, const char *src, size_t src_len,
492492
dst = reencode_string_len(src, src_len, enc, default_encoding,
493493
&dst_len);
494494
if (!dst) {
495-
error("failed to encode '%s' from %s to %s",
495+
error(_("failed to encode '%s' from %s to %s"),
496496
path, default_encoding, enc);
497497
return 0;
498498
}
@@ -670,7 +670,8 @@ static int filter_buffer_or_fd(int in, int out, void *data)
670670

671671
if (start_command(&child_process)) {
672672
strbuf_release(&cmd);
673-
return error("cannot fork to run external filter '%s'", params->cmd);
673+
return error(_("cannot fork to run external filter '%s'"),
674+
params->cmd);
674675
}
675676

676677
sigchain_push(SIGPIPE, SIG_IGN);
@@ -689,13 +690,14 @@ static int filter_buffer_or_fd(int in, int out, void *data)
689690
if (close(child_process.in))
690691
write_err = 1;
691692
if (write_err)
692-
error("cannot feed the input to external filter '%s'", params->cmd);
693+
error(_("cannot feed the input to external filter '%s'"),
694+
params->cmd);
693695

694696
sigchain_pop(SIGPIPE);
695697

696698
status = finish_command(&child_process);
697699
if (status)
698-
error("external filter '%s' failed %d", params->cmd, status);
700+
error(_("external filter '%s' failed %d"), params->cmd, status);
699701

700702
strbuf_release(&cmd);
701703
return (write_err || status);
@@ -730,13 +732,13 @@ static int apply_single_file_filter(const char *path, const char *src, size_t le
730732
return 0; /* error was already reported */
731733

732734
if (strbuf_read(&nbuf, async.out, len) < 0) {
733-
err = error("read from external filter '%s' failed", cmd);
735+
err = error(_("read from external filter '%s' failed"), cmd);
734736
}
735737
if (close(async.out)) {
736-
err = error("read from external filter '%s' failed", cmd);
738+
err = error(_("read from external filter '%s' failed"), cmd);
737739
}
738740
if (finish_async(&async)) {
739-
err = error("external filter '%s' failed", cmd);
741+
err = error(_("external filter '%s' failed"), cmd);
740742
}
741743

742744
if (!err) {
@@ -790,7 +792,7 @@ static void handle_filter_error(const struct strbuf *filter_status,
790792
* Something went wrong with the protocol filter.
791793
* Force shutdown and restart if another blob requires filtering.
792794
*/
793-
error("external filter '%s' failed", entry->subprocess.cmd);
795+
error(_("external filter '%s' failed"), entry->subprocess.cmd);
794796
subprocess_stop(&subprocess_map, &entry->subprocess);
795797
free(entry);
796798
}
@@ -838,7 +840,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
838840
else if (wanted_capability & CAP_SMUDGE)
839841
filter_type = "smudge";
840842
else
841-
die("unexpected filter type");
843+
die(_("unexpected filter type"));
842844

843845
sigchain_push(SIGPIPE, SIG_IGN);
844846

@@ -849,7 +851,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
849851

850852
err = strlen(path) > LARGE_PACKET_DATA_MAX - strlen("pathname=\n");
851853
if (err) {
852-
error("path name too long for external filter");
854+
error(_("path name too long for external filter"));
853855
goto done;
854856
}
855857

@@ -923,8 +925,8 @@ int async_query_available_blobs(const char *cmd, struct string_list *available_p
923925
assert(subprocess_map_initialized);
924926
entry = (struct cmd2process *)subprocess_find_entry(&subprocess_map, cmd);
925927
if (!entry) {
926-
error("external filter '%s' is not available anymore although "
927-
"not all paths have been filtered", cmd);
928+
error(_("external filter '%s' is not available anymore although "
929+
"not all paths have been filtered"), cmd);
928930
return 0;
929931
}
930932
process = &entry->subprocess.process;
@@ -1395,7 +1397,7 @@ int convert_to_git(const struct index_state *istate,
13951397

13961398
ret |= apply_filter(path, src, len, -1, dst, ca.drv, CAP_CLEAN, NULL);
13971399
if (!ret && ca.drv && ca.drv->required)
1398-
die("%s: clean filter '%s' failed", path, ca.drv->name);
1400+
die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
13991401

14001402
if (ret && dst) {
14011403
src = dst->buf;
@@ -1429,7 +1431,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,
14291431
assert(ca.drv->clean || ca.drv->process);
14301432

14311433
if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL))
1432-
die("%s: clean filter '%s' failed", path, ca.drv->name);
1434+
die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
14331435

14341436
encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags);
14351437
crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);
@@ -1472,7 +1474,7 @@ static int convert_to_working_tree_internal(const char *path, const char *src,
14721474
ret_filter = apply_filter(
14731475
path, src, len, -1, dst, ca.drv, CAP_SMUDGE, dco);
14741476
if (!ret_filter && ca.drv && ca.drv->required)
1475-
die("%s: smudge filter %s failed", path, ca.drv->name);
1477+
die(_("%s: smudge filter %s failed"), path, ca.drv->name);
14761478

14771479
return ret | ret_filter;
14781480
}

t/t0021-conversion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
583583
git checkout --quiet --no-progress . 2>git-stderr.log &&
584584
585585
grep "smudge write error at" git-stderr.log &&
586-
grep "error: external filter" git-stderr.log &&
586+
test_i18ngrep "error: external filter" git-stderr.log &&
587587
588588
cat >expected.log <<-EOF &&
589589
START

0 commit comments

Comments
 (0)