Re: [PATCH v2] i18n: notes: mark comment for translation

2016-07-27 Thread Vasco Almeida
A Ter, 26-07-2016 às 10:05 -0700, Junio C Hamano escreveu:
> In any case, I do not understand why you want to exclude the LFs
> from the message.

As Ævar Arnfjörð Bjarmason pointed out [1], it is to assure that a
translator does not break the output by mistake, by removing a LF.
I agree because I have seen a few mistakes about blanks in
translations. I do them myself. I think it is easy to do them if you
are translating a lot of strings, like if you were to start translating
Git to a new language right now. Thus I think it is a good idea to
assure that this kind of mistakes do not occur.

Although msgfmt can catch some mistakes, like source string and
translation must end both with \n, it does not catch all possible
mistakes. For example, I think it does not check a start \n, which is
relevant here. For that translator must use other quality assurance
tools. I know of translate toolkit [2] and msgcheck [3].

> If a translation for a particular language is
> very long and would not fit on a single line, the translator is
> allowed to make the message much longer, i.e. the translated version
> of the  part may contain one or more LFs (which is what the
> add-commented-lines function was invented for).  I'd think having
> LFs in the to-be-translated-original will serve as a good hint to
> signal translators that is the case.

When I am translating I always assume that it is fine do add or remove
some lines as needed, unless I'm told otherwise (by a comment for
translators, e.g.).

[1] http://www.mail-archive.com/git@vger.kernel.org/msg98793.html
[2] http://docs.translatehouse.org/projects/translate-toolkit/
[3] https://github.com/flashcode/msgcheck
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i18n: notes: mark comment for translation

2016-07-26 Thread Junio C Hamano
Vasco Almeida  writes:

> A Seg, 25-07-2016 às 10:49 -0700, Junio C Hamano escreveu:
>> Vasco Almeida  writes:
>> 
>> > 
>> >  static const char note_template[] =
>> > -  "\nWrite/edit the notes for the following object:\n";
>> > +  N_("Write/edit the notes for the following object:");
>> 
>> I do not quite understand why you want the blank lines surrounding
>> the message outside add_commented_lines() call.  I think the intent
>> is to produce
>> 
>> #
>> # Write/edit the notes for the following object:
>> #
>
> Yes, this was my intention. The original does:
>
>     #
>     # Write/edit the notes for the following object:
>     

Ah, of course, I misspoke.  The original "\n\n" requests
that an empty line that is commented, followed by a line with the
message that is also commented, is given at that point.  The last
commented blank was my mistake.

In any case, I do not understand why you want to exclude the LFs
from the message.  If a translation for a particular language is
very long and would not fit on a single line, the translator is
allowed to make the message much longer, i.e. the translated version
of the  part may contain one or more LFs (which is what the
add-commented-lines function was invented for).  I'd think having
LFs in the to-be-translated-original will serve as a good hint to
signal translators that is the case.

Thansk.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i18n: notes: mark comment for translation

2016-07-26 Thread Vasco Almeida
A Seg, 25-07-2016 às 10:49 -0700, Junio C Hamano escreveu:
> Vasco Almeida  writes:
> 
> > 
> >  static const char note_template[] =
> > -   "\nWrite/edit the notes for the following object:\n";
> > +   N_("Write/edit the notes for the following object:");
> >  
> >  struct note_data {
> >     int given;
> > @@ -179,7 +179,8 @@ static void prepare_note_data(const unsigned
> > char *object, struct note_data *d,
> >     copy_obj_to_fd(fd, old_note);
> >  
> >     strbuf_addch(&buf, '\n');
> > -   strbuf_add_commented_lines(&buf, note_template,
> > strlen(note_template));
> > +   strbuf_addch(&buf, '\n');
> > +   strbuf_add_commented_lines(&buf, _(note_template),
> > strlen(_(note_template)));
> 
> I do not quite understand why you want the blank lines surrounding
> the message outside add_commented_lines() call.  I think the intent
> is to produce
> 
> #
> # Write/edit the notes for the following object:
> #

If this is what we want, I will send a re-roll accordingly.

> with the single call.  If you pushed the newlines outside the
> message, wouldn't you end up having this instead ( denoting an
> extra empty line each before and after the message)?
> 
> 
> # Write/edit the notes for the following object:
> 
> 
Yes, this was my intention. The original does:

    #
    # Write/edit the notes for the following object:
    

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i18n: notes: mark comment for translation

2016-07-25 Thread Junio C Hamano
Vasco Almeida  writes:

>  static const char note_template[] =
> - "\nWrite/edit the notes for the following object:\n";
> + N_("Write/edit the notes for the following object:");
>  
>  struct note_data {
>   int given;
> @@ -179,7 +179,8 @@ static void prepare_note_data(const unsigned char 
> *object, struct note_data *d,
>   copy_obj_to_fd(fd, old_note);
>  
>   strbuf_addch(&buf, '\n');
> - strbuf_add_commented_lines(&buf, note_template, 
> strlen(note_template));
> + strbuf_addch(&buf, '\n');
> + strbuf_add_commented_lines(&buf, _(note_template), 
> strlen(_(note_template)));

I do not quite understand why you want the blank lines surrounding
the message outside add_commented_lines() call.  I think the intent
is to produce

#
# Write/edit the notes for the following object:
#

with the single call.  If you pushed the newlines outside the
message, wouldn't you end up having this instead ( denoting an
extra empty line each before and after the message)?


# Write/edit the notes for the following object:


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] i18n: notes: mark comment for translation

2016-07-23 Thread Vasco Almeida
Mark comment displayed when editing a note for translation.

Signed-off-by: Vasco Almeida 
---

It seems that strbuf_add_commented_lines adds a trailing newline. So adding
another strbuf_addch(&buf, '\n') would make 2 lines rather only one.

 builtin/notes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin/notes.c b/builtin/notes.c
index 0572051..1d6a096 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -91,7 +91,7 @@ static const char * const git_notes_get_ref_usage[] = {
 };
 
 static const char note_template[] =
-   "\nWrite/edit the notes for the following object:\n";
+   N_("Write/edit the notes for the following object:");
 
 struct note_data {
int given;
@@ -179,7 +179,8 @@ static void prepare_note_data(const unsigned char *object, 
struct note_data *d,
copy_obj_to_fd(fd, old_note);
 
strbuf_addch(&buf, '\n');
-   strbuf_add_commented_lines(&buf, note_template, 
strlen(note_template));
+   strbuf_addch(&buf, '\n');
+   strbuf_add_commented_lines(&buf, _(note_template), 
strlen(_(note_template)));
strbuf_addch(&buf, '\n');
write_or_die(fd, buf.buf, buf.len);
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html