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 93ff5fbb87f4c579c1b3a109235b3279d669238d..b7cf48c9853b37bc62b3dbcdc12caf344390f847 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 0b9ba75b141f1709ce55e08b00dbeb25fb119530..53015817a59f0daba86dc9bde5d7b64f7386147c 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); - }; }