From ad2ca9414fbc846598ef1f233bc0c476e1c9def1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Thu, 8 Dec 2022 14:05:06 +0100
Subject: [PATCH] fix: fish ladder graphs: "message not found" in legend

refs #584
---
 src/app/calculators/pab/en.json                               | 1 +
 src/app/calculators/pab/fr.json                               | 3 ++-
 .../pab-profile-chart/pab-profile-chart.component.ts          | 4 +++-
 src/app/services/formulaire.service.ts                        | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/app/calculators/pab/en.json b/src/app/calculators/pab/en.json
index d3fda007d..a9360eb6c 100644
--- a/src/app/calculators/pab/en.json
+++ b/src/app/calculators/pab/en.json
@@ -4,6 +4,7 @@
     "Q": "Flow",
     "Z1": "Upstream elevation",
     "Z2": "Downstream elevation",
+    "ZW": "Water line (m)",
 
     "Z": "Water elevation",
     "LB": "Basin length",
diff --git a/src/app/calculators/pab/fr.json b/src/app/calculators/pab/fr.json
index d951248b7..68b983df6 100644
--- a/src/app/calculators/pab/fr.json
+++ b/src/app/calculators/pab/fr.json
@@ -4,6 +4,7 @@
     "Q": "Débit",
     "Z1": "Cote amont",
     "Z2": "Cote aval",
+    "ZW": "Ligne d'eau (m)",
 
     "Z": "Cote de l'eau",
     "LB": "Longueur du bassin",
@@ -29,4 +30,4 @@
     "UNIT_H1": "m",
     "UNIT_H2": "m",
     "UNIT_SUBMERGENCE": "%"
-}
\ No newline at end of file
+}
diff --git a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts
index 5bbc25c8f..c8eff7ec5 100644
--- a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts
+++ b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts
@@ -16,6 +16,7 @@ import { CalculatorResults } from 'app/results/calculator-results';
 
 import zoomPlugin from 'chartjs-plugin-zoom';
 import { Chart } from "chart.js";
+import { FormulaireService } from "app/services/formulaire.service";
 
 @Component({
     selector: "pab-profile-chart",
@@ -70,6 +71,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen
 
     public constructor(
         private intlService: I18nService,
+        private formService: FormulaireService,
         private cd: ChangeDetectorRef
     ) {
         super();
@@ -444,7 +446,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen
                 label: (
                     this._results.variatedParameters.length > 0 ?
                     this.getLegendForSeries(n) :
-                    this.intlService.localizeText("INFO_LIB_ZW") // ligne d'eau
+                        this.formService.localizeText("ZW", this.formService.currentForm.calculatorType) // ligne d'eau
                 ),
                 color: palette[ n % palette.length ]
             });
diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts
index 19022be0b..5c29f442d 100644
--- a/src/app/services/formulaire.service.ts
+++ b/src/app/services/formulaire.service.ts
@@ -602,7 +602,7 @@ export class FormulaireService extends Observable {
         }
     }
 
-    private get currentForm(): FormulaireDefinition {
+    public get currentForm(): FormulaireDefinition {
         return this.getFormulaireFromId(this._currentFormId);
     }
 
-- 
GitLab