git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Stimming <stimming@tuhh.de>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: "Ralf Thielow" <ralf.thielow@gmail.com>, "Jan Krüger" <jk@jk.gs>,
	git <git@vger.kernel.org>
Subject: Re: [PATCH/RFC] l10n: de.po: translate 39 new messages
Date: Wed, 17 Apr 2013 17:35:35 +0200	[thread overview]
Message-ID: <2437082.cf76RUS0j0@cs-pc> (raw)
In-Reply-To: <87a9ox1sue.fsf@linux-k42r.v.cablecom.net>

Am Mittwoch, 17. April 2013, 10:09:29 schrieb Thomas Rast:
> >> >  msgid "The bundle contains this ref:"
> >> >  msgid_plural "The bundle contains these %d refs:"
> >> > 
> >> > -msgstr[0] "Das Paket enthält %d Referenz"
> >> > -msgstr[1] "Das Paket enthält %d Referenzen"
> >> > +msgstr[0] "Das Paket enthält diese Referenz:"
> >> > +msgstr[1] "Das Paket enthält diese %d Referenzen:"
> >> 
> >> The msgstr[0] must still contain a %d conversion specifier (which will
> >> be filled with the number 1) even though the translated sentence
> >> wouldn't need the 1 anymore. The previous msgstr[0] was correct; the
> >> English singular msgid
> >> is not.
> > 
> > That made me wonder, too. I've played around a bit with this, and it
> > seems to be OK as long as one of those strings contain at least one
> > format specifier.
> 
> C printf() only knows about the number and types of arguments from the
> format string, so *ignoring* arguments is not a problem for correctness.

Indeed both of you are correct and I learned something new. 

http://stackoverflow.com/questions/3578970/passing-too-many-arguments-to-
printf

where the second answer quotes  Online C Draft Standard (n1256), section 
7.19.6.1, paragraph 2: "If the format is exhausted while arguments remain, the 
excess arguments are evaluated (as always) but are otherwise ignored."

Hence, it is indeed safe to skip unneeded conversion specifiers both in 
general ngettext messages and also in their respective translation. This is an 
explanation which has yet to be added to ngettext's documentation.

Best Regards,

Christian

  reply	other threads:[~2013-04-17 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 16:27 [PATCH/RFC] l10n: de.po: translate 39 new messages Ralf Thielow
2013-04-15 19:26 ` Christian Stimming
2013-04-17  5:18   ` Ralf Thielow
     [not found]   ` <CAN0XMOLmwUpwOi0xz4iOy3wfhzCeeNKNgywgS9ZfaET172vsBQ@mail.gmail.com>
2013-04-17  8:09     ` Thomas Rast
2013-04-17 15:35       ` Christian Stimming [this message]
2013-04-17 23:02   ` Junio C Hamano
2013-04-16  8:34 ` Thomas Rast
2013-04-17  5:49   ` Ralf Thielow
2013-04-17  7:50     ` Thomas Rast
2013-04-18 17:14 ` [PATCHv2] " Ralf Thielow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2437082.cf76RUS0j0@cs-pc \
    --to=stimming@tuhh.de \
    --cc=git@vger.kernel.org \
    --cc=jk@jk.gs \
    --cc=ralf.thielow@gmail.com \
    --cc=trast@inf.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).