Finish translations for manage part

pull/46/head
HardiReady 2018-10-04 11:48:22 +02:00
parent 78abec80fd
commit b2fa02d4eb
21 changed files with 195 additions and 67 deletions

View File

@ -3,13 +3,13 @@
<div class="return-button">
<button mat-raised-button (click)="backToOverview()">
<mat-icon svgIcon="chevron-left"></mat-icon>
Zurück
{{'public.army.member.button.back' | translate}}
</button>
</div>
<h3 class="text-center" style="font-weight: 600"
[style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
Auszeichnungen von {{user.username}}
{{'public.army.member.headline' | translate:{name: user.username} }}
</h3>
<div class="text-center">
@ -19,7 +19,9 @@
<input type="text" style="background: white;" class="form-control" [(ngModel)]="signatureUrl" readonly>
<span class="input-group-btn">
<button class="btn btn-default" [class.btn-success]="isCopied" type="button"
ngxClipboard [cbContent]="signatureUrl" (cbOnSuccess)="isCopied = true">kopieren</button>
ngxClipboard [cbContent]="signatureUrl" (cbOnSuccess)="isCopied = true">
{{'public.army.member.button.copy' | translate}}
</button>
</span>
</div>
@ -29,9 +31,11 @@
<thead>
<tr class="table-head">
<th class="col-sm-1" style="border-radius: 10px 0 0 0;"></th>
<th class="col-sm-2">Bezeichnung</th>
<th class="col-sm-2">Begründung</th>
<th class="col-sm-1 text-right" style="border-radius: 0 10px 0 0;">Verliehen am</th>
<th class="col-sm-2">{{'public.army.member.awards.title' | translate}}</th>
<th class="col-sm-2">{{'public.army.member.awards.reason' | translate}}</th>
<th class="col-sm-1 text-right" style="border-radius: 0 10px 0 0;">
{{'public.army.member.awards.date' | translate}}
</th>
</tr>
</thead>
<tbody *ngFor="let award of awards">
@ -55,7 +59,6 @@
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -8,8 +8,8 @@
<br>
<small *ngIf="decoration.fraction == 'OPFOR'">{{fraction.OPFOR}}</small>
<small *ngIf="decoration.fraction == 'BLUFOR'">{{fraction.BLUFOR}}</small>
<small *ngIf="decoration.fraction == 'GLOBAL'">Global</small>
<small> - Sortierung: {{decoration.sortingNumber}}</small>
<small *ngIf="decoration.fraction == 'GLOBAL'">{{'decorations.list.filter.global' | translate}}</small>
<small>{{'decorations.item.label.sort' | translate:{value: decoration.sortingNumber} }}</small>
</div>
<div class="col-xs-4">
@ -18,7 +18,8 @@
[style.max-width]="imgStyle.width"
[style.margin-top]="imgStyle.marginTop"
class="decoration-list-preview">
<span (click)="delete(); $event.stopPropagation()" matTooltip="Löschen" class="glyphicon glyphicon-trash trash"></span>
<span (click)="delete(); $event.stopPropagation()" matTooltip="{{'decorations.list.button.delete' | translate}}"
class="glyphicon glyphicon-trash trash"></span>
</div>
</div>
</div>

View File

@ -2,8 +2,8 @@
<cc-list-filter
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
{label: fraction.OPFOR, value: 'OPFOR'},
{label: 'Global', value: 'GLOBAL'}]"
[addButton]="{svgIcon: 'add', tooltip: 'Neue Auszeichnung hinzufügen'}"
{label: 'decorations.list.filter.global', value: 'GLOBAL'}]"
[addButton]="{svgIcon: 'add', tooltip: 'decorations.list.button.add'}"
(executeSearch)="filterDecorations($event)"
(openAddFrom)="openNewDecorationForm()">
</cc-list-filter>

View File

@ -8,6 +8,7 @@ import {DecorationService} from '../../services/army-management/decoration.servi
import {Fraction} from '../../utils/fraction.enum';
import {MatButtonToggleGroup} from '@angular/material';
import {UIHelpers} from '../../utils/global.helpers';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-decoration-list',
@ -28,7 +29,8 @@ export class DecorationListComponent implements OnInit {
constructor(private decorationService: DecorationService,
private router: Router,
private route: ActivatedRoute) {
private route: ActivatedRoute,
private translate: TranslateService) {
}
ngOnInit() {
@ -60,11 +62,16 @@ export class DecorationListComponent implements OnInit {
fraction = Fraction.OPFOR;
}
if (confirm('Soll die Auszeichnung "' + decoration.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.translate.get('decorations.list.delete.confirm', {
name: decoration.name,
fraction: fraction
}).subscribe((confirmQuestion) => {
if (confirm(confirmQuestion)) {
this.decorationService.deleteDecoration(decoration)
.subscribe((res) => {
});
}
})
}
filterDecorations(group?: MatButtonToggleGroup) {

View File

@ -4,11 +4,35 @@ import {CommonModule} from '@angular/common';
import {DecorationStore} from '../services/stores/decoration.store';
import {DecorationService} from '../services/army-management/decoration.service';
import {NgModule} from '@angular/core';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {HttpClient} from '@angular/common/http';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/decorations/', '.json');
}
@NgModule({
declarations: decorationsRoutingComponents,
imports: [CommonModule, SharedModule, decorationRoutesModule],
providers: [DecorationStore, DecorationService]
imports: [
CommonModule,
SharedModule,
decorationRoutesModule,
TranslateModule.forChild({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
},
isolate: true
})],
providers: [
DecorationStore,
DecorationService
]
})
export class DecorationsModule {
static routes = decorationRoutesModule;

View File

@ -3,8 +3,13 @@ import {DecorationListComponent} from './decoration-list/decoration-list.compone
import {EditDecorationComponent} from './edit-decoration/edit-decoration.component';
import {ModuleWithProviders} from '@angular/core';
import {DecorationItemComponent} from './decoration-list/decoration-item.component';
import {DecorationsComponent} from './decorations.component';
export const decorationsRoutes: Routes = [
{
path: '',
component: DecorationsComponent,
},
{
path: '',
component: DecorationListComponent,
@ -23,5 +28,6 @@ export const decorationsRoutes: Routes = [
export const decorationRoutesModule: ModuleWithProviders = RouterModule.forChild(decorationsRoutes);
export const decorationsRoutingComponents = [DecorationItemComponent, DecorationListComponent, EditDecorationComponent];
export const decorationsRoutingComponents = [DecorationsComponent, DecorationItemComponent, DecorationListComponent,
EditDecorationComponent];

View File

@ -0,0 +1 @@
<router-outlet></router-outlet>

View File

@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-decorations-root',
templateUrl: './decorations.component.html',
styleUrls: ['./decorations.component.scss']
})
export class DecorationsComponent {
constructor(private translate: TranslateService) {
translate.setDefaultLang('de');
}
}

View File

@ -1,63 +1,63 @@
<form #form="ngForm" (keydown.enter)="$event.preventDefault()" class="overview">
<h3 *ngIf="decoration._id">Auszeichnung editieren</h3>
<h3 *ngIf="!decoration._id">Neue Auszeichnung hinzufügen</h3>
<h3 *ngIf="decoration._id">{{'decorations.submit.headline.edit' | translate}}</h3>
<h3 *ngIf="!decoration._id">{{'decorations.submit.headline.new' | translate}}</h3>
<div class="form-group">
<label for="title">Name</label>
<label for="title">{{'decorations.submit.field.name' | translate}}</label>
<input type="text" class="form-control"
[(ngModel)]="decoration.name"
name="title"
id="title"
required maxlength="50"/>
<show-error displayName="Name" controlPath="title"></show-error>
<show-error displayName="{{'decorations.submit.field.name' | translate}}" controlPath="title"></show-error>
</div>
<div class="form-group">
<label for="fraction">Fraktion</label>
<label for="fraction">{{'decorations.submit.field.fraction' | translate}}</label>
<select id="fraction" name="fraction" class="form-control btn dropdown-toggle"
required
[(ngModel)]="decoration.fraction">
<option value="OPFOR">{{fraction.OPFOR}}</option>
<option value="BLUFOR">{{fraction.BLUFOR}}</option>
<option value="GLOBAL">Global</option>
<option value="GLOBAL">{{'decorations.submit.field.fraction.global' | translate}}</option>
</select>
<show-error displayName="Fraktion" controlPath="fraction"></show-error>
<show-error displayName="{{'decorations.submit.field.fraction' | translate}}" controlPath="fraction"></show-error>
</div>
<div class="form-group">
<label for="type">Art</label>
<label for="type">{{'decorations.submit.field.type' | translate}}</label>
<select id="type" name="type" class="form-control btn dropdown-toggle"
required
[(ngModel)]="decoration.isMedal">
<option value="true">Orden</option>
<option value="false">Ribbon</option>
<option value="true">{{'decorations.submit.field.type.medal' | translate}}</option>
<option value="false">{{'decorations.submit.field.type.ribbon' | translate}}</option>
</select>
<show-error displayName="Art" controlPath="type"></show-error>
<show-error displayName="{{'decorations.submit.field.type' | translate}}" controlPath="type"></show-error>
</div>
<div class="form-group">
<label for="sort">Sortierung</label>
<label for="sort">{{'decorations.submit.field.sort' | translate}}</label>
<input id="sort" name="sort" type="number" class="form-control btn dropdown-toggle"
[(ngModel)]="decoration.sortingNumber">
<show-error displayName="Sortierung" controlPath="sort"></show-error>
<show-error displayName="{{'decorations.submit.field.sort' | translate}}" controlPath="sort"></show-error>
</div>
<div class="form-group">
<label for="description">Beschreibung</label>
<label for="description">{{'decorations.submit.field.description' | translate}}</label>
<textarea id="description" name="description" class="form-control" rows="5"
required
[(ngModel)]="decoration.description"></textarea>
<show-error displayName="Beschreibung" controlPath="description"></show-error>
<show-error displayName="{{'decorations.submit.field.description' | translate}}" controlPath="description"></show-error>
</div>
<div class="form-group">
<label for="graphic">Bild</label>
<label for="graphic">{{'decorations.submit.field.image' | translate}}</label>
<input id="graphic" name="graphic" class="ui-button form-control" type="file"
#fileInput
accept="image/png"
(change)="fileChange($event)">
<span class="label label-bg label-danger center-block" style="font-size:small" *ngIf="showImageError">
Bild muss im PNG Format vorliegen
{{'decorations.submit.field.image.error.type' | translate}}
</span>
<img class="preview-image" src="{{imagePreviewSrc}}">
@ -66,7 +66,7 @@
<button id="cancel"
(click)="cancel()"
class="btn btn-default">
Abbrechen
{{'decorations.submit,button.cancel' | translate}}
</button>
<button id="save"
@ -74,6 +74,6 @@
(click)="saveDecoration(fileInput)"
class="btn btn-default"
[disabled]="!form.valid">
Bestätigen
{{'decorations.submit,button.submit' | translate}}
</button>
</form>

View File

@ -7,6 +7,7 @@ import {Subscription} from 'rxjs/Subscription';
import {Fraction} from '../../utils/fraction.enum';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
import {Message} from '../../i18n/de.messages';
import {TranslateService} from '@ngx-translate/core';
@Component({
templateUrl: './edit-decoration.component.html',
@ -31,7 +32,8 @@ export class EditDecorationComponent implements OnInit, OnDestroy {
constructor(private route: ActivatedRoute,
private router: Router,
private decorationService: DecorationService,
private snackBarService: SnackBarService) {
private snackBarService: SnackBarService,
private translate: TranslateService) {
}
ngOnInit() {
@ -69,7 +71,12 @@ export class EditDecorationComponent implements OnInit, OnDestroy {
this.router.navigate(['..'], {relativeTo: this.route});
});
} else {
return window.alert(`Bild ist ein Pflichtfeld`);
this.translate.get('decorations.submit.field.image').subscribe((fieldNameLogo) => {
this.translate.get('public.error.message.required',
{fieldName: fieldNameLogo}).subscribe((message) => {
this.snackBarService.showError(message, 4000);
})
});
}
} else {
if (this.fileList) {

View File

@ -8,6 +8,7 @@ import {RankService} from '../../services/army-management/rank.service';
import {Fraction} from '../../utils/fraction.enum';
import {UIHelpers} from '../../utils/global.helpers';
import {MatButtonToggleGroup} from '@angular/material';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-rank-list',
@ -28,7 +29,8 @@ export class RankListComponent implements OnInit {
constructor(private rankService: RankService,
private router: Router,
private route: ActivatedRoute) {
private route: ActivatedRoute,
private translate: TranslateService) {
}
ngOnInit() {
@ -60,10 +62,15 @@ export class RankListComponent implements OnInit {
deleteRank(rank) {
const fraction = rank.fraction === 'OPFOR' ? Fraction.OPFOR : Fraction.BLUFOR;
if (confirm('Soll der Rang ' + rank.name + ' (' + fraction + ') wirklich gelöscht werden?')) {
this.translate.get('ranks.list.delete.confirm', {
name: rank.name,
fraction: fraction
}).subscribe((confirmQuestion) => {
if (confirm(confirmQuestion)) {
this.rankService.deleteRank(rank)
.subscribe((res) => {
});
}
});
}
}

View File

@ -8,6 +8,7 @@ import {SquadService} from '../../services/army-management/squad.service';
import {Fraction} from '../../utils/fraction.enum';
import {UIHelpers} from '../../utils/global.helpers';
import {MatButtonToggleGroup} from '@angular/material';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-squad-list',
@ -28,7 +29,8 @@ export class SquadListComponent implements OnInit {
constructor(private squadService: SquadService,
private router: Router,
private route: ActivatedRoute) {
private route: ActivatedRoute,
private translate: TranslateService) {
}
ngOnInit() {
@ -54,11 +56,16 @@ export class SquadListComponent implements OnInit {
deleteSquad(squad) {
const fraction = squad.fraction === 'OPFOR' ? Fraction.OPFOR : Fraction.BLUFOR;
if (confirm('Soll das Squad "' + squad.name + '" (' + fraction + ') wirklich gelöscht werden?')) {
this.translate.get('squad.list.delete.confirm', {
name: squad.name,
fraction: fraction
}).subscribe((confirmQuestion) => {
if (confirm(confirmQuestion)) {
this.squadService.deleteSquad(squad)
.subscribe((res) => {
});
}
});
}
filterSquads(group?: MatButtonToggleGroup) {

View File

@ -5,6 +5,7 @@ import {PlayerUtils} from '../../../utils/player-utils';
import {saveAs} from 'file-saver/FileSaver';
import {MatSort} from '@angular/material';
import {SortUtils} from '../../../utils/sort-utils';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-scoreboard',
@ -37,7 +38,8 @@ export class ScoreboardComponent implements OnChanges {
displayedColumns = this.tableHead.map(head => head.prop);
constructor(private elRef: ElementRef) {
constructor(private elRef: ElementRef,
private translate: TranslateService) {
this.displayedColumns.push('interact');
}
@ -93,12 +95,13 @@ export class ScoreboardComponent implements OnChanges {
exportCSV() {
let csvOut = '';
for (let i = 0; i < this.tableHead.length; i++) {
csvOut += this.tableHead[i].head;
this.translate.get(this.tableHead[i].head).subscribe((translated) => {
csvOut += translated;
if (i !== this.tableHead.length - 1) {
csvOut += ',';
}
});
}
for (let j = 0; j < this.war.players.length; j++) {
const player = this.war.players[j];
csvOut += '\r\n';

View File

@ -9,6 +9,7 @@ import {ADD, LOAD} from '../../services/stores/user.store';
import {Fraction} from '../../utils/fraction.enum';
import {MatButtonToggleGroup} from '@angular/material';
import {UIHelpers} from '../../utils/global.helpers';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'cc-user-list',
@ -37,7 +38,8 @@ export class UserListComponent implements OnInit {
constructor(private userService: UserService,
private router: Router,
private route: ActivatedRoute) {
private route: ActivatedRoute,
private translate: TranslateService) {
}
ngOnInit() {
@ -67,11 +69,13 @@ export class UserListComponent implements OnInit {
}
deleteUser(user: User) {
if (confirm('Soll der Teilnehmer "' + user.username + '" wirklich gelöscht werden?')) {
this.translate.get('squad.list.delete.confirm', {name: user.username}).subscribe((confirmQuestion) => {
if (confirm(confirmQuestion)) {
this.userService.deleteUser(user)
.subscribe((res) => {
});
}
});
}
filterUsers(action?, group?: MatButtonToggleGroup) {

View File

@ -42,5 +42,12 @@
"public.army.headline": "Übersicht über alle Spieler, Squads und Armeen",
"public army.squad.members": "Mitglieder:",
"public.army.members": "Armeemitglieder:"
"public.army.members": "Armeemitglieder:",
"public.army.member.button.back": "Zurück",
"public.army.member.button.copy": "kopieren",
"public.army.member.headline": "Auszeichnungen von {{name}}",
"public.army.member.awards.title": "Bezeichnung",
"public.army.member.awards.reason": "Begründung",
"public.army.member.awards.date": "Verliehen am"
}

View File

@ -0,0 +1,31 @@
{
"public.error.message.required": "{{fieldName}} ist ein Pflichtfeld",
"public.error.message.min.length": "{{fieldName}} muss mindestens {{boundary}} Zeichen enthalten",
"public.error.message.max.length": "{{fieldName}} darf maximal {{boundary}} Zeichen enthalten",
"public.error.message.email": "Bitte geben Sie eine gültige E-Mail Adresse an",
"public.error.message.no.user": "Der eingetragene Benutzer existiert nicht.",
"public.error.message.default": "{{fieldName}} ist nicht valide",
"public.common.search.button": "Suchen",
"decorations.list.button.add": "Neue Auszeichnung hinzufügen",
"decorations.list.button.delete": "Löschen",
"decorations.list.filter.global": "Global",
"decorations.list.delete.confirm": "Soll die Auszeichnung '{{name}}' ({{fraction}}) wirklich gelöscht werden?",
"decorations.item.label.sort": " - Sortierung {{value}}",
"decorations.submit.headline.edit": "Auszeichnung bearbeiten",
"decorations.submit.headline.new": "Neue Auszeichnung hinzufügen",
"decorations.submit.field.name": "Name",
"decorations.submit.field.fraction": "Fraktion",
"decorations.submit.field.fraction.global": "Global",
"decorations.submit.field.type": "Art",
"decorations.submit.field.type.ribbon": "Ordensband",
"decorations.submit.field.type.medal": "Orden",
"decorations.submit.field.sort": "Sortierung",
"decorations.submit.field.description": "Beschreibung",
"decorations.submit.field.image": "Bild",
"decorations.submit.field.image.error.type": "Bild muss im PNG Format vorliegen",
"decorations.submit,button.submit": "Bestätigen",
"decorations.submit,button.cancel": "Abbrechen"
}

View File

@ -0,0 +1,3 @@
{
}

View File

@ -9,6 +9,7 @@
"ranks.list.button.add": "Neuen Rank hinzufügen",
"ranks.list.button.delete": "Löschen",
"ranks.list.delete.confirm": "Soll der Rang '{{name}}' ({{fraction}}) wirklich gelöscht werden?",
"ranks.list.item.label.level": " - Stufe {{level}}",
"ranks.submit.headline.new": "Neuen Rang hinzufügen",

View File

@ -8,6 +8,7 @@
"public.common.search.button": "Suchen",
"squad.list.tooltip.delete": "Löschen",
"squad.list.delete.confirm": "Soll das Squad '{{name}}' ({{fraction}}) wirklich gelöscht werden?",
"squad.list.tooltip.new": "Neues Squad hinzufügen",
"squad.submit.new.headline": "Neues Squad hinzufügen",
"squad.submit.edit.headline": "Squad bearbeiten",

View File

@ -12,6 +12,7 @@
"users.list.tooltip.awards": "Auszeichnungen",
"users.list.filter.no.squad": "Ohne Squad",
"users.list.item.label.no.squad": "ohne Squad/Fraktion",
"ranks.list.delete.confirm": "Soll der Teilnehmer '{{name}}' wirklich gelöscht werden?",
"users.award.headline": "Teilnehmer auszeichnen",
"users.award.field.decoration": "Auszeichnung",