Skip to content

translation-unsupported-format (ODOO062)

Preview (since 0.16.2.9) · Related issues · View source

Derived from the odoo linter.

This rule is unstable and in preview. The --preview flag is required for use.

What it does

Checks for translation terms using a printf conversion that Python's % formatting does not support, e.g. _("Hello %y", name).

Why is this bad?

The translation function formats the term with %, so an unsupported conversion character raises a ValueError at runtime.

Example

_("Hello %y", name)

Use instead:

_("Hello %s", name)