From d81e8d50645d476d41c800ba5ae12497ec5932a3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 19 Nov 2024 15:08:08 -0400 Subject: language: count blankIfZero --- src/data/things/language.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/data/things/language.js') diff --git a/src/data/things/language.js b/src/data/things/language.js index 88f16ecb..e9aa58be 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -871,12 +871,20 @@ export class Language extends Thing { } const countHelper = (stringKey, optionName = stringKey) => - function(value, {unit = false} = {}) { + function(value, { + unit = false, + blankIfZero = false, + } = {}) { // Null or undefined value is blank content. if (value === null || value === undefined) { return html.blank(); } + // Zero is blank content, if that option is set. + if (value === 0 && blankIfZero) { + return html.blank(); + } + return this.formatString( unit ? `count.${stringKey}.withUnit.` + this.getUnitForm(value) -- cgit 1.3.0-6-gf8a5