From 1a4082eb5d09aabd1968729d0051dddf19a6becf Mon Sep 17 00:00:00 2001
From: ncamera <nico_camera98@hotmail.com>
Date: Wed, 9 Nov 2022 22:23:02 -0300
Subject: [PATCH] Arreglar traducciones en graph3D

---
 .../plotter/graph3D/graph3D.component.html    |  6 ++--
 .../plotter/graph3D/graph3D.component.ts      | 34 +++++++------------
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.html b/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.html
index 93ff5fb..b7cf48c 100755
--- a/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.html	
+++ b/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.html	
@@ -7,7 +7,8 @@
         style="min-width: 70px"
         (click)="changeZoomType()"
       >
-        {{ getZoom3DTypeName(graphProps.zoomType) }}
+        {{ translationTypes[graphProps.zoomType] | translate | titleCase
+        }}{{ translationTypesSuffix[graphProps.zoomType] }}
       </button>
       <div
         class="btn-group"
@@ -26,7 +27,8 @@
             [disabled]="type === graphProps.zoomType"
             (click)="changeZoomType(type)"
           >
-            {{ getZoom3DTypeName(type) }}
+            {{ translationTypes[type] | translate | titleCase
+            }}{{ translationTypesSuffix[type] }}
           </button>
         </div>
       </div>
diff --git a/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.ts b/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.ts
index 0b9ba75..5301581 100755
--- a/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.ts	
+++ b/Frontend Angular 4/src/app/layout/plotter/graph3D/graph3D.component.ts	
@@ -30,19 +30,29 @@ import { TitleCasePipe } from "../../../shared/pipes/titlecase.pipe";
 export class Graph3DComponent implements AfterViewInit {
   private ghciServiceSub: any;
 
-  private translateService: any;
-  private titlecasePipe: any;
+  translateService: any;
+  titlecasePipe: any;
 
   /**
    * Diccionario de traducciones para los tipos de Zoom.
    */
-  private translationTypes = {
+  translationTypes = {
     [Zoom3DType.Normal]: "i18n.object.normal",
     [Zoom3DType.XAxis]: "i18n.object.axis",
     [Zoom3DType.YAxis]: "i18n.object.axis",
     [Zoom3DType.ZAxis]: "i18n.object.axis",
   };
 
+  /**
+   * Diccionario para complementar las traducciones de los tipos de Zoom.
+   */
+  translationTypesSuffix = {
+    [Zoom3DType.Normal]: "",
+    [Zoom3DType.XAxis]: " X",
+    [Zoom3DType.YAxis]: " Y",
+    [Zoom3DType.ZAxis]: " Z",
+  };
+
   @ViewChild("graph3DElement", { static: true })
   private graph3DRef: ElementRef;
 
@@ -206,22 +216,4 @@ export class Graph3DComponent implements AfterViewInit {
 
     graph3DLib.reset();
   };
-
-  public getZoom3DTypeName = (type: Zoom3DType) => {
-    let translation: string;
-
-    this.translateService.get(this.translationTypes[type]).subscribe((res) => {
-      translation = res;
-    });
-
-    if (type == 2) {
-      translation += " x";
-    } else if (type == 3) {
-      translation += " y";
-    } else if (type == 4) {
-      translation += " z";
-    }
-
-    return this.titlecasePipe.transform(translation);
-  };
 }
-- 
GitLab