Skip to content

translation-too-few-args (ODOO060)

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 calls passing fewer values than the term's printf placeholders require, e.g. _("%s of %s", count).

Why is this bad?

The translation function formats the term with %, and % formatting raises a TypeError at runtime when placeholders are left unfilled.

Example

_("%s of %s", count)

Use instead:

_("%s of %s", count, total)