translation-fstring-interpolation (W8303)#

An f-string is translated.

Applies to Odoo 14.0 and later.

What it does#

Reports f-strings passed to _().

Why is this bad?#

The f-string is formatted before _() sees it, so the translation catalogue never contains it and it stays untranslated.

Example#

_(f"Invoice {name} is paid")

Use instead:

_("Invoice %s is paid", name)

Ruff’s INT001 (flake8-gettext) is similar, for _() only.