This is an automated email from the ASF dual-hosted git repository.
choo121600 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new d161a4934da Refactor UI translation files to use nested keys for
DRYness (#68285)
d161a4934da is described below
commit d161a4934da3eab34a42276205b8ebbbbe78b393
Author: Pranam Pagi <[email protected]>
AuthorDate: Thu Jul 2 10:15:39 2026 +0530
Refactor UI translation files to use nested keys for DRYness (#68285)
* Refactor UI translation files to use nested keys (Resolves #68252)
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.
* Fix casing regressions in UI translation files
- 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).
* Fix CI E2E test timeouts by reverting nested i18n for ID strings
- 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.
---
.../airflow/ui/public/i18n/locales/en/admin.json | 32 +++++++++++-----------
.../airflow/ui/public/i18n/locales/en/common.json | 12 ++++----
.../airflow/ui/public/i18n/locales/en/dags.json | 12 ++++----
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
index 1b02ee5b9b4..77afeafef5a 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
@@ -13,7 +13,7 @@
"title": "Airflow Configuration"
},
"connections": {
- "add": "Add Connection",
+ "add": "Add $t(connections.connection_one)",
"columns": {
"connectionId": "Connection ID",
"connectionType": "Connection Type",
@@ -27,9 +27,9 @@
"deleteConnection_other": "Delete {{count}} connections",
"firstConfirmMessage_one": "You are about to delete the following
connection:",
"firstConfirmMessage_other": "You are about to delete the following
connections:",
- "title": "Delete Connection"
+ "title": "Delete $t(connections.connection_one)"
},
- "edit": "Edit Connection",
+ "edit": "Edit $t(connections.connection_one)",
"form": {
"connectionIdRequired": "Connection ID is required",
"connectionIdRequirement": "Connection ID cannot contain only spaces",
@@ -47,14 +47,14 @@
"learnMore": "These are resolved at runtime and are not visible in the
UI.",
"title": "No connection found!"
},
- "searchPlaceholder": "Search Connections",
- "test": "Test Connection",
+ "searchPlaceholder": "Search $t(connections.connection_other)",
+ "test": "Test $t(connections.connection_one)",
"testDisabled": "Test connection feature is disabled. Please contact an
administrator to enable it.",
"testError": {
- "title": "Test Connection Failed"
+ "title": "Test $t(connections.connection_one) Failed"
},
"testSuccess": {
- "title": "Test Connection Successful"
+ "title": "Test $t(connections.connection_one) Successful"
},
"typeMeta": {
"error": "Failed to retrieve Connection Type Meta",
@@ -107,13 +107,13 @@
"searchPlaceholder": "Search by file"
},
"pools": {
- "add": "Add Pool",
+ "add": "Add $t(pools.pool_one)",
"deferredSlotsIncluded": "Deferred Slots Included",
"delete": {
- "title": "Delete Pool",
+ "title": "Delete $t(pools.pool_one)",
"warning": "This will remove all metadata related to the pool and may
affect tasks using this pool."
},
- "edit": "Edit Pool",
+ "edit": "Edit $t(pools.pool_one)",
"form": {
"checkbox": "Check to include deferred tasks when calculating open pool
slots",
"description": "Description",
@@ -126,7 +126,7 @@
"noPoolsFound": "No pools found",
"pool_one": "Pool",
"pool_other": "Pools",
- "searchPlaceholder": "Search Pools",
+ "searchPlaceholder": "Search $t(pools.pool_other)",
"sort": {
"asc": "Name (A-Z)",
"desc": "Name (Z-A)",
@@ -140,19 +140,19 @@
}
},
"variables": {
- "add": "Add Variable",
+ "add": "Add $t(variables.variable_one)",
"columns": {
"isEncrypted": "Is Encrypted"
},
"delete": {
- "deleteVariable_one": "Delete 1 Variable",
- "deleteVariable_other": "Delete {{count}} Variables",
+ "deleteVariable_one": "Delete 1 $t(variables.variable_one)",
+ "deleteVariable_other": "Delete {{count}} $t(variables.variable_other)",
"firstConfirmMessage_one": "You are about to delete the following
variable:",
"firstConfirmMessage_other": "You are about to delete the following
variables:",
- "title": "Delete Variable",
+ "title": "Delete $t(variables.variable_one)",
"tooltip": "Delete selected variables"
},
- "edit": "Edit Variable",
+ "edit": "Edit $t(variables.variable_one)",
"form": {
"invalidJson": "Invalid JSON",
"keyMaxLength": "Key can contain a maximum of 250 characters",
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
index d8e490fa451..8cfd7e99de5 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
@@ -16,8 +16,8 @@
},
"asset_one": "Asset",
"asset_other": "Assets",
- "assetEvent_one": "Asset Event",
- "assetEvent_other": "Asset Events",
+ "assetEvent_one": "$t(asset_one) Event",
+ "assetEvent_other": "$t(asset_one) Events",
"assetInactive": {
"tooltip": "Upstream asset has been deactivated; the scheduler is holding
partition evaluation until it is reactivated."
},
@@ -33,8 +33,8 @@
"collapseAllExtra": "Collapse all extra JSON",
"collapseDetailsPanel": "Collapse Details Panel",
"consumingAsset": "Consuming Asset",
- "createdAssetEvent_one": "Created Asset Event",
- "createdAssetEvent_other": "Created Asset Events",
+ "createdAssetEvent_one": "Created $t(assetEvent_one)",
+ "createdAssetEvent_other": "Created $t(assetEvent_other)",
"dag_one": "Dag",
"dag_other": "Dags",
"dagDetails": {
@@ -274,8 +274,8 @@
"hotkey": "s",
"show": "Show Source"
},
- "sourceAssetEvent_one": "Source Asset Event",
- "sourceAssetEvent_other": "Source Asset Events",
+ "sourceAssetEvent_one": "Source $t(assetEvent_one)",
+ "sourceAssetEvent_other": "Source $t(assetEvent_other)",
"startDate": "Start Date",
"state": "State",
"states": {
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/dags.json
b/airflow-core/src/airflow/ui/public/i18n/locales/en/dags.json
index dc403907457..30fefed93f5 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/dags.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/dags.json
@@ -2,11 +2,11 @@
"assetSchedule": "{{count}} of {{total}} assets updated",
"dagActions": {
"delete": {
- "button": "Delete Dag",
- "warning": "This will remove all metadata related to the Dag, including
Runs and Tasks."
+ "button": "Delete $t(common:dag_one)",
+ "warning": "This will remove all metadata related to the
$t(common:dag_one), including Runs and $t(common:task_other)."
}
},
- "favoriteDag": "Favorite Dag",
+ "favoriteDag": "Favorite $t(common:dag_one)",
"filters": {
"allRunTypes": "All Run Types",
"allStates": "All States",
@@ -79,9 +79,9 @@
"search": {
"advanced": "Advanced Search",
"clear": "Clear search",
- "dags": "Search Dags",
+ "dags": "Search $t(common:dag_other)",
"hotkey": "+K",
- "tasks": "Search Tasks"
+ "tasks": "Search $t(common:task_other)"
},
"sort": {
"displayName": {
@@ -102,5 +102,5 @@
},
"placeholder": "Sort by"
},
- "unfavoriteDag": "Unfavorite Dag"
+ "unfavoriteDag": "Unfavorite $t(common:dag_one)"
}