diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-19 15:08:08 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-19 15:08:08 -0400 |
commit | d81e8d50645d476d41c800ba5ae12497ec5932a3 (patch) | |
tree | 11151e8647a608d0dca08662bd5f61a39739fb16 /src/data/things | |
parent | 33f069d8997c494a97f9f6b2dd5651f5bc957d79 (diff) |
language: count blankIfZero
Diffstat (limited to 'src/data/things')
-rw-r--r-- | src/data/things/language.js | 10 |
1 files changed, 9 insertions, 1 deletions
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) |