Fix translation for graph time selection and display

This commit is contained in:
Johannes Zellner
2021-04-01 16:05:13 +02:00
parent 850ff87849
commit 465fc427d6
13 changed files with 29 additions and 28 deletions
+12
View File
@@ -100,6 +100,18 @@ angular.module('Application').filter('prettyDiskSize', function () {
return function (size, fallback) { return prettyByteSize(size, fallback) || 'Not available yet'; };
});
angular.module('Application').filter('trKeyFromPeriod', function () {
return function (period) {
if (period === 6) return 'app.graphs.period.6h';
if (period === 12) return 'app.graphs.period.12h';
if (period === 24) return 'app.graphs.period.24h';
if (period === 24*7) return 'app.graphs.period.7d';
if (period === 24*30) return 'app.graphs.period.30d';
return '';
};
});
angular.module('Application').filter('prettyDate', function () {
// http://ejohn.org/files/pretty.js
return function prettyDate(utc) {
-1
View File
@@ -1400,7 +1400,6 @@
"30d": "30 Tage",
"12h": "12 Stunden"
},
"selectPeriod": "Periode {{ period }} auswählen",
"memoryTitle": "Speicher (RAM + Swap) in MB"
},
"uninstallTabTitle": "Deinstallieren",
+2 -2
View File
@@ -1198,12 +1198,12 @@
}
},
"graphs": {
"selectPeriod": "Select Period {{ period }}",
"period": {
"12h": "12 hours",
"24h": "24 hours",
"7d": "7 days",
"30d": "30 days"
"30d": "30 days",
"6h": "6 hours"
},
"memoryTitle": "Memory (RAM + Swap) in MB"
},
-1
View File
@@ -799,7 +799,6 @@
"30d": "30 días",
"7d": "7 días"
},
"selectPeriod": "Seleccionar Periodo {{ period }}",
"memoryTitle": "Memoria (RAM + Swap) en Mb"
},
"states": {
+1 -2
View File
@@ -886,8 +886,7 @@
"7d": "7 jours",
"24h": "24 heures",
"12h": "12 heures"
},
"selectPeriod": "Période sélectionnée {{ period }}"
}
},
"resources": {
"memory": {
+1 -2
View File
@@ -329,8 +329,7 @@
"7d": "7 giorni",
"24h": "24 ore",
"12h": "12 ore"
},
"selectPeriod": "Seleziona Periodo {{ period }}"
}
},
"storage": {
"mounts": {
-1
View File
@@ -741,7 +741,6 @@
}
},
"graphs": {
"selectPeriod": "Selecteer periode {{ period }}",
"period": {
"24h": "24 uur",
"12h": "12 uur",
+1 -2
View File
@@ -1237,8 +1237,7 @@
"7d": "7 ngày trước",
"24h": "24 tiếng trước",
"12h": "12 tiếng trước"
},
"selectPeriod": "Chọn giai đoạn {{ period }}"
}
},
"storage": {
"mounts": {
-1
View File
@@ -1351,7 +1351,6 @@
"title": "域名冲突"
},
"graphs": {
"selectPeriod": "选择时间范围 {{ period }}",
"period": {
"12h": "12 小时",
"24h": "24 小时",
+5 -5
View File
@@ -839,14 +839,14 @@
<div class="col-md-12">
<div class="dropdown pull-right">
<button class="btn btn-sm btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
{{ 'app.graphs.selectPeriod' | tr:{ period: graphs.periodLabel } }}
{{ graphs.period | trKeyFromPeriod | tr }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="" ng-click="graphs.setPeriod(12, '12 hours')">{{ 'app.graphs.period.12h' | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24, '24 hours')">{{ 'app.graphs.period.24h' | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*7, '7 days')">{{ 'app.graphs.period.7d' | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*30, '30 days')">{{ 'app.graphs.period.30d' | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(12)">{{ 12 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24)">{{ 24 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*7)">{{ 24*7 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*30)">{{ 24*30 | trKeyFromPeriod | tr }}</a></li>
</ul>
</div>
<label style="margin-top: 10px;">{{ 'app.graphs.memoryTitle' | tr }}</label>
+1 -3
View File
@@ -650,13 +650,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
error: {},
period: 12, // set as 12 because disk graphs is only collected twice a day
periodLabel: '12 hours',
memoryChart: null,
diskChart: null,
setPeriod: function (hours, label) {
setPeriod: function (hours) {
$scope.graphs.period = hours;
$scope.graphs.periodLabel = label;
$scope.graphs.show();
},
+5 -5
View File
@@ -66,14 +66,14 @@
<div class="dropdown pull-right" ng-hide="activeTab === 0">
<button class="btn btn-sm btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
{{ 'system.selectPeriodLabel' | tr }} {{ graphs.periodLabel }}
{{ graphs.period | trKeyFromPeriod | tr }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="" ng-click="graphs.setPeriod(6, '6 hours')">6 hours</a></li>
<li><a href="" ng-click="graphs.setPeriod(24, '24 hours')">24 hours</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*7, '7 days')">7 days</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*30, '30 days')">30 days</a></li>
<li><a href="" ng-click="graphs.setPeriod(6)">{{ 6 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24)">{{ 24 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*7)">{{ 24*7 | trKeyFromPeriod | tr }}</a></li>
<li><a href="" ng-click="graphs.setPeriod(24*30)">{{ 24*30 | trKeyFromPeriod | tr }}</a></li>
</ul>
</div>
+1 -3
View File
@@ -154,13 +154,11 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
error: {},
period: 6,
periodLabel: '6 hours',
memoryChart: null,
diskChart: null,
setPeriod: function (hours, label) {
setPeriod: function (hours) {
$scope.graphs.period = hours;
$scope.graphs.periodLabel = label;
$scope.graphs.show();
},