From a519228856308e4f33a6648d824b48c166cf1193 Mon Sep 17 00:00:00 2001
From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr>
Date: Mon, 12 Feb 2024 14:46:09 +0100
Subject: [PATCH] LC: Add windows title translate.

---
 src/View/LateralContribution/Edit/Window.py    | 7 +++----
 src/View/LateralContribution/Edit/translate.py | 3 +++
 src/View/LateralContribution/Window.py         | 5 +++--
 src/View/LateralContribution/translate.py      | 4 ++++
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/View/LateralContribution/Edit/Window.py b/src/View/LateralContribution/Edit/Window.py
index 897703a4..49b7ea1b 100644
--- a/src/View/LateralContribution/Edit/Window.py
+++ b/src/View/LateralContribution/Edit/Window.py
@@ -54,15 +54,14 @@ class EditLateralContributionWindow(PamhyrWindow):
                  study=None, config=None,
                  parent=None):
         self._data = data
-        trad = LCETranslate()
 
-        name = self._pamhyr_name
+        trad = LCETranslate()
+        name = trad[self._pamhyr_name]
         if self._data is not None:
             edge_name = (self._data.edge.name if self._data.edge is not None
                          else _translate("LateralContribution",
                                          "Not associate"))
-            name = (
-                _translate("Edit lateral contribution", self._pamhyr_name) +
+            name += (
                 f" - {study.name} " +
                 f" - {self._data.name} ({self._data.id}) " +
                 f"({trad.get_dict('long_types')[self._data.lctype]} - " +
diff --git a/src/View/LateralContribution/Edit/translate.py b/src/View/LateralContribution/Edit/translate.py
index 9fc86e4d..4839a2da 100644
--- a/src/View/LateralContribution/Edit/translate.py
+++ b/src/View/LateralContribution/Edit/translate.py
@@ -27,6 +27,9 @@ _translate = QCoreApplication.translate
 class LCETranslate(LCTranslate):
     def __init__(self):
         super(LCETranslate, self).__init__()
+        self._dict["Edit lateral contribution"] = _translate(
+            "LateralContribution", "Edit lateral contribution"
+        )
 
         self._sub_dict["table_headers"] = {
             "x": _translate("LateralContribution", "X"),
diff --git a/src/View/LateralContribution/Window.py b/src/View/LateralContribution/Window.py
index a6f04af5..e5b6fb27 100644
--- a/src/View/LateralContribution/Window.py
+++ b/src/View/LateralContribution/Window.py
@@ -68,12 +68,13 @@ class LateralContributionWindow(PamhyrWindow):
     _pamhyr_name = "Lateral contribution"
 
     def __init__(self, study=None, config=None, parent=None):
-        name = self._pamhyr_name + " - " + study.name
+        trad = LCTranslate()
+        name = trad[self._pamhyr_name] + " - " + study.name
 
         super(LateralContributionWindow, self).__init__(
             title=name,
             study=study,
-            trad=LCTranslate(),
+            trad=trad,
             config=config,
             parent=parent
         )
diff --git a/src/View/LateralContribution/translate.py b/src/View/LateralContribution/translate.py
index f005a063..d645137d 100644
--- a/src/View/LateralContribution/translate.py
+++ b/src/View/LateralContribution/translate.py
@@ -38,6 +38,10 @@ class LCTranslate(PamhyrTranslate):
     def __init__(self):
         super(LCTranslate, self).__init__()
 
+        self._dict["Lateral contribution"] = _translate(
+            "LateralContribution", "Lateral contribution"
+        )
+
         self._sub_dict["long_types"] = {
             "ND": _translate("LateralContribution", "Not defined"),
             "LC": _translate("LateralContribution", "Lateral contribution"),
-- 
GitLab