fix: localize display of duration

Use [contextual translations](https://frappe.io/docs/user/en/translations#5-adding-context-for-a-string), so that d, h, m, s make any sense to translators.
This commit is contained in:
Raffael Meyer 2020-05-27 13:11:05 +02:00 committed by GitHub
parent 5a0eceff46
commit 6fd172c8f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -811,19 +811,19 @@ Object.assign(frappe.utils, {
let total_duration = frappe.utils.seconds_to_duration(value, duration_options);
if (total_duration.days) {
duration += total_duration.days + 'd';
duration += total_duration.days + __('d', null, 'Field: Duration');
}
if (total_duration.hours) {
duration += (duration.length ? " " : "");
duration += total_duration.hours + 'h';
duration += total_duration.hours + __('h', null, 'Field: Duration');
}
if (total_duration.minutes) {
duration += (duration.length ? " " : "");
duration += total_duration.minutes + 'm';
duration += total_duration.minutes + __('m', null, 'Field: Duration');
}
if (total_duration.seconds) {
duration += (duration.length ? " " : "");
duration += total_duration.seconds + 's';
duration += total_duration.seconds + __('s', null, 'Field: Duration');
}
}
return duration;
@ -998,4 +998,4 @@ String.prototype.plural = function(revert) {
}
return this;
};
};