-
Notifications
You must be signed in to change notification settings - Fork 30.1k
[FW][FW][FIX] core: inherit translations better when upgrade #195170
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
Closed
fw-bot
wants to merge
1
commit into
odoo:master
from
odoo-dev:master-saas-17.2-disable-upgrade-xml-typofix-cwg-Mpbf-fw
Closed
[FW][FW][FIX] core: inherit translations better when upgrade #195170
fw-bot
wants to merge
1
commit into
odoo:master
from
odoo-dev:master-saas-17.2-disable-upgrade-xml-typofix-cwg-Mpbf-fw
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before:
The typofix feature treats terms in the old and new values with similar text
content as the same term, migrating the translations of the old term to the new
term.
For example
The old value has the mapping:
'Draft': 'Brouillon'
The new value contains the term:
'<span invisible="name or name_placeholder or quick_edit_mode">Draft</span>'
Since the old term and the new term share the same text content, 'Draft', after
`write`, the new term reuses the old translation of 'Draft'. However, the
translation 'Brouillon' is always visible, unlike its en_US counterpart.
This behavior is acceptable in non-upgrade mode because the user writes the
en_US value and is responsible for verifying translations afterward. However, it
is problematic during upgrades because users cannot easily identify which
records have changed and need to be rechecked.
After:
'state' is removed from MODIFIER_ATTRS since it is not customized by Odoo
The translation inheritance behavior can be described as below
Translations can be inherited after `write` from old terms to new terms which
share the very close text contents
1. when `write` in production mode, text contents for translation terms are more
important than the HTML/XML structures of them, and the old term translations
should be remained as much as possible. Because
* the writing user is responsible to recheck all translations after `write`.
* it is easier for the writing user to copy technical HTML/XML structures
than translate text contents for a language they may not know.
* the feature can also be used as typofix when the only small diff is the
text content
2. when `write` in upgrade time, the HTML/XML structure is more important than
the text content, and the new term structure should be remained as much as
possible. Because
* HTML/XML structures might be changed a lot after upgrade, which may
contain behavior relevant diff (e.g. `invisible`), even if text contents
are not changed.
* users have no idea which records' values are changed during upgrade and
are hard to recheck their translations.
* new terms are highly likely to be correctly translated in the latest po
files which will be imported during upgrade.
* the typofix feature can still be remained when the only small diff is the
text content
Based on the above feature analysis, we use the below new strategy
1. translations can be inherited only if the old source term and the new source
term share the same HTML/XML structure
2. translations can be inherited only if the old translation term and the new
source term share the same HTML/XML structure
3. when translations are inherited, MODIFIER_ATTRS will be synchronized with
the new source term, other attributes will be copied from the source term if
available.
Forward-port-of: odoo#194181
X-original-commit: 1f90957
|
@HydrionBurst @rco-odoo this PR targets master and is the last of the forward-port chain. To merge the full chain, use
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
|
@robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
Jan 25, 2025
Before:
The typofix feature treats terms in the old and new values with similar text
content as the same term, migrating the translations of the old term to the new
term.
For example
The old value has the mapping:
'Draft': 'Brouillon'
The new value contains the term:
'<span invisible="name or name_placeholder or quick_edit_mode">Draft</span>'
Since the old term and the new term share the same text content, 'Draft', after
`write`, the new term reuses the old translation of 'Draft'. However, the
translation 'Brouillon' is always visible, unlike its en_US counterpart.
This behavior is acceptable in non-upgrade mode because the user writes the
en_US value and is responsible for verifying translations afterward. However, it
is problematic during upgrades because users cannot easily identify which
records have changed and need to be rechecked.
After:
'state' is removed from MODIFIER_ATTRS since it is not customized by Odoo
The translation inheritance behavior can be described as below
Translations can be inherited after `write` from old terms to new terms which
share the very close text contents
1. when `write` in production mode, text contents for translation terms are more
important than the HTML/XML structures of them, and the old term translations
should be remained as much as possible. Because
* the writing user is responsible to recheck all translations after `write`.
* it is easier for the writing user to copy technical HTML/XML structures
than translate text contents for a language they may not know.
* the feature can also be used as typofix when the only small diff is the
text content
2. when `write` in upgrade time, the HTML/XML structure is more important than
the text content, and the new term structure should be remained as much as
possible. Because
* HTML/XML structures might be changed a lot after upgrade, which may
contain behavior relevant diff (e.g. `invisible`), even if text contents
are not changed.
* users have no idea which records' values are changed during upgrade and
are hard to recheck their translations.
* new terms are highly likely to be correctly translated in the latest po
files which will be imported during upgrade.
* the typofix feature can still be remained when the only small diff is the
text content
Based on the above feature analysis, we use the below new strategy
1. translations can be inherited only if the old source term and the new source
term share the same HTML/XML structure
2. translations can be inherited only if the old translation term and the new
source term share the same HTML/XML structure
3. when translations are inherited, MODIFIER_ATTRS will be synchronized with
the new source term, other attributes will be copied from the source term if
available.
closes #195170
Forward-port-of: #194181
X-original-commit: 1f90957
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Chong Wang (cwg) <cwg@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Before:
The typofix feature treats terms in the old and new values with similar text content as the same term, migrating the translations of the old term to the new term.
For example
The old value has the mapping:
'Draft': 'Brouillon'
The new value contains the term:
'Draft'
Since the old term and the new term share the same text content, 'Draft', after
write, the new term reuses the old translation of 'Draft'. However, the translation 'Brouillon' is always visible, unlike its en_US counterpart.This behavior is acceptable in non-upgrade mode because the user writes the en_US value and is responsible for verifying translations afterward. However, it is problematic during upgrades because users cannot easily identify which records have changed and need to be rechecked.
After:
The translation inheritance behavior can be described as below Translations can be inherited after
writefrom old terms to new terms which share the very close text contentswritein production mode, text contents for translation terms are more important than the HTML/XML structures of them, and the old term translations should be remained as much as possible. Becausewrite.writein upgrade time, the HTML/XML structure is more important than the text content, and the new term structure should be remained as much as possible. Becauseinvisible), even if text contents are not changed.Based on the above feature analysis, we use the below new strategy
Forward-Port-Of: #194181
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #195079
Forward-Port-Of: #194816