Skip to content

fix(i18n): date and number format#17791

Merged
wackerow merged 6 commits into
devfrom
number-format
Mar 27, 2026
Merged

fix(i18n): date and number format#17791
wackerow merged 6 commits into
devfrom
number-format

Conversation

@wackerow
Copy link
Copy Markdown
Member

@wackerow wackerow commented Mar 18, 2026

Description

Standardizes locale-aware number and date formatting across the codebase to ensure correct numeral rendering for RTL languages (Urdu, Arabic) and enforce the Gregorian calendar universally. These changes were recommended by Gemini as best-practice improvements upon repo review.

  • Introduces numberFormat() wrapper (src/lib/utils/numbers.ts) around Intl.NumberFormat -- forces Extended Arabic numerals for Urdu, and Western Arabic for all other locales including Arabic (removes potential browser inconsistencies)
  • Introduces dateTimeFormat() wrapper (src/lib/utils/date.ts) around Intl.DateTimeFormat -- same numeral logic plus enforces Gregorian calendar
  • Replaces all raw Intl.NumberFormat, .toLocaleString() (on numbers), Intl.DateTimeFormat, .toLocaleDateString(), and .toLocaleTimeString() calls with the respective wrappers
  • Adds CSS list-style-type: urdu for ordered lists under :lang(ur) with persian fallback (cherry-picked and merged in i18n: Gemini translations (ur) #17854)
  • Deprecates unused i18n config properties and removes dead utility code (numberToPercent.ts, stale translation helpers)

41 files changed across components, pages, and utilities.

Related issue

Ongoing i18n efforts

- feat: add numberFormat wrapper util handling `ar` and `ur` numbering system overrides -- recommended by Gemini as best-practices for web3 content
- refactor: convert usage of Intl.NumberFormat to use imported numberFormat helper util throughout repo
- deprecate: getLocaleForNumberFormat helper which was performing no logic in its function call
- refactor: migrate numberToPercent to numbers.ts and remove Lang type preference in favor of string for locale
- fix: apply `locale` property where appropriate over hard-coded "en" or `undefined`
- docs: add AGENTS documentation for use of numberFormat as preferred approach over Intl.NumberFormat
- feat: add dateTimeFormat wrapper util handling ar and ur numbering system overrides -- recommended by Gemini as best-practices for web3 content
- refactor: convert usage of Intl.DateTimeFormat date.toLocaleDateString and date.toLocaleTimeString to use imported dateTimeformat helper util throughout repo
- refactor: migrate getLocaleFormattedDate to date.ts from time.ts
- docs: update AGENTS documentation for use of dateTimeFormat as preferred approach
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 18, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 4c3b6a2
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69c6b27fa2f4070008a8bc3e
😎 Deploy Preview https://deploy-preview-17791.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 56 (🟢 up 1 from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project labels Mar 18, 2026
// Extract blob stats directly (getBlobscanStats returns BlobscanStats, not wrapped in MetricReturnData)
const blobStats = {
avgBlobFee: blobscanOverallStats.avgBlobFee,
totalBlobs: new Intl.NumberFormat(undefined, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍🏼

Copy link
Copy Markdown
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

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

@wackerow nice refactor 💪🏼

Comment thread src/lib/utils/numbers.ts Outdated
wackerow and others added 2 commits March 27, 2026 09:14
Co-authored-by: Pablo Pettinari <pettinarip@gmail.com>
@wackerow wackerow merged commit 568aca1 into dev Mar 27, 2026
2 checks passed
@wackerow wackerow deleted the number-format branch March 27, 2026 16:40
@pettinarip pettinarip mentioned this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants