Ajout des traductions

This commit is contained in:
Sébastien André
2021-05-31 11:26:54 +02:00
parent 0833930135
commit 03cf10e69c
17 changed files with 251 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
<div class="content">
<div>
<button mat-raised-button color="accent" [routerLink]="['/newjump']" [routerLinkActive]="['active']" skipLocationChange>Add jumps</button>
<button mat-raised-button color="accent" [routerLink]="['/newjump']" [routerLinkActive]="['active']" skipLocationChange>{{ 'List_Jump_Add' | translate }}</button>
</div>
<div *ngIf="dataSourceTable != null else loading">
<table mat-table [dataSource]="dataSourceTable">
@@ -15,42 +15,42 @@
</ng-container>
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef style="min-width: 70px;">Num</th>
<th mat-header-cell *matHeaderCellDef style="min-width: 70px;">{{ 'List_Jump_Header_Num' | translate }}</th>
<td mat-cell *matCellDef="let element; let i = index">
{{ resultsLength - ( (dataSourceTable.paginator.pageIndex * dataSourceTable.paginator.pageSize ) + i ) }}
</td>
</ng-container>
<ng-container matColumnDef="jumpDate">
<th mat-header-cell *matHeaderCellDef>Date</th>
<th mat-header-cell *matHeaderCellDef>{{ 'List_Jump_Header_Date' | translate }}</th>
<td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpDate | date: 'yyyy-MM-dd'"></span>
</td>
</ng-container>
<ng-container matColumnDef="jumpType">
<th mat-header-cell *matHeaderCellDef style="min-width: 100px;">Jump Type</th>
<th mat-header-cell *matHeaderCellDef style="min-width: 100px;">{{ 'List_Jump_Header_JumpType' | translate }}</th>
<td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span>
</td>
</ng-container>
<ng-container matColumnDef="aircraft">
<th mat-header-cell *matHeaderCellDef style="min-width: 110px;">Aircraft</th>
<th mat-header-cell *matHeaderCellDef style="min-width: 110px;">{{ 'List_Jump_Header_Aircraft' | translate }}</th>
<td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.aircraft.name"></span>
</td>
</ng-container>
<ng-container matColumnDef="dropZone">
<th mat-header-cell *matHeaderCellDef>Drop Zone</th>
<th mat-header-cell *matHeaderCellDef>{{ 'List_Jump_Header_Dz' | translate }}</th>
<td mat-cell *matCellDef="let element">
<span class="spanWithBreakWord" [innerHTML]="element.dropZone.name"></span>
</td>
</ng-container>
<ng-container matColumnDef="gear">
<th mat-header-cell *matHeaderCellDef>Gear</th>
<th mat-header-cell *matHeaderCellDef>{{ 'List_Jump_Header_Id' | translate }}</th>
<td mat-cell *matCellDef="let element">{{element.gear.name}}</td>
</ng-container>

View File

@@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from "@angular/material/dialog";
import { Observable } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { AddAction } from '../../models/add-action.enum';
import { Jump } from '../../models/jump';
@@ -31,7 +31,8 @@ export class ListOfJumpsComponent implements OnInit {
constructor(private serviceApi: JumpService,
private serviceComm: ServiceComm,
public dialog: MatDialog) { }
public dialog: MatDialog,
private translateService: TranslateService) { }
ngOnInit() {
this.serviceComm.refreshRequest.subscribe(action => {
@@ -40,7 +41,13 @@ export class ListOfJumpsComponent implements OnInit {
this.getListOfJumps();
}
});
this.serviceComm.UpdatedComponentTitle('List of jumps');
this.serviceComm.forceTranslateTitle.subscribe((data)=> {
if (data === true){
this.updateTitle();
}
});
this.updateTitle();
this.getListOfJumps();
}
@@ -79,4 +86,10 @@ export class ListOfJumpsComponent implements OnInit {
this.serviceApi.DeleteJump(item);
}
private updateTitle() {
this.translateService.get("ListJumps_Title").subscribe(
data => { this.serviceComm.UpdatedComponentTitle(data); }
);
}
}