Maximum/Total value now included as variable in msgid (i18n)

This patch makes possible to include a maximum/total numeric value
as a variable in the msgid, making it possible for translators to put
this variable in any position they want.



Change-Id: I856d3d454401a236feaf065d347bc2a48f7ef54c
Closes-bug: #1558292
This commit is contained in:
Eddie Ramirez 2016-07-08 22:02:42 +00:00
parent a5b4650816
commit 2ef42866b0
2 changed files with 11 additions and 3 deletions

View File

@ -174,12 +174,20 @@
scope.model.totalLabel = gettext('No Limit');
} else if (angular.isDefined(scope.chartData.maxLimit)) {
scope.model.total = scope.chartData.maxLimit;
scope.model.totalLabel = gettext('Max');
scope.model.totalLabel = interpolate(
gettext('%(total)s Max'),
{ total: scope.model.total },
true
);
} else {
scope.model.total = d3.sum(scope.chartData.data, function (d) {
return d.value;
});
scope.model.totalLabel = gettext('Total');
scope.model.totalLabel = interpolate(
gettext('%(total)s Total'),
{ total: scope.model.total },
true
);
}
scope.model.tooltipData.enabled = false;

View File

@ -2,7 +2,7 @@
<chart-tooltip tooltip-data="model.tooltipData"></chart-tooltip>
<div class="pie-chart-title" ng-if="::model.settings.showTitle && chartData.title">
{$ ::chartData.title $} ({$ model.total ? model.total + ' ' : '' $}{$ model.totalLabel $})
{$ ::chartData.title $} ({$ model.totalLabel $})
</div>
<svg class="svg-pie-chart"