Skip to content

Commit ab3f0ec

Browse files
authored
Migrate all plaintext to i18n (#51635)
Fix tryNumber key Fix run details merge issues Replace all plaintext and change eslint to ERROR Fix zh-tw assets file
1 parent 3535bcd commit ab3f0ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+457
-482
lines changed

airflow-core/src/airflow/ui/rules/i18next.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
import i18nextPlugin from "eslint-plugin-i18next";
2424

25-
import { WARN } from "./levels.js";
25+
import { ERROR } from "./levels.js";
2626

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

@@ -37,6 +37,10 @@ export const i18nextRules = /** @type {const} @satisfies {FlatConfig.Config} */
3737
// Check files in the ui/src directory
3838
`src/**/${allExtensions}`,
3939
],
40+
ignores: [
41+
// Ignore test files
42+
"src/**/*.test.tsx",
43+
],
4044
plugins: {
4145
i18next: i18nextPlugin,
4246
},
@@ -56,7 +60,7 @@ export const i18nextRules = /** @type {const} @satisfies {FlatConfig.Config} */
5660
* @see [i18next/no-literal-string](https://github.com/edvardchen/eslint-plugin-i18next#no-literal-string)
5761
*/
5862
"i18next/no-literal-string": [
59-
WARN,
63+
ERROR,
6064
{
6165
markupOnly: true,
6266
},

airflow-core/src/airflow/ui/src/components/ConfigForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ConfigForm = <T extends FieldValues = FieldValues>({
5151
setErrors,
5252
setFormError,
5353
}: ConfigFormProps<T>) => {
54-
const { t: translate } = useTranslation("components");
54+
const { t: translate } = useTranslation(["components", "common"]);
5555
const { conf, setConf } = useParamStore();
5656

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

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

7373
setErrors((prev) => ({
7474
...prev,

airflow-core/src/airflow/ui/src/components/DagVersion.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@
1717
* under the License.
1818
*/
1919
import { Text } from "@chakra-ui/react";
20+
import { useTranslation } from "react-i18next";
2021

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

2324
import Time from "./Time";
2425
import { Tooltip } from "./ui";
2526

2627
export const DagVersion = ({ version }: { readonly version: DagVersionResponse | null | undefined }) => {
28+
const { t: translate } = useTranslation("components");
29+
2730
if (version === null || version === undefined) {
2831
return undefined;
2932
}
3033

3134
return (
3235
<Tooltip content={<Time datetime={version.created_at} />}>
33-
<Text as="span">v{version.version_number}</Text>
36+
<Text as="span">{translate("versionSelect.versionCode", { versionCode: version.version_number })}</Text>
3437
</Tooltip>
3538
);
3639
};

airflow-core/src/airflow/ui/src/components/DagVersionSelect.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ export const DagVersionSelect = ({ showLabel = true }: { readonly showLabel?: bo
9191
<Select.Content>
9292
{versionOptions.items.map((option) => (
9393
<Select.Item item={option} key={option.version.version_number}>
94-
<Text>v{option.version.version_number}</Text>
94+
<Text>
95+
{translate("versionSelect.versionCode", { versionCode: option.version.version_number })}
96+
</Text>
9597
<Time datetime={option.version.created_at} />
9698
</Select.Item>
9799
))}

airflow-core/src/airflow/ui/src/components/DurationChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ export const DurationChart = ({
102102
{entries.length > 1
103103
? kind === "Dag Run"
104104
? translate("durationChart.lastDagRun_other", { count: entries.length })
105-
: translate("durationChart.lasttaskInstance_other", { count: entries.length })
105+
: translate("durationChart.lastTaskInstance_other", { count: entries.length })
106106
: kind === "Dag Run"
107107
? translate("durationChart.lastDagRun_one")
108-
: translate("durationChart.lasttaskInstance_one")}
108+
: translate("durationChart.lastTaskInstance_one")}
109109
</Heading>
110110
<Bar
111111
data={{

airflow-core/src/airflow/ui/src/i18n/locales/de/components.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"duration": "Laufzeit (Sekunden)",
4242
"lastDagRun_one": "Letzter Dag Lauf",
4343
"lastDagRun_other": "Letzte {{count}} Dag Läufe",
44-
"lasttaskInstance_one": "Letzte Task Instanz",
45-
"lasttaskInstance_other": "Letzte {{count}} Task Instanzen",
44+
"lastTaskInstance_one": "Letzte Task Instanz",
45+
"lastTaskInstance_other": "Letzte {{count}} Task Instanzen",
4646
"queuedDuration": "Zeit in der Warteschlange",
4747
"runAfter": "Lauf ab",
4848
"runDuration": "Laufzeit"
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
{
2-
"columns": {
3-
"consumingDags": "Consuming Dags",
4-
"group": "Group",
5-
"lastAssetEvent": "Last Asset Event",
6-
"name": "Name",
7-
"producingTasks": "Producing Tasks"
2+
"consumingDags": "Consuming Dags",
3+
"createEvent": {
4+
"button": "Create Event",
5+
"manual": {
6+
"description": "Directly create an Asset Event",
7+
"extra": "Asset Event Extra",
8+
"label": "Manual"
9+
},
10+
"materialize": {
11+
"description": "Trigger the Dag upstream of this asset",
12+
"descriptionWithDag": "Trigger the Dag upstream of this asset: {{dagName}}",
13+
"label": "Materialize",
14+
"unpauseDag": "Unpause {{dagName}} on trigger"
15+
},
16+
"success": {
17+
"manualDescription": "Manual asset event creation was successful.",
18+
"manualTitle": "Asset Event Created",
19+
"materializeDescription": "Upstream Dag {{dagId}} was triggered successfully.",
20+
"materializeTitle": "Materializing Asset"
21+
},
22+
"title": "Create Asset Event for {{name}}"
823
},
24+
"group": "Group",
25+
"lastAssetEvent": "Last Asset Event",
26+
"name": "Name",
27+
"producingTasks": "Producing Tasks",
928
"searchPlaceholder": "Search Assets"
1029
}

airflow-core/src/airflow/ui/src/i18n/locales/en/browse.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
"user": "User",
1111
"when": "When"
1212
},
13-
"title": "Audit Log Events"
13+
"title": "Audit Log"
1414
},
1515
"xcom":{
1616
"columns":{
1717
"dag": "Dag",
1818
"key": "Key",
1919
"value": "Value"
20-
}
20+
},
21+
"title": "XCom"
2122
}
2223
}

airflow-core/src/airflow/ui/src/i18n/locales/en/common.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"queuedAt": "Queued At",
5454
"runAfter": "Run After",
5555
"runType": "Run Type",
56+
"sourceAssetEvent": "Source Asset Event",
5657
"triggeredBy": "Triggered By"
5758
},
5859
"dagRun_one": "Dag Run",
@@ -68,6 +69,13 @@
6869
},
6970
"duration": "Duration",
7071
"endDate": "End Date",
72+
"error": {
73+
"back": "Back",
74+
"defaultMessage": "An unexpected error occurred",
75+
"home": "Home",
76+
"notFound": "Page Not Found",
77+
"title": "Error"
78+
},
7179
"expression": {
7280
"all": "All",
7381
"and": "AND",
@@ -169,6 +177,7 @@
169177
"to": "To"
170178
},
171179
"task": {
180+
"documentation": "Task Documentation",
172181
"lastInstance": "Last Instance",
173182
"operator": "Operator",
174183
"triggerRule": "Trigger Rule"
@@ -189,6 +198,14 @@
189198
"queue": "Queue",
190199
"queuedWhen": "Queued At",
191200
"scheduledWhen": "Scheduled At",
201+
"triggerer": {
202+
"assigned": "Assigned triggerer",
203+
"class": "Trigger class",
204+
"createdAt": "Trigger creation time",
205+
"id": "Trigger ID",
206+
"latestHeartbeat": "Latest triggerer heartbeat",
207+
"title": "Triggerer Info"
208+
},
192209
"unixname": "Unix Name"
193210
},
194211
"taskInstance_one": "Task Instance",

airflow-core/src/airflow/ui/src/i18n/locales/en/components.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"configForm": {
2929
"advancedOptions": "Advanced Options",
3030
"configJson": "Configuration JSON",
31-
"invalidJson": "Invalid JSON format: {{errorMessage}}",
32-
"unkownError": "Unknown error occurred."
31+
"invalidJson": "Invalid JSON format: {{errorMessage}}"
3332
},
3433
"dagWarnings": {
3534
"error_one": "1 Error",
@@ -41,8 +40,8 @@
4140
"duration": "Duration (seconds)",
4241
"lastDagRun_one": "Last Dag Run",
4342
"lastDagRun_other": "Last {{count}} Dag Runs",
44-
"lasttaskInstance_one": "Last Task Instance",
45-
"lasttaskInstance_other": "Last {{count}} Task Instances",
43+
"lastTaskInstance_one": "Last Task Instance",
44+
"lastTaskInstance_other": "Last {{count}} Task Instances",
4645
"queuedDuration": "Queued Duration",
4746
"runAfter": "Run After",
4847
"runDuration": "Run Duration"
@@ -96,6 +95,11 @@
9695
"title": "Trigger Dag",
9796
"unpause": "Unpause {{dagDisplayName}} on trigger"
9897
},
98+
"trimText": {
99+
"details": "Details",
100+
"empty": "Empty",
101+
"noContent": "No content available."
102+
},
99103
"versionDetails": {
100104
"bundleLink": "Bundle Link",
101105
"bundleName": "Bundle Name",

0 commit comments

Comments
 (0)