Content-Length: 293825 | pFad | http://github.com/odoo/odoo/pull/192096

5E [FIX] core: update attributes of non-text items by aj-fuentes · Pull Request #192096 · odoo/odoo · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] core: update attributes of non-text items #192096

Closed
wants to merge 1 commit into from

Conversation

aj-fuentes
Copy link
Contributor

We cannot skip the update always. It is only safe to do so when the
element is text, in other cases we still need to update the attributes
to avoid upgrade issues.

For example, this term
https://github.com/odoo/odoo/blame/03434f42d2b1d96d2cf8315154f16f9fa01c1ae3/addons/account/i18n/fr.po#L1129
which at the time of this patch has no translation yet, won't be updated
even if we add the right translation

msgid ""
"<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>"
msgstr ""
"<span invisible=\"name or name_placeholder or quick_edit_mode\">Brouillon</span>"

The reason is that the check

if closest_term in translation_dictionary:
    continue

would skip the update. Here we propose to restrict the skip only to text
elements.


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Dec 31, 2024

Pull request status dashboard

@aj-fuentes
Copy link
Contributor Author

I tested it locally and it passes the test in 463136f

@C3POdoo C3POdoo requested review from a team and xmo-odoo and removed request for a team December 31, 2024 12:59
@C3POdoo C3POdoo added the RD research & development, internal work label Dec 31, 2024
@aj-fuentes aj-fuentes force-pushed the 18.0-fix_load_translation-afu branch from fe1a675 to 9f63b96 Compare January 2, 2025 08:31
@aj-fuentes aj-fuentes changed the title [FIX] core: ensure we update attributes of non-text items [FIX] core: update attributes of non-text items Jan 2, 2025
@HydrionBurst
Copy link
Contributor

before upgrade there was a term "Draft" translated to "Brouillon"

when write with new value during upgrade
the old term "Draft" is handled for typofixing

In the new value
the new term "<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>" has the same text as the old term

So, the old translation "Brouillon" will be used as the fr_FR value for the new term "<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>"
and when importing the po files, since the overwrite=False, the new term "<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>" will be treated as translated value and won't use the translation in the po files

As a result
after upgrade the fr_FR translation for the new term "<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>" will be "Brouillon"

I propose something like PR: #193229 as a fix which will revert an old fix by you
The idea is totally disabling the typofixing logic when upgrade. When the en_US value is changed, we always clear the translations and rely on the latest po files to update corresponding translations

@aj-fuentes
Copy link
Contributor Author

Well if we can disable the whole feature then that's great. The whole point of previous patches (and this one) was to not disable it. But given how many issues this has proved to cause I'm OK with disabling it. That being said, I'm not sure what new issues this could cause to existing custom translations that are now kind of reused but that won't be any more. I cannot produce a clear example but I bet there would be some in upgrades.

We cannot skip the update always. It is only safe to do so when the
element is text, in other cases we still need to update the attributes
to avoid upgrade issues.

For example, this term
https://github.com/odoo/odoo/blame/03434f42d2b1d96d2cf8315154f16f9fa01c1ae3/addons/account/i18n/fr.po#L1129
which at the time of this patch has no translation yet, won't be updated
even if we add the right translation
```
msgid ""
"<span invisible=\"name or name_placeholder or quick_edit_mode\">Draft</span>"
msgstr ""
"<span invisible=\"name or name_placeholder or quick_edit_mode\">Brouillon</span>"
```

The reason is that the check
```py
if closest_term in translation_dictionary:
    continue
```
would skip the update. Here we propose to restrict the skip only to text
elements.

This issue is affecting many upgrdes to 18.0. opw-4440528
@aj-fuentes aj-fuentes force-pushed the 18.0-fix_load_translation-afu branch from 9f63b96 to 9275cb8 Compare January 15, 2025 08:11
@aj-fuentes
Copy link
Contributor Author

A patch has been done in upgrade repo. A general fix based on #193229 will be done soon.

@aj-fuentes aj-fuentes closed this Jan 15, 2025
@HydrionBurst
Copy link
Contributor

A https://github.com/odoo/upgrade/pull/7068 has been done in upgrade repo. A general fix based on #193229 will be done soon.

move to #193708

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/odoo/odoo/pull/192096

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy