Skip to content

[FIX] code, expressions: translate t-attf-#1807

Open
kebeclibre wants to merge 1 commit intomasterfrom
master-translate-tattf-lpe
Open

[FIX] code, expressions: translate t-attf-#1807
kebeclibre wants to merge 1 commit intomasterfrom
master-translate-tattf-lpe

Conversation

@kebeclibre
Copy link
Copy Markdown
Contributor

Before this commit, t-attf attributes were not translated. In odoo, they are since odoo/odoo#201511 (in qweb python that is).

This commit implements the translations of t-attf attributes as long as their static counterpart is also translatable.
ie: "title" and "t-attf-title"
but NOT "data-random" and "t-attf-data-random"

The spec is that expressions composing the formatted string are not visible to the translator, and are just indexed and reinjected.

That is:
t-attf-title="Some {{ this.object }} View {{ this.viewId }}" is transformed into "Some {{1}} View {{2}}"

That way, expressions cannot be mistakenly translated in the string received from the translation function.

task-6033548

@kebeclibre kebeclibre force-pushed the master-translate-tattf-lpe branch from 2290e01 to dccc71d Compare March 12, 2026 15:00
kebeclibre added a commit to odoo-dev/odoo that referenced this pull request Mar 16, 2026
Before this commit, t-attf attributes were not translated in owl templates
In odoo, they are since odoo#201511 (in qweb python that is).

This commit allows for collecting those expression in the translations.

As for the python, expressions are slightly modified.
`t-attf-title="Some {{ this.object }} View {{ this.viewId }}"` is
transformed into `"Some {{0}} View {{1}}"`

That way, expressions cannot be mistakenly translated in the string
received from the translation function.

owl-pr: odoo/owl#1807
task-6033548
@kebeclibre kebeclibre force-pushed the master-translate-tattf-lpe branch from dccc71d to a361601 Compare March 16, 2026 09:43
@kebeclibre kebeclibre force-pushed the master-translate-tattf-lpe branch 2 times, most recently from 0e02a60 to d41a5b5 Compare March 16, 2026 10:01
Before this commit, t-attf attributes were not translated.
In odoo, they are since odoo/odoo#201511 (in qweb python that is).

This commit implements the translations of t-attf attributes as long as
their static counterpart is also translatable.
ie: "title" and "t-attf-title"
but NOT "data-random" and "t-attf-data-random"

The spec is that expressions composing the formatted string are not visible
to the translator, and are just indexed and reinjected.

That is:
`t-attf-title="Some {{ this.object }} View {{ this.viewId }}"` is
transformed into `"Some {{0}} View {{1}}"`

That way, expressions cannot be mistakenly translated in the string
received from the translation function.

task-6033548
@kebeclibre kebeclibre force-pushed the master-translate-tattf-lpe branch from d41a5b5 to 584abb5 Compare March 16, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant