translate / pootle

Online translation tool
http://pootle.translatehouse.org
GNU General Public License v3.0
1.49k stars 287 forks source link

"Placeholders" quality check ignores "`smalltalk-format`" flag in `.po` file #6919

Open ikedas opened 1 year ago

ikedas commented 1 year ago

Steps to reproduce:

  1. Create a template .pot including smalltalk-format flag:

    #. (list.name,domain)
    #: default/mail_tt2/listmaster_notification.tt2:345
    #, smalltalk-format
    msgid "Listmaster: list %1@%2 at 100 percents error"
    msgstr ""
    
    ...
  2. Add it into a project on Pootle, and make that project use "l20n" Quality Checks.

  3. On Pootle GUI, add a translation including escaped "%" character:

    ...
    
    msgstr "Listmaster : la liste %1@%2 est à 100%% d'erreur"

Results (Expected/Actual):

Expected result

A smalltalk format string "starts with ‘%’ and is followed by ‘%’ or a nonzero digit (‘1’ to ‘9’)". [ref]

So if smalltalk-format flag exists, the "%%" in the translation should be treated as a single "%" sign and shouldn't be treated as an error.

Actual result

The "%%" is treated as a critical error:

image

Environment (i.e. 'pootle --version', DB, OS, Browser):

$ pootle --version
Pootle 2.8.2 (Django 1.10.8, Translate Toolkit 2.2.5)