Add translations for server stats charts (CC-80)

pull/51/head
HardiReady 2019-02-10 10:33:25 +01:00
parent 1f176e0256
commit 24fcb05f70
3 changed files with 36 additions and 22 deletions

View File

@ -42,6 +42,7 @@ export class ServerStatsComponent implements OnInit, OnChanges {
};
readonly labelsAsString = Object.keys(this.labels)
.map((key) => this.labels[key]);
lineChartSeriesLabels;
gradient = false;
yAxis = true;
@ -72,7 +73,13 @@ export class ServerStatsComponent implements OnInit, OnChanges {
ngOnChanges(changes: SimpleChanges) {
if ((changes.war || changes.performanceData) && this.performanceData) {
this.initializeChartData();
this.translate.get([
'stats.performance.select.timeline.label.minimum',
'stats.performance.select.timeline.label.average',
'stats.performance.select.timeline.label.maximum']).subscribe((res) => {
const resValues = Object.keys(res).map(val => res[val]);
this.initializeChartData(resValues[2], resValues[0], resValues[1]);
});
Object.assign(this, [this.barChartData]);
this.activeChartSelect = this.labels.singleAvg;
}
@ -107,10 +114,10 @@ export class ServerStatsComponent implements OnInit, OnChanges {
}
}
initializeChartData() {
this.tmpAvgTimeline = ChartUtils.getMultiDataArray('min', 'avg', 'max');
this.tmpMinTimeline = ChartUtils.getMultiDataArray('min', 'avg', 'max');
this.tmpServerTimeline = ChartUtils.getMultiDataArray('min', 'avg');
initializeChartData(labelMax: string, labelMin: string, labelAvg: string) {
this.tmpAvgTimeline = ChartUtils.getMultiDataArray(labelMax, labelAvg, labelMin);
this.tmpMinTimeline = ChartUtils.getMultiDataArray(labelMax, labelAvg, labelMin);
this.tmpServerTimeline = ChartUtils.getMultiDataArray(labelAvg, labelMin);
const diffMs = (new Date(this.war.endDate).getTime() - new Date(this.war.date).getTime());
const warDurationMinutes = Math.round(diffMs / 60000);
@ -150,8 +157,8 @@ export class ServerStatsComponent implements OnInit, OnChanges {
// SERVER TIMELINE DATA
for (let i = 0; i < entry.avgFps.length && i < warDurationMinutes; i++) {
const currDate = new Date(dateObj.getTime() + i * 60000);
this.tmpServerTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, entry.minFps[i]));
this.tmpServerTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, entry.avgFps[i]));
this.tmpServerTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, entry.avgFps[i]));
this.tmpServerTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, entry.minFps[i]));
}
}
this.tmpSingleAvg.push({
@ -167,16 +174,16 @@ export class ServerStatsComponent implements OnInit, OnChanges {
tmpAvgArray = tmpAvgArray.map(x => Math.round(x / this.performanceData.length));
for (let i = 0; i < tmpAvgArray.length; i++) {
const currDate = new Date(dateObj.getTime() + i * 60000);
this.tmpAvgTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMin[i]));
this.tmpAvgTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMax[i]));
this.tmpAvgTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgArray[i]));
this.tmpAvgTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMax[i]));
this.tmpAvgTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpAvgMin[i]));
}
tmpMinArray = tmpMinArray.map(x => Math.round(x / this.performanceData.length));
for (let i = 0; i < tmpMinArray.length; i++) {
const currDate = new Date(dateObj.getTime() + i * 60000);
this.tmpMinTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMin[i]));
this.tmpMinTimeline[0].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMax[i]));
this.tmpMinTimeline[1].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinArray[i]));
this.tmpMinTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMax[i]));
this.tmpMinTimeline[2].series.push(ChartUtils.getSeriesEntry(currDate, tmpMinMin[i]));
}
this.tmpSingleAvg.sort((a, b) => a.value - b.value);
this.tmpSingleMin.sort((a, b) => a.value - b.value);

View File

@ -34,6 +34,10 @@
"stats.performance.select.timeline.avg": "Verlauf FPS Durchschnitt",
"stats.performance.select.timeline.min": "Verlauf FPS Minimum",
"stats.performance.select.timeline.server": "Server FPS",
"stats.performance.select.timeline.label.minimum": "Minimum",
"stats.performance.select.timeline.label.average": "Mittelwert",
"stats.performance.select.timeline.label.maximum": "Maximum",
"stats.player.detail.headline": "Kampagnendetails - {{name}}",
"stats.player.detail.button.back": "Zurück",

View File

@ -42,6 +42,9 @@
"stats.performance.select.timeline.avg": "Timeline FPS Average",
"stats.performance.select.timeline.min": "Timeline FPS Minimum",
"stats.performance.select.timeline.server": "Server FPS",
"stats.performance.select.timeline.label.minimum": "Minimum",
"stats.performance.select.timeline.label.average": "Average",
"stats.performance.select.timeline.label.maximum": "Maximum",
"stats.player.detail.headline": "Campaign Details - {{name}}",
"stats.player.detail.button.back": "Back",