feat(i18n): use rangeFormat for pagination#2078
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
📝 WalkthroughWalkthroughThis 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 Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment 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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🔗 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:
২৫,৪৮৬ এর মধ্যে ৭৫১–১,০০০(uses Bengali numbers)25,486 件中 751~1,000(uses tilde)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 theformatRangefunction.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.