From bd8ff4cb1d61dcf70e224b549caf2b3ef3caeba7 Mon Sep 17 00:00:00 2001
From: "Mehdi Outagant (MOU)"
Date: Fri, 11 Apr 2025 17:18:30 +0200
Subject: [PATCH] [FIX] theme_*: translate paragraph links as a whole.
*: artists, cobalt, enark, graphene, kea, kiddo, loftspace, monglia, nano,
notes, odoo_experts, orchid, paptic, real_estate, vehicle, yes
Steps to reproduce:
1. Enable a second language in the website (e.g., French).
2. Add a "Text" block (in edit mode) > Save the page.
3. Translate a text paragraph to french > Save.
4. In edit mode again, add a link to a word in the paragraph > Save.
5. The translation in French is lost, and sometimes the whole French
translation is used for the text before or after the link.
This is actually a limitation in the translation implementation. If we
initially have `text_1_en text_2_en text_3_en` translated to French this
way:
terms en_US: `["text_1_en text_2_en text_3_en"]`
terms fr_BE: `["text_1_fr text_2_fr text_3_fr"]`
After adding a link: `text_1_entext_2_entext_3_en`, and since
the links are not translated as a whole, we should get:
terms en_US: `["text_1_en", "text_2_en", "text_3_en"]`
terms fr_BE: `["text_1_fr text_2_fr text_3_fr"]`
Which means the current translation will be lost, and the result will
depend on the outcome of `get_close_matches()`. Which explains why when
the link is added to the first words of the paragraph, the system still
maps the rest of the paragraph to its "full old translation".
The goal of this commit is to make this behavior less aggressive by
forcing the links added in paragraphs [1] to be translated as a whole.
This way, the `get_close_matches()` will map the new content with a link
to its old translation (without a link), and then, the user can set the
link in the "the most meaningful part of the translation" in the
translate mode.
[1]: We should use the "translate as a whole" feature carefully with
links, since there are already some situations where it's causing
issues (see the fix in [2]). So we only force them inside paragraphs.
[2]: https://github.com/odoo/odoo/commit/9bd60ca93510e410a0136b8b433f596330900593
Remark: This commit also sets the `o_translate_inline` class by default
on paragraph links in website templates.
opw-3984439
closes odoo/design-themes#1055
Related: odoo/odoo#204453
Signed-off-by: Outagant Mehdi (mou)
---
theme_artists/views/snippets/s_carousel.xml | 6 +++---
theme_artists/views/snippets/s_three_columns.xml | 6 +++---
theme_cobalt/views/customizations.xml | 2 +-
theme_enark/views/snippets/s_numbers_list.xml | 2 +-
theme_graphene/views/customizations.xml | 2 +-
theme_kea/views/snippets/s_cover.xml | 2 +-
theme_kiddo/views/snippets/s_call_to_action.xml | 2 +-
theme_loftspace/views/snippets/s_call_to_action.xml | 2 +-
theme_monglia/views/customizations.xml | 4 ++--
theme_nano/views/snippets/s_discovery.xml | 2 +-
theme_notes/views/snippets/s_carousel.xml | 4 ++--
theme_notes/views/snippets/s_three_columns.xml | 6 +++---
theme_odoo_experts/views/snippets/s_picture.xml | 2 +-
theme_orchid/views/snippets/s_framed_intro.xml | 2 +-
theme_paptic/views/customizations.xml | 2 +-
theme_real_estate/views/snippets/s_image_text.xml | 2 +-
theme_vehicle/views/customizations.xml | 6 +++---
theme_yes/views/snippets/s_freegrid.xml | 2 +-
theme_yes/views/snippets/s_masonry_block.xml | 8 ++++----
19 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/theme_artists/views/snippets/s_carousel.xml b/theme_artists/views/snippets/s_carousel.xml
index be0b63cbe..f491551b7 100644
--- a/theme_artists/views/snippets/s_carousel.xml
+++ b/theme_artists/views/snippets/s_carousel.xml
@@ -8,7 +8,7 @@
Aquitani
Photoshoot / June 2021
- Discover
+ Discover
@@ -27,7 +27,7 @@
Immemorabili
Painting concept / April 2021
- Discover
+ Discover
@@ -46,7 +46,7 @@
Vincam
Typographic collection / March 2021
- Discover
+ Discover
diff --git a/theme_artists/views/snippets/s_three_columns.xml b/theme_artists/views/snippets/s_three_columns.xml
index de0310727..63cbb4710 100644
--- a/theme_artists/views/snippets/s_three_columns.xml
+++ b/theme_artists/views/snippets/s_three_columns.xml
@@ -24,7 +24,7 @@
- More details
+ More details
@@ -44,7 +44,7 @@
- Discover
+ Discover
@@ -64,7 +64,7 @@
- Contact me
+ Contact me
diff --git a/theme_cobalt/views/customizations.xml b/theme_cobalt/views/customizations.xml
index 88531a8ae..bbbaba186 100644
--- a/theme_cobalt/views/customizations.xml
+++ b/theme_cobalt/views/customizations.xml
@@ -91,7 +91,7 @@
Web & App Development
We have collected solid experience in building native and cross-platform mobile applications and websites. Check our portfolio from clients around the world.
- Learn more
+ Learn more
diff --git a/theme_enark/views/snippets/s_numbers_list.xml b/theme_enark/views/snippets/s_numbers_list.xml
index 4df2e3a77..43fb9dfb7 100644
--- a/theme_enark/views/snippets/s_numbers_list.xml
+++ b/theme_enark/views/snippets/s_numbers_list.xml
@@ -4,7 +4,7 @@
- More details
+ More details
diff --git a/theme_graphene/views/customizations.xml b/theme_graphene/views/customizations.xml
index d0da54d88..55f13075f 100644
--- a/theme_graphene/views/customizations.xml
+++ b/theme_graphene/views/customizations.xml
@@ -22,7 +22,7 @@
Our mission is to give customers the best experience.
Extensive documentation & guides, an active community,
24/7 support make it a pleasure to work with us.
- Contact us
+ Contact us
diff --git a/theme_kea/views/snippets/s_cover.xml b/theme_kea/views/snippets/s_cover.xml
index 987e9935c..b5757b740 100644
--- a/theme_kea/views/snippets/s_cover.xml
+++ b/theme_kea/views/snippets/s_cover.xml
@@ -25,7 +25,7 @@
- Discover more
+ Discover more
diff --git a/theme_kiddo/views/snippets/s_call_to_action.xml b/theme_kiddo/views/snippets/s_call_to_action.xml
index e656651b5..3b6630c55 100644
--- a/theme_kiddo/views/snippets/s_call_to_action.xml
+++ b/theme_kiddo/views/snippets/s_call_to_action.xml
@@ -19,7 +19,7 @@
2,000 parents
brought their kid to our nursery.
Entrust us with your children and go to work with peace of mind
- Contact us
+ Contact us
diff --git a/theme_loftspace/views/snippets/s_call_to_action.xml b/theme_loftspace/views/snippets/s_call_to_action.xml
index 98b27f60e..5cd062008 100644
--- a/theme_loftspace/views/snippets/s_call_to_action.xml
+++ b/theme_loftspace/views/snippets/s_call_to_action.xml
@@ -27,7 +27,7 @@
- Our services
+ Our services
diff --git a/theme_monglia/views/customizations.xml b/theme_monglia/views/customizations.xml
index c04b64d78..84842357f 100644
--- a/theme_monglia/views/customizations.xml
+++ b/theme_monglia/views/customizations.xml
@@ -181,7 +181,7 @@
- Learn more
+ Learn more
@@ -227,7 +227,7 @@
This is the first full-length studio release in seven years for the British singer-songwriter.
- Discover
+ Discover
diff --git a/theme_nano/views/snippets/s_discovery.xml b/theme_nano/views/snippets/s_discovery.xml
index 8d7187003..7a4cf96e9 100644
--- a/theme_nano/views/snippets/s_discovery.xml
+++ b/theme_nano/views/snippets/s_discovery.xml
@@ -21,7 +21,7 @@
- Get Started
+ Get Started
diff --git a/theme_notes/views/snippets/s_carousel.xml b/theme_notes/views/snippets/s_carousel.xml
index 8afc2a13b..b8b5b2fb4 100644
--- a/theme_notes/views/snippets/s_carousel.xml
+++ b/theme_notes/views/snippets/s_carousel.xml
@@ -26,7 +26,7 @@
6 Days Pass
Tickets will be on sale soon. Do not miss our 6 Days Pass. Free camping!
- More Info
+ More Info
@@ -38,7 +38,7 @@
Recent Editions
Discover what makes the reputation of the Miraillet festival through these after-movies.
- More Info
+ More Info
diff --git a/theme_notes/views/snippets/s_three_columns.xml b/theme_notes/views/snippets/s_three_columns.xml
index b66bffe38..97b5fe8e1 100644
--- a/theme_notes/views/snippets/s_three_columns.xml
+++ b/theme_notes/views/snippets/s_three_columns.xml
@@ -31,7 +31,7 @@
- Get your tickets
+ Get your tickets
@@ -51,7 +51,7 @@
- Get your tickets
+ Get your tickets
@@ -66,7 +66,7 @@
Tour Grand Final.
- Get your tickets
+ Get your tickets
diff --git a/theme_odoo_experts/views/snippets/s_picture.xml b/theme_odoo_experts/views/snippets/s_picture.xml
index c906e1106..a353205c8 100644
--- a/theme_odoo_experts/views/snippets/s_picture.xml
+++ b/theme_odoo_experts/views/snippets/s_picture.xml
@@ -28,7 +28,7 @@
- Contact Us
+ Contact Us
diff --git a/theme_orchid/views/snippets/s_framed_intro.xml b/theme_orchid/views/snippets/s_framed_intro.xml
index 8383f5989..e73dddd45 100644
--- a/theme_orchid/views/snippets/s_framed_intro.xml
+++ b/theme_orchid/views/snippets/s_framed_intro.xml
@@ -24,7 +24,7 @@
- See the Full Bloom
+ See the Full Bloom
About Us
diff --git a/theme_paptic/views/customizations.xml b/theme_paptic/views/customizations.xml
index ff6742471..11703e1dd 100644
--- a/theme_paptic/views/customizations.xml
+++ b/theme_paptic/views/customizations.xml
@@ -35,7 +35,7 @@
- Our solutions
+ Our solutions
diff --git a/theme_real_estate/views/snippets/s_image_text.xml b/theme_real_estate/views/snippets/s_image_text.xml
index 657568e7b..8520b3c7f 100644
--- a/theme_real_estate/views/snippets/s_image_text.xml
+++ b/theme_real_estate/views/snippets/s_image_text.xml
@@ -15,7 +15,7 @@
Discover our tailor-made services to embellish the decoration of your home.
- Explore our services
+ Explore our services
diff --git a/theme_vehicle/views/customizations.xml b/theme_vehicle/views/customizations.xml
index 8b82a36f9..c8153de45 100644
--- a/theme_vehicle/views/customizations.xml
+++ b/theme_vehicle/views/customizations.xml
@@ -300,21 +300,21 @@
- Configure
+ Configure
From $14,000
- Configure
+ Configure
From $19,000
- Configure
+ Configure
From $25,000
diff --git a/theme_yes/views/snippets/s_freegrid.xml b/theme_yes/views/snippets/s_freegrid.xml
index a94e9a43d..c6556cdfd 100644
--- a/theme_yes/views/snippets/s_freegrid.xml
+++ b/theme_yes/views/snippets/s_freegrid.xml
@@ -37,7 +37,7 @@
Discover some of the latest
moments we helped to create
- View all the pictures
+ View all the pictures
diff --git a/theme_yes/views/snippets/s_masonry_block.xml b/theme_yes/views/snippets/s_masonry_block.xml
index e2fac5f0c..a38395974 100644
--- a/theme_yes/views/snippets/s_masonry_block.xml
+++ b/theme_yes/views/snippets/s_masonry_block.xml
@@ -10,7 +10,7 @@
Check out our list of favorite caterers.
- Find a Caterer
+ Find a Caterer
@@ -20,7 +20,7 @@
Check out our carefully curated list of favorite venues.
- Find a venue
+ Find a venue
@@ -30,7 +30,7 @@
Find the perfect outfit for before, during and after the main event.
- Shop
+ Shop
@@ -40,7 +40,7 @@
Find the answers to all your questions in our FAQ.
- Go to FAQ
+ Go to FAQ