[Gajim-devel] Patch for translatable messages

Jan Claeys lists at janc.be
Tue Sep 5 18:59:14 CEST 2006

Op di, 05-09-2006 te 17:52 +0200, schreef Yann Le Boulanger:
> Torsten Bronger wrote:
> > Okay, poor example, mea culpa.  ;-)
> > 
> > _("see %s" % contactname)
> > 
> > And e.g. "see Asterix" surely is not in the pot file.

> "see Asterix" is of course not in pot file, but "see %s" is, so "see %s" 
> is translated, then %s is replaced with Asterix, and it's fine. applying 
> your patch doesn't change the way pot file is built.

But at run-time, the string formatting is done first, and then the
result of that is passed as an argument to the _() function that looks
up the translation, so then:
   contactname = "Asterix"
   _("see %s" % contactname)

*is* the same as:

   _("see Asterix")

Now gettext will look for "see Asterix" in the po file...

Jan Claeys

More information about the Gajim-devel mailing list