From 26778156dcabc8c554351a936514b9ec4de20ed8 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 25 Nov 2025 07:19:24 +0530 Subject: [PATCH] chore: Improve pagination with compact number formatting and pluralization (#12921) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Template ## Description This PR enhances the pagination component with standardized number formatting and improved i18n handling. **Includes:** * Added `formatCompactNumber` and `formatFullNumber` helpers using `Intl.NumberFormat`. * `< 1,000`: show exact value (e.g., `999`) * `1,000–999,999`: show compact format (`1k`, `1k+`) * `1,000,000+`: show in millions with one decimal (e.g., `1.2M`) * Updated `PaginationFooter` to use the new formatters for all displayed numbers. * Added proper pluralization to pagination i18n strings. Fixes https://linear.app/chatwoot/issue/CW-5999/better-display-of-numbers ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Screenshoots **Before** image image image image image image **After** image image image image image image ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../pagination/PaginationFooter.vue | 32 ++- .../dashboard/i18n/locale/en/companies.json | 2 +- .../dashboard/i18n/locale/en/components.json | 4 +- .../dashboard/i18n/locale/en/contact.json | 2 +- .../specs/useNumberFormatter.spec.js | 240 ++++++++++++++++++ .../shared/composables/useNumberFormatter.js | 67 +++++ 6 files changed, 332 insertions(+), 15 deletions(-) create mode 100644 app/javascript/shared/composables/specs/useNumberFormatter.spec.js create mode 100644 app/javascript/shared/composables/useNumberFormatter.js diff --git a/app/javascript/dashboard/components-next/pagination/PaginationFooter.vue b/app/javascript/dashboard/components-next/pagination/PaginationFooter.vue index e58b2db86..0a919dbbf 100644 --- a/app/javascript/dashboard/components-next/pagination/PaginationFooter.vue +++ b/app/javascript/dashboard/components-next/pagination/PaginationFooter.vue @@ -1,6 +1,7 @@ @@ -91,9 +99,11 @@ const pageInfo = computed(() => { />
- {{ currentPage }} + {{ formatFullNumber(currentPage) }} + + + {{ pageInfo }} - {{ pageInfo }}