polyglot icon indicating copy to clipboard operation
polyglot copied to clipboard

When a msgid contains %(keyword)s, keyword should not be translated

Open alexis-via opened this issue 2 years ago • 2 comments

Thanks for this great tool !

It works well, but I have one problem, to use your lib in real-life PO files from Odoo/OCA modules. My PO file contains:

#: code:addons/l10n_fr_das2/models/l10n_fr_das2.py:0
msgid "Company '%(company)s' is configured in country '%(country)s'."
msgstr ""

When I run:

python -m polyglot translate --from EN --to FR -s filename.po

I get the following result:

#: code:addons/l10n_fr_das2/models/l10n_fr_das2.py:0
msgid "Company '%(company)s' is configured in country '%(country)s'."
msgstr "L'entreprise \"%(entreprise)s\" est configurée dans le pays \"%(pays)s\"."

The keywords 'company' and 'country' should not be translated!

alexis-via avatar Jun 06 '23 14:06 alexis-via

Hi, thank you for reporting the issue. I will try to make the fix as soon as I have time

riccardoFasan avatar Jun 06 '23 15:06 riccardoFasan

Hi @alexis-via, can you test this PR? I added an argument where you can pass the variable wrapper. in your case you just add -v "'%(" ")s'"

riccardoFasan avatar Jun 12 '23 10:06 riccardoFasan