patchBos Wars - Patches: patch #7794, Treat _("string") as...


You are not allowed to post comments on this tracker with your current authentication level.

patch #7794: Treat _("string") as format string only if needed

Submitted by:  Kalle Olavi Niemitalo <kon>
Submitted on:  Thu 21 Jun 2012 09:41:05 PM UTC
Open/Closed:  Open Status:  None
Assigned to:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Thu 21 Jun 2012 09:41:05 PM UTC, original submission:  

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.

Kalle Olavi Niemitalo <kon>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #26080:  0001-Treat-_-string-as-format-string-only-if-needed.patch added by kon (6KiB - text/x-patch - [PATCH] Treat _("string") as format string only if needed)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by kon (Submitted the item)




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-21 kon Attached File- => Added 0001-Treat-_-string-as-format-string-only-if-needed.patch, #26080

    Back to the top

    Powered by Savane 3.9