Merge "i18n: Avoid using variables in gettext() in network QoS edit rule"

This commit is contained in:
Zuul
2023-11-07 13:55:48 +00:00
committed by Gerrit Code Review
2 changed files with 40 additions and 13 deletions

View File

@@ -39,30 +39,53 @@
ctrl.rule_types = []; ctrl.rule_types = [];
angular.forEach($scope.model.rules, function(k) { angular.forEach($scope.model.rules, function(k) {
if (k.type === 'bandwidth_limit') { if (k.type === 'bandwidth_limit') {
ctrl.rule_types.push({name: 'bandwidth_limit', val: gettext('Bandwidth Limit - ' + ctrl.rule_types.push({
k.id + ', ' + k.max_kbps + ', ' + k.max_burst_kbps + ', ' + k.direction)}); name: 'bandwidth_limit',
val: interpolate(
gettext('%(id)s - Bandwidth Limit - maxkbps: %(max_kbps)s, ' +
'maxburstkbps: %(max_burst_kb)s, %(direction)s'),
{id: k.id,
max_kbps: k.max_kbps,
max_burst_kb: k.max_burst_kbps,
direction: k.direction},
true)
});
ctrl.bwdid = k.id; ctrl.bwdid = k.id;
ctrl.maxkbps = k.max_kbps; ctrl.maxkbps = k.max_kbps;
ctrl.maxburstkbps = k.max_burst_kbps || 0; ctrl.maxburstkbps = k.max_burst_kbps || 0;
ctrl.bwddirection = k.direction; ctrl.bwddirection = k.direction;
} }
else if (k.type === 'dscp_marking') { else if (k.type === 'dscp_marking') {
ctrl.rule_types.push({name: 'dscp_marking', ctrl.rule_types.push({
val: gettext("DSCP Mark - " + k.id + ', ' + k.dscp_mark)}); name: 'dscp_marking',
val: interpolate(
gettext("%(id)s - DSCP Marking - dscpmark: %(dscp_mark)s"),
{id: k.id, dscp_mark: k.dscp_mark},
true)
});
ctrl.dscpid = k.id; ctrl.dscpid = k.id;
ctrl.dscpmark = k.dscp_mark; ctrl.dscpmark = k.dscp_mark;
} }
else if (k.type === 'minimum_bandwidth') { else if (k.type === 'minimum_bandwidth') {
ctrl.rule_types.push({name: 'minimum_bandwidth', ctrl.rule_types.push({
val: gettext('Minimum Bandwidth - ' + k.id + ', ' + k.min_kbps + ', ' + k.direction)}); name: 'minimum_bandwidth',
val: interpolate(
gettext('%(id)s - Minimum Bandwidth - minkbps: %(min_kbps)s, %(direction)s'),
{id: k.id, min_kbps: k.min_kbps, direction: k.direction},
true)
});
ctrl.minbwdid = k.id; ctrl.minbwdid = k.id;
ctrl.minkbps = k.min_kbps; ctrl.minkbps = k.min_kbps;
ctrl.minbwddirection = k.direction; ctrl.minbwddirection = k.direction;
} }
else if (k.type === 'minimum_packet_rate') { else if (k.type === 'minimum_packet_rate') {
ctrl.rule_types.push({name: 'minimum_packet_rate', ctrl.rule_types.push({
val: gettext('Minimum Packet Rate - ' + k.id + ', ' + k.min_kpps + ', ' + name: 'minimum_packet_rate',
k.direction)}); val: interpolate(
gettext('%(id)s - Minimum Packet Rate - minkpps: %(min_kpps)s, %(direction)s'),
{id: k.id, min_kpps: k.min_kpps, direction: k.direction},
true)
});
ctrl.minpckrtid = k.id; ctrl.minpckrtid = k.id;
ctrl.minkpps = k.min_kpps; ctrl.minkpps = k.min_kpps;
ctrl.minpckrtdirection = k.direction; ctrl.minpckrtdirection = k.direction;

View File

@@ -63,10 +63,14 @@
); );
rules = [ rules = [
{name: "bandwidth_limit", val: "Bandwidth Limit - 1, 1000, 100, egress"}, {name: "bandwidth_limit",
{name: "dscp_marking", val: "DSCP Mark - 1, 12"}, val: "1 - Bandwidth Limit - maxkbps: 1000, maxburstkbps: 100, egress"},
{name: "minimum_bandwidth", val: "Minimum Bandwidth - 1, 100, egress"}, {name: "dscp_marking",
{name: "minimum_packet_rate", val: "Minimum Packet Rate - 1, 10000, egress"} val: "1 - DSCP Marking - dscpmark: 12"},
{name: "minimum_bandwidth",
val: "1 - Minimum Bandwidth - minkbps: 100, egress"},
{name: "minimum_packet_rate",
val: "1 - Minimum Packet Rate - minkpps: 10000, egress"}
]; ];
directions = { directions = {
"egress": "egress", "egress": "egress",