po-unknown-occurrence (PO102)#

Odoo cannot read a #: reference of a translation.

What it does#

Checks the #: references of each entry the way Odoo reads them. Odoo only understands:

  • model:<model>,<field>:<module>.<xmlid> and model_terms:... for translations of records and views;

  • code:<path>:<line> for _() in Python and JavaScript.

When a module has an i18n/<module>.pot, Odoo takes the references from the template instead of from the .po files, so the .pot is checked and the references in the .po files are not.

Why is this bad?#

For an unknown reference Odoo logs malformed po file: unknown occurrence and ignores it. A code: reference without a line number is worse: reading the file raises ValueError, so none of the module’s code translations load in that language.

Fix safety#

Safe for a code: reference without a line number: :0 is added.