shahar1 opened a new pull request, #73713:
URL: https://github.com/apache/airflow/pull/73713
Counters across the UI (Dag, run and task instance counts, import errors,
pool slots, pagination, selection counts, mapped task counts) were rendered as
raw integers, so large values like `12345` were hard to read and ignored the
selected UI language (`12,345` in English, `12.345` in German, `12 345` in
French).
Counters rendered outside translations now go through a single
`useFormatNumber` hook. It reuses the cached `Intl` fallback already used for
durations (moved to `src/utils/intlCache.ts`), because plugins can contribute
UI languages whose tags `Intl` rejects (e.g. `pt_BR`). Calling
`toLocaleString(i18n.language)` directly with such a tag throws a `RangeError`
and crashes the page; the two existing call sites that did this (`DataTable`,
`MetricSection`) are migrated too.
While touching these lines:
- Hard-coded English around the localized digits is now translatable (Dag
header "X of Y" active runs, pagination "X of Y" / "X - Y of Z", select "N
selected", the Dashboard alert toggle `aria-label`). New keys are added to `en`
only.
- The Dag warnings button count now adds the parse error as intended
(`total_entries ?? 0 + Number(error)` had an operator-precedence bug).
- The Dag header no longer renders the literal text `null` when
`max_active_runs` is unset.
Counters inside translated strings are migrated to i18next's built-in
`{{count, number}}` formatter in a separate, independent PR (branch
`ui-locale-number-placeholders`), to keep the ~150 locale-file changes out of
this review.
Tested: new unit tests for the hook (including the malformed-tag fallback)
and for StatsCard, ImportErrorCount, PoolBar, TaskInstanceTooltip and
DagRunStateCounts grouping; full UI vitest suite shows no new failures compared
to `main`; `tsc`, eslint, prettier and the pre-commit and manual prek stages
pass.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 5.5)
Generated-by: Claude Code (Opus 5.5) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]