Skip to content

Conversation

@fw-bot
Copy link
Contributor

@fw-bot fw-bot commented 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:
'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 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: #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

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
@robodoo
Copy link
Contributor

robodoo commented Jan 25, 2025

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Jan 25, 2025

@HydrionBurst @rco-odoo this PR targets master and is the last of the forward-port chain.

To merge the full chain, use

@robodoo r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Jan 25, 2025
@C3POdoo C3POdoo added the RD research & development, internal work label Jan 25, 2025
@HydrionBurst
Copy link
Contributor

@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>
@robodoo robodoo added the 18.2 label Jan 25, 2025
@robodoo robodoo closed this Jan 25, 2025
@fw-bot fw-bot deleted the master-saas-17.2-disable-upgrade-xml-typofix-cwg-Mpbf-fw branch February 8, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

18.2 forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants