Skip to content

Migrate remaining plaintext to translation files #51635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions airflow-core/src/airflow/ui/rules/i18next.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
import i18nextPlugin from "eslint-plugin-i18next";

import { WARN } from "./levels.js";
import { ERROR } from "./levels.js";

const allExtensions = "*.{j,t}s{x,}";

Expand All @@ -37,6 +37,10 @@ export const i18nextRules = /** @type {const} @satisfies {FlatConfig.Config} */
// Check files in the ui/src directory
`src/**/${allExtensions}`,
],
ignores: [
// Ignore test files
"src/**/*.test.tsx",
],
plugins: {
i18next: i18nextPlugin,
},
Expand All @@ -56,7 +60,7 @@ export const i18nextRules = /** @type {const} @satisfies {FlatConfig.Config} */
* @see [i18next/no-literal-string](https://github.com/edvardchen/eslint-plugin-i18next#no-literal-string)
*/
"i18next/no-literal-string": [
WARN,
ERROR,
{
markupOnly: true,
},
Expand Down
4 changes: 2 additions & 2 deletions airflow-core/src/airflow/ui/src/components/ConfigForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ConfigForm = <T extends FieldValues = FieldValues>({
setErrors,
setFormError,
}: ConfigFormProps<T>) => {
const { t: translate } = useTranslation("components");
const { t: translate } = useTranslation(["components", "common"]);
const { conf, setConf } = useParamStore();

const validateAndPrettifyJson = (value: string) => {
Expand All @@ -68,7 +68,7 @@ const ConfigForm = <T extends FieldValues = FieldValues>({

return formattedJson;
} catch (error) {
const errorMessage = error instanceof Error ? error.message : translate("configForm.unkownError");
const errorMessage = error instanceof Error ? error.message : translate("common:error.unknown");

setErrors((prev) => ({
...prev,
Expand Down
5 changes: 4 additions & 1 deletion airflow-core/src/airflow/ui/src/components/DagVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
* under the License.
*/
import { Text } from "@chakra-ui/react";
import { useTranslation } from "react-i18next";

import type { DagVersionResponse } from "openapi/requests/types.gen";

import Time from "./Time";
import { Tooltip } from "./ui";

export const DagVersion = ({ version }: { readonly version: DagVersionResponse | null | undefined }) => {
const { t: translate } = useTranslation("components");

if (version === null || version === undefined) {
return undefined;
}

return (
<Tooltip content={<Time datetime={version.created_at} />}>
<Text as="span">v{version.version_number}</Text>
<Text as="span">{translate("versionSelect.versionCode", { versionCode: version.version_number })}</Text>
</Tooltip>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export const DagVersionSelect = ({ showLabel = true }: { readonly showLabel?: bo
<Select.Content>
{versionOptions.items.map((option) => (
<Select.Item item={option} key={option.version.version_number}>
<Text>v{option.version.version_number}</Text>
<Text>
{translate("versionSelect.versionCode", { versionCode: option.version.version_number })}
</Text>
<Time datetime={option.version.created_at} />
</Select.Item>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ export const DurationChart = ({
{entries.length > 1
? kind === "Dag Run"
? translate("durationChart.lastDagRun_other", { count: entries.length })
: translate("durationChart.lasttaskInstance_other", { count: entries.length })
: translate("durationChart.lastTaskInstance_other", { count: entries.length })
: kind === "Dag Run"
? translate("durationChart.lastDagRun_one")
: translate("durationChart.lasttaskInstance_one")}
: translate("durationChart.lastTaskInstance_one")}
</Heading>
<Bar
data={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"duration": "Laufzeit (Sekunden)",
"lastDagRun_one": "Letzter Dag Lauf",
"lastDagRun_other": "Letzte {{count}} Dag Läufe",
"lasttaskInstance_one": "Letzte Task Instanz",
"lasttaskInstance_other": "Letzte {{count}} Task Instanzen",
"lastTaskInstance_one": "Letzte Task Instanz",
"lastTaskInstance_other": "Letzte {{count}} Task Instanzen",
"queuedDuration": "Zeit in der Warteschlange",
"runAfter": "Lauf ab",
"runDuration": "Laufzeit"
Expand Down
31 changes: 25 additions & 6 deletions airflow-core/src/airflow/ui/src/i18n/locales/en/assets.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
{
"columns": {
"consumingDags": "Consuming Dags",
"group": "Group",
"lastAssetEvent": "Last Asset Event",
"name": "Name",
"producingTasks": "Producing Tasks"
"consumingDags": "Consuming Dags",
"createEvent": {
"button": "Create Event",
"manual": {
"description": "Directly create an Asset Event",
"extra": "Asset Event Extra",
"label": "Manual"
},
"materialize": {
"description": "Trigger the Dag upstream of this asset",
"descriptionWithDag": "Trigger the Dag upstream of this asset: {{dagName}}",
"label": "Materialize",
"unpauseDag": "Unpause {{dagName}} on trigger"
},
"success": {
"manualDescription": "Manual asset event creation was successful.",
"manualTitle": "Asset Event Created",
"materializeDescription": "Upstream Dag {{dagId}} was triggered successfully.",
"materializeTitle": "Materializing Asset"
},
"title": "Create Asset Event for {{name}}"
},
"group": "Group",
"lastAssetEvent": "Last Asset Event",
"name": "Name",
"producingTasks": "Producing Tasks",
"searchPlaceholder": "Search Assets"
}
5 changes: 3 additions & 2 deletions airflow-core/src/airflow/ui/src/i18n/locales/en/browse.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"user": "User",
"when": "When"
},
"title": "Audit Log Events"
"title": "Audit Log"
},
"xcom":{
"columns":{
"dag": "Dag",
"key": "Key",
"value": "Value"
}
},
"title": "XCom"
}
}
17 changes: 17 additions & 0 deletions airflow-core/src/airflow/ui/src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"queuedAt": "Queued At",
"runAfter": "Run After",
"runType": "Run Type",
"sourceAssetEvent": "Source Asset Event",
"triggeredBy": "Triggered By"
},
"dagRun_one": "Dag Run",
Expand All @@ -68,6 +69,13 @@
},
"duration": "Duration",
"endDate": "End Date",
"error": {
"back": "Back",
"defaultMessage": "An unexpected error occurred",
"home": "Home",
"notFound": "Page Not Found",
"title": "Error"
},
"expression": {
"all": "All",
"and": "AND",
Expand Down Expand Up @@ -169,6 +177,7 @@
"to": "To"
},
"task": {
"documentation": "Task Documentation",
"lastInstance": "Last Instance",
"operator": "Operator",
"triggerRule": "Trigger Rule"
Expand All @@ -189,6 +198,14 @@
"queue": "Queue",
"queuedWhen": "Queued At",
"scheduledWhen": "Scheduled At",
"triggerer": {
"assigned": "Assigned triggerer",
"class": "Trigger class",
"createdAt": "Trigger creation time",
"id": "Trigger ID",
"latestHeartbeat": "Latest triggerer heartbeat",
"title": "Triggerer Info"
},
"unixname": "Unix Name"
},
"taskInstance_one": "Task Instance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
"configForm": {
"advancedOptions": "Advanced Options",
"configJson": "Configuration JSON",
"invalidJson": "Invalid JSON format: {{errorMessage}}",
"unkownError": "Unknown error occurred."
"invalidJson": "Invalid JSON format: {{errorMessage}}"
},
"dagWarnings": {
"error_one": "1 Error",
Expand All @@ -41,8 +40,8 @@
"duration": "Duration (seconds)",
"lastDagRun_one": "Last Dag Run",
"lastDagRun_other": "Last {{count}} Dag Runs",
"lasttaskInstance_one": "Last Task Instance",
"lasttaskInstance_other": "Last {{count}} Task Instances",
"lastTaskInstance_one": "Last Task Instance",
"lastTaskInstance_other": "Last {{count}} Task Instances",
"queuedDuration": "Queued Duration",
"runAfter": "Run After",
"runDuration": "Run Duration"
Expand Down Expand Up @@ -96,6 +95,11 @@
"title": "Trigger Dag",
"unpause": "Unpause {{dagDisplayName}} on trigger"
},
"trimText": {
"details": "Details",
"empty": "Empty",
"noContent": "No content available."
},
"versionDetails": {
"bundleLink": "Bundle Link",
"bundleName": "Bundle Name",
Expand Down
26 changes: 22 additions & 4 deletions airflow-core/src/airflow/ui/src/i18n/locales/en/dag.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"allRuns": "All Runs",
"blockingDeps": {
"dependency": "Dependency",
"reason": "Reason",
"title": "Dependencies Blocking Task From Getting Scheduled"
},
"code": {
"bundleUrl": "Bundle Url",
"noCode": "No Code Found",
"parsedAt": "Parsed at:"
},
"extraLinks": "Extra Links",
"grid": {
"buttons": {
"resetToLatest": "Reset to latest",
Expand All @@ -16,12 +22,18 @@
"dagDocs": "Dag Docs"
}
},
"logs": {
"noTryNumber": "No try number",
"viewInExternal": "View logs in {{name}} (attempt {{attempt}})"
},
"overview": {
"buttons": {
"failedRun_one": "Failed Run",
"failedRun_other": "Failed Runs",
"failedTask_one": "Failed Task",
"failedTask_other": "Failed Tasks"
"failedTask_other": "Failed Tasks",
"failedTaskInstance_one": "Failed Task Instance",
"failedTaskInstance_other": "Failed Task Instances"
},
"charts": {
"assetEvent_one": "Created Asset Event",
Expand Down Expand Up @@ -55,14 +67,20 @@
}
},
"tabs": {
"asset_events": "Asset Events",
"assetEvents": "Asset Events",
"auditLog": "Audit Log",
"backfills": "Backfills",
"code": "Code",
"details": "Details",
"events": "Audit Logs",
"logs": "Logs",
"mappedTaskInstances_one": "Task Instance [{{count}}]",
"mappedTaskInstances_other": "Task Instances [{{count}}]",
"overview": "Overview",
"renderedTemplates": "Rendered Templates",
"runs": "Runs",
"tasks": "Tasks"
"taskInstances": "Task Instances",
"tasks": "Tasks",
"xcom": "XCom"
},
"taskGroups": {
"collapseAll": "Collapse all task groups",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"duration": "Czas trwania (sekundy)",
"lastDagRun_one": "Ostatnie wykonanie Daga",
"lastDagRun_other": "Ostatnie {{count}} wykonania Daga",
"lasttaskInstance_one": "Ostatnia instancja zadania",
"lasttaskInstance_other": "Ostatnie {{count}} instancje zadania",
"lastTaskInstance_one": "Ostatnia instancja zadania",
"lastTaskInstance_other": "Ostatnie {{count}} instancje zadania",
"queuedDuration": "Czas oczekiwania",
"runAfter": "Uruchom po",
"runDuration": "Czas trwania wykonania"
Expand Down
12 changes: 5 additions & 7 deletions airflow-core/src/airflow/ui/src/i18n/locales/zh-TW/assets.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"columns": {
"consumingDags": "消費者 Dags",
"group": "群組",
"lastAssetEvent": "最後資源事件",
"name": "名稱",
"producingTasks": "生產任務"
},
"consumingDags": "消費者 Dags",
"group": "群組",
"lastAssetEvent": "最後資源事件",
"name": "名稱",
"producingTasks": "生產任務",
"searchPlaceholder": "搜尋資源"
}
21 changes: 0 additions & 21 deletions airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions airflow-core/src/airflow/ui/src/layouts/Details/Gantt/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { HStack, Box } from "@chakra-ui/react";
import { useReactFlow } from "@xyflow/react";
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { PanelGroup, Panel, PanelResizeHandle } from "react-resizable-panels";
import { useParams } from "react-router-dom";

Expand All @@ -33,6 +34,7 @@ import { CreateAssetEvent } from "./CreateAssetEvent";
import { Header } from "./Header";

export const AssetLayout = () => {
const { t: translate } = useTranslation(["assets", "common"]);
const { assetId } = useParams();

const { setTableURLState, tableURLState } = useTableURLState();
Expand All @@ -51,7 +53,7 @@ export const AssetLayout = () => {
const links = [
{
label: asset?.name,
title: "Asset",
title: translate("common:asset_one"),
value: `/assets/${assetId}`,
},
];
Expand Down
Loading