Re: [PATCH 04/13] i18n: blame: mark error messages for translation

2016-09-12 Thread Junio C Hamano
Jean-Noël AVILA  writes:

>> @@ -2820,7 +2820,7 @@ int cmd_blame(int argc, const char **argv, const char
>> *prefix) &bottom, &top, sb.path))
>>  usage(blame_usage);
>>  if (lno < top || ((lno || bottom) && lno < bottom))
>> -die("file %s has only %lu lines", path, lno);
>> +die(_("file %s has only %lu lines"), path, lno);
>
> Here a plural version is needed.

Good eyes, like this?

 builtin/blame.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 3fee197..cb12085 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2820,7 +2820,9 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
&bottom, &top, sb.path))
usage(blame_usage);
if (lno < top || ((lno || bottom) && lno < bottom))
-   die(_("file %s has only %lu lines"), path, lno);
+   die(Q_("file %s has only %lu line",
+  "file %s has only %lu lines", lno),
+   path, lno);
if (bottom < 1)
bottom = 1;
if (top < 1)


Re: [PATCH 04/13] i18n: blame: mark error messages for translation

2016-09-10 Thread Jean-Noël AVILA
On mercredi 7 septembre 2016 14:49:08 CEST Vasco Almeida wrote:
> Mark error messages for translation passed to die() function.
> Change "Cannot" to lowercase following the usual style.
> 
> Reflect changes to test by using test_i18ngrep.
> 
> Signed-off-by: Vasco Almeida 
> ---
>  builtin/blame.c   | 12 ++--
>  t/t8003-blame-corner-cases.sh |  4 ++--
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/builtin/blame.c b/builtin/blame.c
> index a5bbf91..3fee197 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2601,7 +2601,7 @@ int cmd_blame(int argc, const char **argv, const char
> *prefix)
> 
>   if (incremental || (output_option & OUTPUT_PORCELAIN)) {
>   if (show_progress > 0)
> - die("--progress can't be used with --incremental or 
> porcelain 
formats");
> + die(_("--progress can't be used with --incremental or 
> porcelain
> formats")); show_progress = 0;
>   } else if (show_progress < 0)
>   show_progress = isatty(2);
> @@ -2727,7 +2727,7 @@ int cmd_blame(int argc, const char **argv, const char
> *prefix) sb.commits.compare = compare_commits_by_commit_date;
>   }
>   else if (contents_from)
> - die("--contents and --reverse do not blend well.");
> + die(_("--contents and --reverse do not blend well."));
>   else {
>   final_commit_name = prepare_initial(&sb);
>   sb.commits.compare = compare_commits_by_reverse_commit_date;
> @@ -2747,12 +2747,12 @@ int cmd_blame(int argc, const char **argv, const
> char *prefix) add_pending_object(&revs, &(sb.final->object), ":");
>   }
>   else if (contents_from)
> - die("Cannot use --contents with final commit object name");
> + die(_("cannot use --contents with final commit object name"));
> 
>   if (reverse && revs.first_parent_only) {
>   final_commit = find_single_final(sb.revs, NULL);
>   if (!final_commit)
> - die("--reverse and --first-parent together require 
> specified latest
> commit"); +   die(_("--reverse and --first-parent together 
> require
> specified latest commit")); }
> 
>   /*
> @@ -2779,7 +2779,7 @@ int cmd_blame(int argc, const char **argv, const char
> *prefix) }
> 
>   if (oidcmp(&c->object.oid, &sb.final->object.oid))
> - die("--reverse --first-parent together require range 
> along first-
parent
> chain"); +die(_("--reverse --first-parent together 
> require range along
> first-parent chain")); }
> 
>   if (is_null_oid(&sb.final->object.oid)) {
> @@ -2820,7 +2820,7 @@ int cmd_blame(int argc, const char **argv, const char
> *prefix) &bottom, &top, sb.path))
>   usage(blame_usage);
>   if (lno < top || ((lno || bottom) && lno < bottom))
> - die("file %s has only %lu lines", path, lno);
> + die(_("file %s has only %lu lines"), path, lno);

Here a plural version is needed.

>   if (bottom < 1)
>   bottom = 1;
>   if (top < 1)
> diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
> index e48370d..661f9d4 100755
> --- a/t/t8003-blame-corner-cases.sh
> +++ b/t/t8003-blame-corner-cases.sh
> @@ -212,12 +212,12 @@ EOF
> 
>  test_expect_success 'blame -L with invalid start' '
>   test_must_fail git blame -L5 tres 2>errors &&
> - grep "has only 2 lines" errors
> + test_i18ngrep "has only 2 lines" errors
>  '
> 
>  test_expect_success 'blame -L with invalid end' '
>   test_must_fail git blame -L1,5 tres 2>errors &&
> - grep "has only 2 lines" errors
> + test_i18ngrep "has only 2 lines" errors
>  '
> 
>  test_expect_success 'blame parses  part of -L' '




[PATCH 04/13] i18n: blame: mark error messages for translation

2016-09-07 Thread Vasco Almeida
Mark error messages for translation passed to die() function.
Change "Cannot" to lowercase following the usual style.

Reflect changes to test by using test_i18ngrep.

Signed-off-by: Vasco Almeida 
---
 builtin/blame.c   | 12 ++--
 t/t8003-blame-corner-cases.sh |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index a5bbf91..3fee197 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2601,7 +2601,7 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
 
if (incremental || (output_option & OUTPUT_PORCELAIN)) {
if (show_progress > 0)
-   die("--progress can't be used with --incremental or 
porcelain formats");
+   die(_("--progress can't be used with --incremental or 
porcelain formats"));
show_progress = 0;
} else if (show_progress < 0)
show_progress = isatty(2);
@@ -2727,7 +2727,7 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
sb.commits.compare = compare_commits_by_commit_date;
}
else if (contents_from)
-   die("--contents and --reverse do not blend well.");
+   die(_("--contents and --reverse do not blend well."));
else {
final_commit_name = prepare_initial(&sb);
sb.commits.compare = compare_commits_by_reverse_commit_date;
@@ -2747,12 +2747,12 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
add_pending_object(&revs, &(sb.final->object), ":");
}
else if (contents_from)
-   die("Cannot use --contents with final commit object name");
+   die(_("cannot use --contents with final commit object name"));
 
if (reverse && revs.first_parent_only) {
final_commit = find_single_final(sb.revs, NULL);
if (!final_commit)
-   die("--reverse and --first-parent together require 
specified latest commit");
+   die(_("--reverse and --first-parent together require 
specified latest commit"));
}
 
/*
@@ -2779,7 +2779,7 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
}
 
if (oidcmp(&c->object.oid, &sb.final->object.oid))
-   die("--reverse --first-parent together require range 
along first-parent chain");
+   die(_("--reverse --first-parent together require range 
along first-parent chain"));
}
 
if (is_null_oid(&sb.final->object.oid)) {
@@ -2820,7 +2820,7 @@ int cmd_blame(int argc, const char **argv, const char 
*prefix)
&bottom, &top, sb.path))
usage(blame_usage);
if (lno < top || ((lno || bottom) && lno < bottom))
-   die("file %s has only %lu lines", path, lno);
+   die(_("file %s has only %lu lines"), path, lno);
if (bottom < 1)
bottom = 1;
if (top < 1)
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index e48370d..661f9d4 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -212,12 +212,12 @@ EOF
 
 test_expect_success 'blame -L with invalid start' '
test_must_fail git blame -L5 tres 2>errors &&
-   grep "has only 2 lines" errors
+   test_i18ngrep "has only 2 lines" errors
 '
 
 test_expect_success 'blame -L with invalid end' '
test_must_fail git blame -L1,5 tres 2>errors &&
-   grep "has only 2 lines" errors
+   test_i18ngrep "has only 2 lines" errors
 '
 
 test_expect_success 'blame parses  part of -L' '
-- 
2.7.4