From 6fd172c8f3a834df393c4c7c4d40fc09acb92b19 Mon Sep 17 00:00:00 2001 From: Raffael Meyer Date: Wed, 27 May 2020 13:11:05 +0200 Subject: [PATCH] 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. --- frappe/public/js/frappe/utils/utils.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js index f1677b5281..5d0a1403af 100644 --- a/frappe/public/js/frappe/utils/utils.js +++ b/frappe/public/js/frappe/utils/utils.js @@ -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; -}; \ No newline at end of file +};