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

Submitter:  Kalle Olavi Niemitalo <kon>
Submitted:  Thu 21 Jun 2012 09:41:05 PM UTC
   
 
Open/Closed:  Closed Status:  Done
Assigned to:  feb

Fri 07 Jul 2023 08:56:49 AM UTC, comment #1: 

Patch applied and shipped in version 2.8. Thank you for the patch.

François Beerten <feb>
Group administrator
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>
Group Member

 

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

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 feb (Posted a comment)
  • -email is unavailable- added by kon (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-14 feb Open/ClosedOpen Closed
    2023-07-07 feb StatusNone Done
        Assigned toNone feb
    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.13-d3ae.
    Corresponding source code