From a1bbaef4689f4f6d6fcaa5332be447d24c1c72b2 Mon Sep 17 00:00:00 2001 From: Diego Rey <diego.despaux@izundo.com> Date: Sun, 25 Nov 2018 20:42:22 -0300 Subject: [PATCH] Add translations language for layout component --- Frontend Angular 4/src/app/layout/layout.component.ts | 4 +++- Frontend Angular 4/src/app/layout/layout.module.ts | 10 +++++++--- .../app/shared/components/header/header.component.html | 4 +++- .../shared/components/sidebar/sidebar.component.html | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Frontend Angular 4/src/app/layout/layout.component.ts b/Frontend Angular 4/src/app/layout/layout.component.ts index b81e4b8d..d2220813 100755 --- a/Frontend Angular 4/src/app/layout/layout.component.ts +++ b/Frontend Angular 4/src/app/layout/layout.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { GHCIService } from '../shared/services/ghci.service'; import { NotificacionService } from '../shared/services/notificacion.service'; +import { TranslateService } from '@ngx-translate/core'; + @Component({ selector: 'app-layout', templateUrl: './layout.component.html', @@ -9,7 +11,7 @@ import { NotificacionService } from '../shared/services/notificacion.service'; providers: [GHCIService] }) export class LayoutComponent implements OnInit { - constructor(public router: Router) { } + constructor(public router: Router, public translate: TranslateService) { } ngOnInit() { if (this.router.url === '/') { this.router.navigate(['/login']); diff --git a/Frontend Angular 4/src/app/layout/layout.module.ts b/Frontend Angular 4/src/app/layout/layout.module.ts index ab31a0b0..e3c702ba 100755 --- a/Frontend Angular 4/src/app/layout/layout.module.ts +++ b/Frontend Angular 4/src/app/layout/layout.module.ts @@ -9,7 +9,9 @@ import { HeaderComponent, SidebarComponent } from '../shared'; import { AuthenticationService } from '../shared/services/authentication.service'; import { HaskellService } from '../shared/services/haskell.service'; import { CodemirrorModule } from 'ng2-codemirror'; -import { NotificacionModule } from '../notificacion/notificacion.module'; +import { NotificacionModule } from '../notificacion/notificacion.module'; +import { I18nModule } from '../shared/modules/translate/i18n.module'; +import { TitleCaseModule } from '../shared/modules/titlecase.module'; @NgModule({ imports: [ @@ -18,12 +20,14 @@ import { NotificacionModule } from '../notificacion/notificacion.module'; NgbModule.forRoot(), LayoutRoutingModule, CodemirrorModule, - NotificacionModule + NotificacionModule, + I18nModule, + TitleCaseModule ], declarations: [ LayoutComponent, HeaderComponent, - SidebarComponent + SidebarComponent ], providers: [AuthenticationService, HaskellService] }) diff --git a/Frontend Angular 4/src/app/shared/components/header/header.component.html b/Frontend Angular 4/src/app/shared/components/header/header.component.html index 7b31ad18..3a577396 100755 --- a/Frontend Angular 4/src/app/shared/components/header/header.component.html +++ b/Frontend Angular 4/src/app/shared/components/header/header.component.html @@ -11,7 +11,9 @@ <i class="fa fa-user"></i> {{usuario.nombre+' '+usuario.apellido}}<b class="caret"></b> </a> <div class="dropdown-menu dropdown-menu-right"> - <a class="dropdown-item" style="cursor: pointer;" (click)=logout() ><i class="fa fa-fw fa-power-off"></i> Salir</a> + <a class="dropdown-item" style="cursor: pointer;" (click)=logout() ><i class="fa fa-fw fa-power-off"></i> + {{ "i18n.action.exit" | translate | titleCase }} + </a> </div> </div> </ul> diff --git a/Frontend Angular 4/src/app/shared/components/sidebar/sidebar.component.html b/Frontend Angular 4/src/app/shared/components/sidebar/sidebar.component.html index 15938e99..8b7f5eac 100755 --- a/Frontend Angular 4/src/app/shared/components/sidebar/sidebar.component.html +++ b/Frontend Angular 4/src/app/shared/components/sidebar/sidebar.component.html @@ -1,13 +1,13 @@ <nav class="sidebar" #sidebarNav [ngClass]="{sidebarPushRight: isActive}" style="background: #036b9a !important;"> <ul class="list-group"> <a [routerLink]="['/matefun']" (click)=toggleSidebar() [routerLinkActive]="['router-link-active']" class="list-group-item" style="color: white;"> - <i class="fa fa-fw fa-desktop"></i> Programa + <i class="fa fa-fw fa-desktop"></i> {{ "i18n.object.program" | translate | titleCase }} </a> <a [routerLink]="['/archivos']" (click)=toggleSidebar() [routerLinkActive]="['router-link-active']" class="list-group-item" style="color: white;"> - <i class="fa fa-fw fa-file-o"></i> Archivos + <i class="fa fa-fw fa-file-o"></i> {{ "i18n.object.files" | translate | titleCase }} </a> <a *ngIf="esDocente()" [routerLink]="['/grupos']" (click)=toggleSidebar() [routerLinkActive]="['router-link-active']" class="list-group-item" style="color: white;"> - <i class="fa fa-fw fa-users"></i> Grupos + <i class="fa fa-fw fa-users"></i> {{ "i18n.object.groups" | translate | titleCase }} </a> </ul> -- GitLab