Re: [PATCH 06/22] builtin/replace.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/builtin/replace.c b/builtin/replace.c
> @@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, 
> int force, int gentle)
> -   if (remove_signature()) {
> -   warning(_("the original commit '%s' has a gpg signature."), 
> old_ref);
> -   warning(_("the signature will be removed in the replacement 
> commit!"));
> -   }
> +   if (remove_signature())
> +   warning(_("the original commit '%s' has a gpg signature.\n"
> + "The signature will be removed in the replacement 
> commit!"),
> +   old_ref);

It's kind of weird to drop capitalization of the first sentence but
not the second. Also, you dropped trailing "!" in some other patches;
do you want to do so here? Perhaps, instead:

the original commit '%s' has a gpg signature;
the signature will be removed in the replacement commit


[PATCH 06/22] builtin/replace.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 
---
 builtin/replace.c | 90 +++
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/builtin/replace.c b/builtin/replace.c
index 6da2411e14..c203534fd3 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -54,7 +54,7 @@ static int show_reference(const char *refname, const struct 
object_id *oid,
enum object_type obj_type, repl_type;
 
if (get_oid(refname, ))
-   return error("Failed to resolve '%s' as a valid 
ref.", refname);
+   return error(_("failed to resolve '%s' as a 
valid ref"), refname);
 
obj_type = oid_object_info(the_repository, ,
   NULL);
@@ -83,8 +83,8 @@ static int list_replace_refs(const char *pattern, const char 
*format)
else if (!strcmp(format, "long"))
data.format = REPLACE_FORMAT_LONG;
else
-   return error("invalid replace format '%s'\n"
-"valid formats are 'short', 'medium' and 'long'\n",
+   return error(_("invalid replace format '%s'\n"
+  "valid formats are 'short', 'medium' and 
'long'"),
 format);
 
for_each_replace_ref(the_repository, show_reference, (void *));
@@ -108,7 +108,7 @@ static int for_each_replace_name(const char **argv, 
each_replace_name_fn fn)
 
for (p = argv; *p; p++) {
if (get_oid(*p, )) {
-   error("Failed to resolve '%s' as a valid ref.", *p);
+   error("failed to resolve '%s' as a valid ref", *p);
had_error = 1;
continue;
}
@@ -118,7 +118,7 @@ static int for_each_replace_name(const char **argv, 
each_replace_name_fn fn)
full_hex = ref.buf + base_len;
 
if (read_ref(ref.buf, )) {
-   error("replace ref '%s' not found.", full_hex);
+   error(_("replace ref '%s' not found"), full_hex);
had_error = 1;
continue;
}
@@ -134,7 +134,7 @@ static int delete_replace_ref(const char *name, const char 
*ref,
 {
if (delete_ref(NULL, ref, oid, 0))
return 1;
-   printf("Deleted replace ref '%s'\n", name);
+   printf_ln(_("Deleted replace ref '%s'"), name);
return 0;
 }
 
@@ -146,12 +146,12 @@ static int check_ref_valid(struct object_id *object,
strbuf_reset(ref);
strbuf_addf(ref, "%s%s", git_replace_ref_base, oid_to_hex(object));
if (check_refname_format(ref->buf, 0))
-   return error("'%s' is not a valid ref name.", ref->buf);
+   return error(_("'%s' is not a valid ref name"), ref->buf);
 
if (read_ref(ref->buf, prev))
oidclr(prev);
else if (!force)
-   return error("replace ref '%s' already exists", ref->buf);
+   return error(_("replace ref '%s' already exists"), ref->buf);
return 0;
 }
 
@@ -171,10 +171,10 @@ static int replace_object_oid(const char *object_ref,
obj_type = oid_object_info(the_repository, object, NULL);
repl_type = oid_object_info(the_repository, repl, NULL);
if (!force && obj_type != repl_type)
-   return error("Objects must be of the same type.\n"
-"'%s' points to a replaced object of type '%s'\n"
-"while '%s' points to a replacement object of "
-"type '%s'.",
+   return error(_("objects must be of the same type.\n"
+  "'%s' points to a replaced object of type '%s'\n"
+  "while '%s' points to a replacement object of "
+  "type '%s'"),
 object_ref, type_name(obj_type),
 replace_ref, type_name(repl_type));
 
@@ -200,10 +200,10 @@ static int replace_object(const char *object_ref, const 
char *replace_ref, int f
struct object_id object, repl;
 
if (get_oid(object_ref, ))
-   return error("Failed to resolve '%s' as a valid ref.",
+   return error(_("failed to resolve '%s' as a valid ref"),
 object_ref);
if (get_oid(replace_ref, ))
-   return error("Failed to resolve '%s' as a valid ref.",
+   return error(_("failed to resolve '%s' as a valid ref"),
 replace_ref);
 
return replace_object_oid(object_ref, , replace_ref, , 
force);
@@ -222,7 +222,7 @@ static int export_object(const struct object_id *oid, enum 
object_type type,
 
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0)
-   return