[PATCH 10/22] convert.c: mark more strings for translation

2018-06-01 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy 
---
 convert.c | 42 ++
 t/t0021-conversion.sh |  2 +-
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/convert.c b/convert.c
index 64d0d30e08..e53911d4f8 100644
--- a/convert.c
+++ b/convert.c
@@ -190,7 +190,7 @@ static enum eol output_eol(enum crlf_action crlf_action)
/* fall through */
return text_eol_is_crlf() ? EOL_CRLF : EOL_LF;
}
-   warning("Illegal crlf_action %d\n", (int)crlf_action);
+   warning(_("illegal crlf_action %d"), (int)crlf_action);
return core_eol;
 }
 
@@ -203,11 +203,11 @@ static void check_global_conv_flags_eol(const char *path, 
enum crlf_action crlf_
 * CRLFs would not be restored by checkout
 */
if (conv_flags & CONV_EOL_RNDTRP_DIE)
-   die(_("CRLF would be replaced by LF in %s."), path);
+   die(_("CRLF would be replaced by LF in %s"), path);
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
warning(_("CRLF will be replaced by LF in %s.\n"
  "The file will have its original line"
- " endings in your working directory."), path);
+ " endings in your working directory"), path);
} else if (old_stats->lonelf && !new_stats->lonelf ) {
/*
 * CRLFs would be added by checkout
@@ -217,7 +217,7 @@ static void check_global_conv_flags_eol(const char *path, 
enum crlf_action crlf_
else if (conv_flags & CONV_EOL_RNDTRP_WARN)
warning(_("LF will be replaced by CRLF in %s.\n"
  "The file will have its original line"
- " endings in your working directory."), path);
+ " endings in your working directory"), path);
}
 }
 
@@ -492,8 +492,8 @@ static int encode_to_worktree(const char *path, const char 
*src, size_t src_len,
dst = reencode_string_len(src, src_len, enc, default_encoding,
  &dst_len);
if (!dst) {
-   error("failed to encode '%s' from %s to %s",
-   path, default_encoding, enc);
+   error(_("failed to encode '%s' from %s to %s"),
+ path, default_encoding, enc);
return 0;
}
 
@@ -670,7 +670,8 @@ static int filter_buffer_or_fd(int in, int out, void *data)
 
if (start_command(&child_process)) {
strbuf_release(&cmd);
-   return error("cannot fork to run external filter '%s'", 
params->cmd);
+   return error(_("cannot fork to run external filter '%s'"),
+params->cmd);
}
 
sigchain_push(SIGPIPE, SIG_IGN);
@@ -689,13 +690,14 @@ static int filter_buffer_or_fd(int in, int out, void 
*data)
if (close(child_process.in))
write_err = 1;
if (write_err)
-   error("cannot feed the input to external filter '%s'", 
params->cmd);
+   error(_("cannot feed the input to external filter '%s'"),
+ params->cmd);
 
sigchain_pop(SIGPIPE);
 
status = finish_command(&child_process);
if (status)
-   error("external filter '%s' failed %d", params->cmd, status);
+   error(_("external filter '%s' failed %d"), params->cmd, status);
 
strbuf_release(&cmd);
return (write_err || status);
@@ -730,13 +732,13 @@ static int apply_single_file_filter(const char *path, 
const char *src, size_t le
return 0;   /* error was already reported */
 
if (strbuf_read(&nbuf, async.out, len) < 0) {
-   err = error("read from external filter '%s' failed", cmd);
+   err = error(_("read from external filter '%s' failed"), cmd);
}
if (close(async.out)) {
-   err = error("read from external filter '%s' failed", cmd);
+   err = error(_("read from external filter '%s' failed"), cmd);
}
if (finish_async(&async)) {
-   err = error("external filter '%s' failed", cmd);
+   err = error(_("external filter '%s' failed"), cmd);
}
 
if (!err) {
@@ -790,7 +792,7 @@ static void handle_filter_error(const struct strbuf 
*filter_status,
 * Something went wrong with the protocol filter.
 * Force shutdown and restart if another blob requires 
filtering.
 */
-   error("external filter '%s' failed", entry->subprocess.cmd);
+   error(_("external filter '%s' failed"), entry->subprocess.cmd);
subprocess_stop(&subprocess_map, &entry->subprocess);
free(entry);
}
@@ -838,7 +840,7 @@ static int apply_multi

Re: [PATCH 10/22] convert.c: mark more strings for translation

2018-06-03 Thread Eric Sunshine
On Sat, Jun 2, 2018 at 12:32 AM, Nguyễn Thái Ngọc Duy  wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy 
> ---
> diff --git a/convert.c b/convert.c
> @@ -203,11 +203,11 @@ static void check_global_conv_flags_eol(const char 
> *path, enum crlf_action crlf_
> if (conv_flags & CONV_EOL_RNDTRP_DIE)
> -   die(_("CRLF would be replaced by LF in %s."), path);
> +   die(_("CRLF would be replaced by LF in %s"), path);
> else if (conv_flags & CONV_EOL_RNDTRP_WARN)
> warning(_("CRLF will be replaced by LF in %s.\n"
>   "The file will have its original line"
> - " endings in your working directory."), 
> path);
> + " endings in your working directory"), 
> path);
> @@ -217,7 +217,7 @@ static void check_global_conv_flags_eol(const char *path, 
> enum crlf_action crlf_
> else if (conv_flags & CONV_EOL_RNDTRP_WARN)
> warning(_("LF will be replaced by CRLF in %s.\n"
>   "The file will have its original line"
> - " endings in your working directory."), 
> path);
> + " endings in your working directory"), 
> path);
> }
>  }

For these two, perhaps:

 ... replace by  in %s;
the file will have its original line
endings in your working directory

> @@ -492,8 +492,8 @@ static int encode_to_worktree(const char *path, const 
> char *src, size_t src_len,
> dst = reencode_string_len(src, src_len, enc, default_encoding,
>   &dst_len);
> if (!dst) {
> -   error("failed to encode '%s' from %s to %s",
> -   path, default_encoding, enc);
> +   error(_("failed to encode '%s' from %s to %s"),
> + path, default_encoding, enc);

The whitespace change on the second line fixes alignment with the
opening '('. Okay.