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

[bos-dev] [patch #7794] Treat _("string") as format string only if needed



URL:
  <http://savannah.nongnu.org/patch/?7794>

                 Summary: Treat _("string") as format string only if needed
                 Project: Bos Wars
            Submitted by: kon
            Submitted on: Thu 21 Jun 2012 09:41:05 PM GMT
             Open/Closed: Open
                  Status: None
             Assigned to: None
        Originator Email: 
         Discussion Lock: Any

    _______________________________________________________

Details:

There were many calls like SetMessage(_("Screenshot made.")), where the called
function treated the translated string as a format string even though no
format arguments were passed along.  Because the original string did not
contain any percent signs, xgettext did not add the c-format flag to the entry
in the PO file, and translators then could have added percent signs without
knowing that they had to be doubled.

Change such calls to e.g. SetMessage("%s", _("Screenshot made.")), so that
percent signs in the translated string have no special effect.  Suggested by
Jarod42.

This change does not help against intentionally malicious PO files because
there still are many translatable format strings.  Just search for c-format in
languages/*.po to see.  However, the change should help against inadvertent
mistakes.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 21 Jun 2012 09:41:05 PM GMT  Name:
0001-Treat-_-string-as-format-string-only-if-needed.patch  Size: 6kB   By: kon
[PATCH] Treat _(&quot;string&quot;) as format string only if needed
<http://savannah.nongnu.org/patch/download.php?file_id=26080>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7794>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/