Re: ngettext() related query in evolution



Today at 5:58, Not Zed wrote:

> We have some values that are in a table, like:
>
> Total messages:  xx
> Unread messages: xx
>
> Dobey got carried away and made it an ngettext() thing, which breaks in
> English of course (maybe it's correct in American!).  

You can call ngettext() simply using:

  ngettext("Total messages: %d", "Total messages: %d", total);

i.e. there is no real need to use singular in the first message if
it's inappropriate for English.  If you go this way, please add a
comment just before the ngettext call so translators will be alterted
to this.

> Is it appropriate
> to just use the 1 string for a table like this, for other languages as
> with English, or does it need some messy comment?

No, this is perfectly fine to stay as a single message.  ngettext is
actually required if and only if the following two conditions are
fulfilled:
  1. string includes something replaced with number in runtime
  2. such replaced something is followed by a noun, adjective, adverb
     or a similar word

Examples requiring ngettext:
  - "Total %d messages"
  - "for %l hours"
  - "%d sent" (if meant as "%d sent messages", so "sent" is adjective
               or whatever in English)

Examples NOT requiring ngettext:
  - "Read all messages (%d)"
  - "Read messages:" (even if you have separate "Read message" and
    "Read messages", you don't need ngettext here)
  - "Total messages: %d"

However, using ngettext in the last example (and what you are asking
for) would allow translators to use constructs such as "Total %d
messages" instead.  I don't know if this is desirable or useful in
this context.


Cheers,
Danilo


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]