You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Erenkrantz <ju...@erenkrantz.com> on 2004/04/01 16:18:59 UTC

Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

--On Thursday, April 1, 2004 12:21 PM -0300 Nicolás Lichtmaier 
<ni...@reloco.com.ar> wrote:

> I'm also adding _() everywhere.

Cool.  Once we know we haven't killed the build everywhere (probably 
straightened out by now), we can start checking in the _() changes as well.

> BTW.. how do we handle plurals? GNU gettext
> has a way, but it seems that we don't want to depend on that =).

How does it do it?  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Nicolás Lichtmaier <ni...@reloco.com.ar>.
>>>In French, this would be incorrect as the condition is >= 1
>>>(i.e. 0 -> singular). There was a problem like that in another
>>>project (ROX) and the source (and English messages) had to be
>>>changed so that it could be translatable into French.
>>>      
>>>
>>Gettext handles that. You define a rule which defines which of a set
>>of translations is used based on the number passed to ngettext.
>>    
>>
>Yup. But we'll still have to modify the code in several places, if we
>actually are checking n!=1.
>  
>

Yes, but this it's done at the same time the code is converted to 
gettext. That conversion needs changing the code anyway:

printf("%d files%s updated", n, (n==1)?"":"s");

to

printf(ngettext("%d file updated", "%d files updated", n), n);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Branko Čibej <br...@xbc.nu>.
Nicolás Lichtmaier wrote:

>
>>> There are already many places where the code thecks if a number is
>>> !=1 and decides weather to use a plural form or not.
>>>   
>>
>> In French, this would be incorrect as the condition is >= 1
>> (i.e. 0 -> singular). There was a problem like that in another
>> project (ROX) and the source (and English messages) had to be
>> changed so that it could be translatable into French.
>>  
>>
>
> Gettext handles that. You define a rule which defines which of a set
> of translations is used based on the number passed to ngettext.

Yup. But we'll still have to modify the code in several places, if we
actually are checking n!=1.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Nicolás Lichtmaier <ni...@reloco.com.ar>.
>>There are already many places where the code thecks if a number is !=1 
>>and decides weather to use a plural form or not.
>>    
>>
>In French, this would be incorrect as the condition is >= 1
>(i.e. 0 -> singular). There was a problem like that in another
>project (ROX) and the source (and English messages) had to be
>changed so that it could be translatable into French.
>  
>

Gettext handles that. You define a rule which defines which of a set of 
translations is used based on the number passed to ngettext.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Vincent Lefevre <vi...@vinc17.org>.
On 2004-04-01 16:21:09 -0300, Nicolás Lichtmaier wrote:
> There are already many places where the code thecks if a number is !=1 
> and decides weather to use a plural form or not.

In French, this would be incorrect as the condition is >= 1
(i.e. 0 -> singular). There was a problem like that in another
project (ROX) and the source (and English messages) had to be
changed so that it could be translatable into French.

-- 
Vincent Lefèvre <vi...@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Greg Hudson <gh...@MIT.EDU>.
On Thu, 2004-04-01 at 14:46, Nicolás Lichtmaier wrote:
> What some libraries do is to ship config.h under a new name (the current 
> subversion name for this file would be perfect for that).

Any library that does so is severely broken.  It's not even a little bit
okay to #include <svn_pools.h> and get things like HAVE_MEMORY_H
defined.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Nicolás Lichtmaier <ni...@reloco.com.ar>.
>>Besides, config.h might suply for missing features in the current
>>compiler (bool, const, inline, etc.) and those things should also be
>>defined when parsing the headers.
>>    
>>
>
>Absolutely not.  Our public headers cannot rely on stuff from config.h,
>because config.h is not installed.  (If it were installed and used, it
>would stomp all over the calling application's namespace.)
>  
>

What some libraries do is to ship config.h under a new name (the current 
subversion name for this file would be perfect for that).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Greg Hudson <gh...@MIT.EDU>.
On Thu, 2004-04-01 at 14:21, Nicolás Lichtmaier wrote:
> System headers react to some macros by changing what is defined (e.g. 
> _GNU_SOURCE), and some autoconf macros depend on this.

This would be a valid argument, but since we rely on APR for most
portability concerns, we're unlikely to use any such autoconf macros.

> Besides, config.h might suply for missing features in the current
> compiler (bool, const, inline, etc.) and those things should also be
> defined when parsing the headers.

Absolutely not.  Our public headers cannot rely on stuff from config.h,
because config.h is not installed.  (If it were installed and used, it
would stomp all over the calling application's namespace.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Nicolás Lichtmaier <ni...@reloco.com.ar>.
>> The changes are harmless anyway. Have you read my comment about #include
>> <config.h> needing to be *before* the other includes?
>
>
> I disagree with the FSF on their rationale here.  Our working 
> procedure has been that header files should be self-contained.  By 
> adding in the <config.h> at the top, we would mask header files that 
> really have a dependency on things defined in config.h.


System headers react to some macros by changing what is defined (e.g. 
_GNU_SOURCE), and some autoconf macros depend on this. Besides, config.h 
might suply for missing features in the current compiler (bool, const, 
inline, etc.) and those things should also be defined when parsing the 
headers. This is how autoconf is supposed to work and I don't see why 
subversion should be different than all the other projects...

>> char *gettext(char *);
>>
>> There's a ngettext function, defined as:
>>
>> char *ngettext(char *msgid1, char *msgid2, int n);
>
> Normal gettext is:
>
> Newer versions of Solaris supports ngettext as well.  However, older 
> versions don't as they precede GNU gettext's introduction of ngettext 
> (circa 2001, AFAICT).  So, it's a question of how far back we should 
> support.
>
> At this moment, I don't see a reason why we need to handle plurals.  
> If we find out later that we really ought to do plurals, we can adjust 
> our targets accordingly.  *shrug*


There are already many places where the code thecks if a number is !=1 
and decides weather to use a plural form or not.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, April 1, 2004 3:17 PM -0300 Nicolás Lichtmaier 
<ni...@reloco.com.ar> wrote:

> The changes are harmless anyway. Have you read my comment about #include
> <config.h> needing to be *before* the other includes?

I disagree with the FSF on their rationale here.  Our working procedure has 
been that header files should be self-contained.  By adding in the <config.h> 
at the top, we would mask header files that really have a dependency on things 
defined in config.h.

> Normal gettext is:
>
> char *gettext(char *);
>
> There's a ngettext function, defined as:
>
> char *ngettext(char *msgid1, char *msgid2, int n);

Newer versions of Solaris supports ngettext as well.  However, older versions 
don't as they precede GNU gettext's introduction of ngettext (circa 2001, 
AFAICT).  So, it's a question of how far back we should support.

At this moment, I don't see a reason why we need to handle plurals.  If we 
find out later that we really ought to do plurals, we can adjust our targets 
accordingly.  *shrug*  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Plurals in translations was Re: [STRAW POLL] Help on i18n translations?

Posted by Nicolás Lichtmaier <ni...@reloco.com.ar>.
Justin Erenkrantz wrote:

> --On Thursday, April 1, 2004 12:21 PM -0300 Nicolás Lichtmaier 
> <ni...@reloco.com.ar> wrote:
>
>> I'm also adding _() everywhere.
>
>
> Cool.  Once we know we haven't killed the build everywhere (probably 
> straightened out by now), we can start checking in the _() changes as 
> well.


The changes are harmless anyway. Have you read my comment about #include 
<config.h> needing to be *before* the other includes?

>> BTW.. how do we handle plurals? GNU gettext
>> has a way, but it seems that we don't want to depend on that =).
>
>
> How does it do it?  -- justin


Normal gettext is:

char *gettext(char *);

There's a ngettext function, defined as:

char *ngettext(char *msgid1, char *msgid2, int n);

where msgid1 is the English singular form, msgid2 the English plural 
form and n is the quantity. E.g.:

sprintf(ngettext("%d file updated", "%d files updated", n), n);

xgettext will properly parse and handle this. It has extended the .po 
format to do that.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org