Add more i18n strings

pull/46/head
HardiReady 2018-10-03 11:22:21 +02:00
parent 37eab6f33d
commit 8ad9000766
9 changed files with 75 additions and 52 deletions

View File

@ -74,7 +74,9 @@ export class CampaignPlayerDetailComponent implements OnInit {
for (let i = 0; i < this.playerAttributeNameMap.length; i++) {
const attr = this.playerAttributeNameMap[i];
this.graphData.push({key: attr.prop, label: attr.head});
this.translate.get(attr.head).subscribe((translated) => {
this.graphData.push({key: attr.prop, label: translated});
});
}
this.initDataArray();

View File

@ -2,14 +2,14 @@
<div class="input-group search-field">
<input id="search-tasks"
markForCheck
placeholder="Spielername (mehrere mit '&' trennen)"
placeholder="{{'stats.highscore.filter.placholder' | translate}}"
type="text" #query class="form-control"
(keyup.enter)="filterPlayers()"
[formControl]="searchTerm">
<span class="input-group-btn">
<button class="btn btn-default" type="button"
(click)="filterPlayers()">
Filter
{{'stats.highscore.filter.button' | translate}}
</button>
</span>
</div>
@ -26,7 +26,7 @@
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<th mat-header-cell *matHeaderCellDef>{{'stats.highscore.header.name' | translate}}</th>
<td mat-cell *matCellDef="let element"
[style.color]="element['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{element.name}}
@ -36,7 +36,7 @@
<ng-container matColumnDef="{{attributeMap.prop}}">
<th mat-header-cell *matHeaderCellDef>
<mat-icon svgIcon="{{attributeMap.prop}}"
matTooltip="{{attributeMap.head}}">
matTooltip="{{attributeMap.head | translate}}">
</mat-icon>
</th>
<td mat-cell *matCellDef="let element"> {{element[attributeMap.prop]}}</td>

View File

@ -7,7 +7,7 @@
class="mat-elevation-z8">
<ng-container matColumnDef="{{tableHead[0].prop}}">
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{tableHead[0].prop}}">{{tableHead[0].head}}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{tableHead[0].prop}}">{{tableHead[0].head | translate}}</th>
<td mat-cell *matCellDef="let element"
[style.color]="element['fraction'] === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
{{element.name}}
@ -15,14 +15,14 @@
</ng-container>
<ng-container matColumnDef="{{tableHead[1].prop}}">
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{tableHead[1].prop}}">{{tableHead[1].head}}</th>
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{tableHead[1].prop}}">{{tableHead[1].head | translate}}</th>
<td mat-cell *matCellDef="let element">{{element.fraction === 'BLUFOR' ? fraction.BLUFOR : fraction.OPFOR}}</td>
</ng-container>
<ng-container *ngFor="let column of tableHead.slice(2, tableHead.length)" matColumnDef="{{column.prop}}">
<th mat-header-cell *matHeaderCellDef mat-sort-header="{{column.prop}}">
<mat-icon svgIcon="{{column.prop}}"
matTooltip="{{column.head}}">
matTooltip="{{column.head | translate}}">
</mat-icon>
</th>
<td mat-cell *matCellDef="let element">{{element[column.prop]}}</td>
@ -32,7 +32,7 @@
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element">
<button mat-icon-button
matTooltip="Kampagnenstatistik für {{element.name}}"
matTooltip="{{ 'stats.scoreboard.button.detail' | translate:{name: element.name} }}"
(click)="selectPlayerDetail(1, isSteamUUID(element['steamUUID']) ?
element['steamUUID'] : element['name'])">
<mat-icon svgIcon="stats-detail">

View File

@ -37,13 +37,6 @@ export class ScoreboardComponent implements OnChanges {
displayedColumns = this.tableHead.map(head => head.prop);
reorderable = false;
customClasses = {
sortAscending: 'glyphicon glyphicon-triangle-top',
sortDescending: 'glyphicon glyphicon-triangle-bottom',
};
constructor(private elRef: ElementRef) {
this.displayedColumns.push('interact');
}

View File

@ -1,18 +1,18 @@
<form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3>Schlacht bearbeiten</h3>
<h3>{{'stats.war.submit.headline' | translate}}</h3>
<div class="form-group">
<label for="title">Titel</label>
<label for="title">{{'stats.war.submit.title' | translate}}</label>
<input type="text" class="form-control"
[(ngModel)]="war.title"
name="title"
id="title"
required maxlength="50"/>
<show-error displayName="Name" controlPath="title"></show-error>
<show-error displayName="{{'stats.war.submit.title' | translate}}" controlPath="title"></show-error>
</div>
<div class="form-group">
<label for="campaign">Kampagne</label>
<label for="campaign">{{'stats.war.submit.campaign' | translate}}</label>
<select class="form-control"
name="campaign"
id="campaign"
@ -25,43 +25,47 @@
</div>
<div class="form-group">
<label for="ptBlufor">Punkte NATO</label>
<label for="ptBlufor">{{'stats.war.submit.points' | translate}} {{fraction.BLUFOR}}</label>
<input type="number" class="form-control"
[(ngModel)]="war.ptBlufor"
name="ptBlufor"
id="ptBlufor"
required min="0"/>
<show-error displayName="Name" controlPath="ptBlufor"></show-error>
<show-error displayName="{{'stats.war.submit.points' | translate}} {{fraction.BLUFOR}}"
controlPath="ptBlufor"></show-error>
</div>
<div class="form-group">
<label for="ptOpfor">Punkte CSAT</label>
<label for="ptOpfor">{{'stats.war.submit.points' | translate}} {{fraction.OPFOR}}</label>
<input type="number" class="form-control"
[(ngModel)]="war.ptOpfor"
name="ptOpfor"
id="ptOpfor"
required min="0"/>
<show-error displayName="Name" controlPath="ptOpfor"></show-error>
<show-error displayName="{{'stats.war.submit.points' | translate}} {{fraction.OPFOR}}"
controlPath="ptOpfor"></show-error>
</div>
<div class="form-group">
<label for="endBudgetBlufor">Endbudget NATO</label>
<label for="endBudgetBlufor">{{'stats.war.submit.final.budget' | translate}} {{fraction.BLUFOR}}</label>
<input type="number" class="form-control"
[(ngModel)]="war.endBudgetBlufor"
name="endBudgetBlufor"
id="endBudgetBlufor"
required/>
<show-error displayName="Name" controlPath="endBudgetBlufor"></show-error>
<show-error displayName="{{'stats.war.submit.final.budget' | translate}} {{fraction.BLUFOR}}"
controlPath="endBudgetBlufor"></show-error>
</div>
<div class="form-group">
<label for="endBudgetOpfor">Endbudget CSAT</label>
<label for="endBudgetOpfor">{{'stats.war.submit.final.budget' | translate}} {{fraction.OPFOR}}</label>
<input type="number" class="form-control"
[(ngModel)]="war.endBudgetOpfor"
name="endBudgetOpfor"
id="endBudgetOpfor"
required/>
<show-error displayName="Name" controlPath="endBudgetOpfor"></show-error>
<show-error displayName="{{'stats.war.submit.final.budget' | translate}} {{fraction.OPFOR}}"
controlPath="endBudgetOpfor"></show-error>
</div>
<button id="cancel"

View File

@ -7,6 +7,7 @@ import {CampaignService} from '../../../services/logs/campaign.service';
import {Subscription} from 'rxjs/Subscription';
import {SnackBarService} from '../../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../../i18n/de.messages';
import {Fraction} from '../../../utils/fraction.enum';
@Component({
@ -20,6 +21,8 @@ export class WarEditComponent {
subscription: Subscription;
readonly fraction = Fraction;
@ViewChild(NgForm) form: NgForm;
constructor(private route: ActivatedRoute,

View File

@ -1,14 +1,14 @@
<div *ngIf="war" class="war-header fade-in" xmlns="http://www.w3.org/1999/html">
<div class="war-header-container">
<div class="pull-left head-field" style="width: 250px">
<h4>Endpunktestand:</h4>
<h4>{{'stats.scoreboard.standings' | translate}}</h4>
<span [style.color]="fraction.COLOR_BLUFOR" style="font-weight: bold; margin-right: 10px">{{fraction.BLUFOR}} {{war.ptBlufor}}</span>
<span style="font-size: x-large">|</span>
<span [style.color]="fraction.COLOR_OPFOR" style="font-weight: bold; margin-left: 10px;">{{war.ptOpfor}} {{fraction.OPFOR}}</span>
</div>
<div class="pull-left head-field " style="padding-left: 100px;">
<h4 class="pull-left" style="margin-bottom: 0;">Teilnehmer:</h4>
<h4 class="pull-left" style="margin-bottom: 0;">{{'stats.scoreboard.participants' | translate}}</h4>
<ngx-charts-pie-chart
class="pull-left"
[view]="[120, 120]"
@ -24,20 +24,26 @@
<div class="pull-left " style="padding-left: 100px; padding-top:15px">
<a class="btn btn-default" style="margin: 20px" target="_blank" href="resource/logs/{{war._id}}/clean.log">
Logfile anzeigen
{{'stats.scoreboard.show.logs' | translate}}
</a>
</div>
</div>
<ul class="nav nav-tabs">
<li class="nav-item" [ngClass]="{active :tab === 0}" (click)="switchTab(0)">
<a class="nav-link"><img src="../../../assets/scoreboard-btn.png"> Scoreboard</a>
<a class="nav-link"><img src="../../../assets/scoreboard-btn.png">
{{'stats.scoreboard.tab.scoreboard' | translate}}
</a>
</li>
<li class="nav-item" [ngClass]="{active :tab === 1}" (click)="switchTab(1)">
<a class="nav-link"><img src="../../../assets/fraction-btn.png"> Fraktionen</a>
<a class="nav-link"><img src="../../../assets/fraction-btn.png">
{{'stats.scoreboard.tab.fractions' | translate}}
</a>
</li>
<li class="nav-item" [ngClass]="{active :tab === 2, deactivated :tab !== 2} ">
<a class="nav-link"><img src="../../../assets/player-stats-btn.png"> Player</a>
<a class="nav-link"><img src="../../../assets/player-stats-btn.png">
{{'stats.scoreboard.tab.player' | translate}}
</a>
</li>
<li>
<div *ngIf="tab === 0">
@ -46,23 +52,26 @@
<input type="radio" name="fractSelect"
[checked]="(fractionFilterSelected == undefined) ? 'true' : 'false'"
[(ngModel)]="fractionFilterSelected"
(change)="filterPlayersByFraction()">Alle
(change)="filterPlayersByFraction()">
{{'stats.scoreboard.fraction.filter.all' | translate}}
</label>
<label class="radio-inline">
<input type="radio" name="fractSelect" value="BLUFOR"
[(ngModel)]="fractionFilterSelected"
#fractRadioBufor
(change)="filterPlayersByFraction(fractRadioBufor.value)">{{fraction.BLUFOR}}
(change)="filterPlayersByFraction(fractRadioBufor.value)">
{{fraction.BLUFOR}}
</label>
<label class="radio-inline">
<input type="radio" name="fractSelect" value="OPFOR"
[(ngModel)]="fractionFilterSelected"
#fractRadioOpfor
(change)="filterPlayersByFraction(fractRadioOpfor.value)">{{fraction.OPFOR}}
(change)="filterPlayersByFraction(fractRadioOpfor.value)">
{{fraction.OPFOR}}
</label>
</form>
<span class="btn btn-default pull-left tab-control" (click)="scoreBoardComponent.exportCSV()">
Download CSV
{{'stats.scoreboard.download.csv' | translate}}
</span>
</div>
</li>

View File

@ -1,17 +1,17 @@
export class PlayerUtils {
public static readonly attributeDisplayNames = [
{prop: 'name', head: 'Spieler'},
{prop: 'fraction', head: 'Fraktion'},
{prop: 'kill', head: 'Abschüsse'},
{prop: 'friendlyFire', head: 'Friendly Fire'},
{prop: 'revive', head: 'Revive'},
{prop: 'flagTouch', head: 'Eroberungen'},
{prop: 'vehicleLight', head: 'Fahrzeug (leicht)'},
{prop: 'vehicleHeavy', head: 'Fahrzeug (schwer)'},
{prop: 'vehicleAir', head: 'Fahrzeug (Luft)'},
{prop: 'death', head: 'Tode'},
{prop: 'respawn', head: 'Respawn'}
{prop: 'name', head: 'stats.scoreboard.header.player'},
{prop: 'fraction', head: 'stats.scoreboard.header.fraction'},
{prop: 'kill', head: 'stats.scoreboard.header.kill'},
{prop: 'friendlyFire', head: 'stats.scoreboard.header.friendly.fire'},
{prop: 'revive', head: 'stats.scoreboard.header.revive'},
{prop: 'flagTouch', head: 'stats.scoreboard.header.capture'},
{prop: 'vehicleLight', head: 'stats.scoreboard.header.vehicle.light'},
{prop: 'vehicleHeavy', head: 'stats.scoreboard.header.vehicle.heavy'},
{prop: 'vehicleAir', head: 'stats.scoreboard.header.vehicle.air'},
{prop: 'death', head: 'stats.scoreboard.header.death'},
{prop: 'respawn', head: 'stats.scoreboard.header.respawn'}
];
public static isSteamUUID(input: string): boolean {

View File

@ -34,8 +34,8 @@
"stats.player.detail.respawn.death.ratio": "Respawn/Death",
"stats.player.detail.graph.average": "Durchschnitt",
"stats.scoreboard.standings": "Endpunktestand",
"stats.scoreboard.participants": "Teilnehmer",
"stats.scoreboard.standings": "Endpunktestand:",
"stats.scoreboard.participants": "Teilnehmer:",
"stats.scoreboard.show.logs": "Logfile anzeigen",
"stats.scoreboard.download.csv": "Download CSV",
"stats.scoreboard.tab.scoreboard": "Scoreboard",
@ -53,5 +53,17 @@
"stats.scoreboard.header.vehicle.air": "Fahrzeug (Luft)",
"stats.scoreboard.header.death": "Tode",
"stats.scoreboard.header.respawn": "Respawn",
"stats.scoreboard.button.detail": "Kampagnenstatistik für {{name}}"
"stats.scoreboard.button.detail": "Kampagnenstatistik für {{name}}",
"stats.highscore.filter.placholder": "Spielername (mehrere mit '&' trennen)",
"stats.highscore.filter.button": "Filter",
"stats.highscore.header.name": "Name",
"stats.war.submit.headline": "Schlacht bearbeiten",
"stats.war.submit.title": "Titel",
"stats.war.submit.campaign": "Kampagne",
"stats.war.submit.points": "Punkte",
"stats.war.submit.final.budget": "Endbudget",
"stats.war.submit.button.submit": "Bestätigen",
"stats.war.submit.button.cancel": "Abbrechen"
}