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

 
 

You are not allowed to post comments on this tracker with your current authentification 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: OpenStatus: None
Assigned to: None

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

 

Attached Files
file #26080:  0001-Treat-_-string-as-format-string-only-if-needed.patch added by kon (6kB - 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
  • -unavailable- added by kon (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 21 Jun 2012 09:41:05 PM UTCkonAttached File-=>Added 0001-Treat-_-string-as-format-string-only-if-needed.patch, #26080

    Back to the top


    Powered by Savane 3.1-cleanup