Refactor UI translation files to use nested keys for DRYness#68285
Refactor UI translation files to use nested keys for DRYness#68285pranampagi wants to merge 25 commits into
Conversation
This commit modifies the English translation files to utilize the $t() function for nested text references, significantly reducing translation duplication and making the localization files more DRY. Specific changes include: - Establishing base concepts (Dag, Task, Asset, etc.) in `common.json`. - Implementing internal nesting within `common.json` and `admin.json` (for connection, pool, and variable strings). - Implementing cross-namespace nesting (e.g., using `$t(common:dag_one)`) in `dags.json` to prove that base concepts can be centralized and accessed from separate JSON files. This ensures consistency across the UI and reduces the maintenance surface area for translating future languages.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
Validation performed:
|
There was a problem hiding this comment.
Thanks @pranampagi
1. Some of these change the rendered casing. Where the original text used a lowercase noun mid-sentence, nesting the title-case key capitalizes it:
connections.testDisabled: "Test connection feature…" → "Test Connection feature…"pools.delete.warning: "the pool … this pool" → "the Pool … this Pool"pools.noPoolsFound: "No pools found" → "No Pools found"variables.import.uploadPlaceholder: "containing variables" → "containing Variables"variables.noRowsMessage: "No variables found" → "No Variables found"
Could we leave those running-text strings un-nested? The nesting is great for labels/buttons/titles (those are title-case already), just not for mid-sentence prose where the noun was lowercase on purpose. Or we accept this difference if we think it's fine.
2. Since this is a values-only change, could you add before/after screenshots of the Connections/Pools/Variables screens (or confirm you checked them)? Just to be sure none of the rendered strings shifted unintentionally.
- Revert mid-sentence prose strings (e.g., connections.testDisabled, pools.noPoolsFound, variables.import.uploadPlaceholder) back to literal lowercase strings to prevent unwanted title-casing. - Restrict $t() nesting strictly to labels, buttons, and titles that inherently require title-case. - Restore accidentally deleted keys in common.json (overallStatus, task.dependsOnPast, task.retries, task.waitForDownstream).
…y_translation # Conflicts: # airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
|
Thanks for the review @pierrejeambrun
Pools Screen (Empty state & Delete warning)Before
After
Variables Screen (Empty state & Import modal)Before
After
Connections Screen (Test disabled alert & Delete modal)Before
After
|
fa0b3df to
b641946
Compare
- Reverted `$t()` interpolation for highly specific terms like `Dag ID`, `Task ID`, and `Dag Run ID` in `common.json` back to literal strings. - This resolves Playwright UI timeout errors where the tests were strictly asserting the literal English translation text. - Includes trailing newline fix for `common.json` to satisfy the `check-i18n-json` pre-commit hook.
|
I've just pushed an update to resolve the 4 failing CI checks from the last run:
|
|
Thanks for running the CI—it's great to see that the fixes worked and the build passed perfectly (38 successful checks). I've just updated the branch to keep it perfectly in sync with Thanks again for the help! |










This PR modifies the Airflow UI translation files in the English (
en) locale to utilize the$t()function for nested text references.What and Why:
Previously, core concepts (like "Dag", "Task", "Connection") were repeated verbatim across hundreds of keys. This creates a large maintenance surface area and leaves room for translation inconsistencies across languages.
To make the localization files more DRY (Don't Repeat Yourself), this PR:
common.json.common.jsonandadmin.json(e.g.,"$t(connections.connection_one)").dags.json(e.g.,"$t(common:dag_one)") to prove that base concepts can be centralized and accessed from separate JSON files.Closes: #68252
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.