Skip to content

feat(i18n): use rangeFormat for pagination#2078

Open
kytta wants to merge 2 commits intonpmx-dev:mainfrom
kytta:fix/1921-pagination-range
Open

feat(i18n): use rangeFormat for pagination#2078
kytta wants to merge 2 commits intonpmx-dev:mainfrom
kytta:fix/1921-pagination-range

Conversation

@kytta
Copy link

@kytta kytta commented Mar 14, 2026

🔗 Linked issue

Resolves #1921

🧭 Context

This change number formatting for the page ranges in pagination from ad-hoc {start}-{end} to proper range formatting via Intl.NumberFormat.prototype.formatRange().

This ensures that the locale-specific range formatting is always used, for example:

  • Bengali: ২৫,৪৮৬ এর মধ্যে ৭৫১–১,০০০ (uses Bengali numbers)
  • Japanese: 25,486 件中 751~1,000 (uses tilde)
  • Hindi: 2,83,319 में से 2,83,251–2,83,319 (uses Indian base system)

📚 Description

The linked issue #1921 talks about number formatting not being consistent. It's true that, currently, only the total number of results is formatted properly, but not start and end. My first instinct was to just wrap them in $n, but then I remembered about the formatRange function.

Since there is no shorthand for range formatting in vue-i18n, I have used the numberFormatter composable to call it myself in the template code. Moving from {start}-{end} to just {range} required updating all i18n strings, of course. I have also noticed and fixed the invalid string in Turkish.

I have not used any AI tooling for this contribution.

@vercel
Copy link

vercel bot commented Mar 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 14, 2026 8:59pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 14, 2026 8:59pm
npmx-lunaria Ignored Ignored Mar 14, 2026 8:59pm

Request Review

@github-actions
Copy link

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
i18n/locales/ar.json Localization changed, will be marked as complete.
i18n/locales/az-AZ.json Localization changed, will be marked as complete.
i18n/locales/bg-BG.json Localization changed, will be marked as complete.
i18n/locales/bn-IN.json Localization changed, will be marked as complete.
i18n/locales/cs-CZ.json Localization changed, will be marked as complete.
i18n/locales/de-DE.json Localization changed, will be marked as complete.
i18n/locales/en.json Source changed, localizations will be marked as outdated.
i18n/locales/es.json Localization changed, will be marked as complete.
i18n/locales/fr-FR.json Localization changed, will be marked as complete.
i18n/locales/hi-IN.json Localization changed, will be marked as complete.
i18n/locales/hu-HU.json Localization changed, will be marked as complete.
i18n/locales/id-ID.json Localization changed, will be marked as complete.
i18n/locales/it-IT.json Localization changed, will be marked as complete.
i18n/locales/ja-JP.json Localization changed, will be marked as complete.
i18n/locales/kn-IN.json Localization changed, will be marked as complete.
i18n/locales/nb-NO.json Localization changed, will be marked as complete.
i18n/locales/ne-NP.json Localization changed, will be marked as complete.
i18n/locales/pl-PL.json Localization changed, will be marked as complete.
i18n/locales/pt-BR.json Localization changed, will be marked as complete.
i18n/locales/ru-RU.json Localization changed, will be marked as complete.
i18n/locales/ta-IN.json Localization changed, will be marked as complete.
i18n/locales/te-IN.json Localization changed, will be marked as complete.
i18n/locales/tr-TR.json Localization changed, will be marked as complete.
i18n/locales/uk-UA.json Localization changed, will be marked as complete.
i18n/locales/zh-CN.json Localization changed, will be marked as complete.
i18n/locales/zh-TW.json Localization changed, will be marked as complete.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

📝 Walkthrough

Walkthrough

This pull request updates pagination display formatting across the application. The PaginationControls.vue component is modified to integrate a number formatter that consolidates separate start and end item values into a single formatted range output using numberFormatter.formatRange(). Concurrently, all 27 internationalization locale files are updated to replace the pagination "showing" template string from using distinct {start} and {end} placeholders to using a single {range} placeholder. This change ensures consistent number formatting in pagination controls across all supported languages.

Possibly related PRs

Suggested reviewers

  • danielroe
  • graphieros
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR successfully addresses issue #1921 by implementing locale-specific range formatting for pagination using formatRange(), resolving the inconsistent number formatting complaint.
Out of Scope Changes check ✅ Passed All changes are in scope: PaginationControls.vue implements formatRange(), all i18n files update the pagination.showing placeholder to {range}, and the Turkish translation is corrected as mentioned.
Description check ✅ Passed The pull request description clearly explains the change from ad-hoc {start}-{end} formatting to proper Intl.NumberFormat.prototype.formatRange() for locale-specific pagination ranges, with concrete examples for multiple locales.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@graphieros graphieros requested a review from userquin March 14, 2026 21:38
Copy link
Member

@userquin userquin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thx ❤️

@userquin
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search results with inconsistent pagination number format

2 participants