From 02309ee33a87f631aae2ee45a9859e7cbf8ae309 Mon Sep 17 00:00:00 2001 From: yashgupta-hyland Date: Wed, 4 Dec 2024 14:58:28 +0530 Subject: [PATCH] WEBUI-1590:Allow option to configure integer display formatting 3.1.x (#2384) * WEBUI-1590:Allow option to configure integer display formatting * WEBUI-1590:Allow option to configure integer display formatting * WEBUI-1590:Allow option to configure integer display formatting --- elements/nuxeo-results/nuxeo-results.js | 14 +++++++++++--- .../main/resources/OSGI-INF/web-ui-properties.xml | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/elements/nuxeo-results/nuxeo-results.js b/elements/nuxeo-results/nuxeo-results.js index d9c3ea6036..ab2cfc8311 100644 --- a/elements/nuxeo-results/nuxeo-results.js +++ b/elements/nuxeo-results/nuxeo-results.js @@ -455,9 +455,17 @@ Polymer({ }, _computeCountLabel() { - return this.resultsCount < 0 - ? this.i18n('results.heading.count.unknown') - : this.i18n('results.heading.count', this.resultsCount); + // Fetch the property value from web-ui-properties.xml + const isNumberFormattingEnabled = + (Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.numberFormattingEnabled) || false; + if (this.resultsCount < 0) { + return this.i18n('results.heading.count.unknown'); + } + if (isNumberFormattingEnabled) { + const formattedCount = new Intl.NumberFormat().format(this.resultsCount); + return this.i18n('results.heading.count', formattedCount); + } + return this.i18n('results.heading.count', this.resultsCount); }, _sortOptions() { diff --git a/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml b/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml index 792dc7fc3f..58685a15c0 100644 --- a/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml +++ b/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml @@ -56,5 +56,8 @@ ${org.nuxeo.web.ui.trustedDomains:=} + + ${org.nuxeo.web.ui.numberFormatting.enabled:=} + \ No newline at end of file