Skip to content

Commit 867f9e2

Browse files
committed
Translate all components
1 parent 6528f6d commit 867f9e2

File tree

20 files changed

+315
-238
lines changed

20 files changed

+315
-238
lines changed

airflow-core/src/airflow/ui/src/components/AssetExpression/AndGateNode.tsx

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,41 @@
1818
*/
1919
import { Box, VStack, Badge } from "@chakra-ui/react";
2020
import type { PropsWithChildren } from "react";
21+
import { useTranslation } from "react-i18next";
2122
import { TbLogicAnd } from "react-icons/tb";
2223

23-
export const AndGateNode = ({ children }: PropsWithChildren) => (
24-
<Box
25-
bg="bg.subtle"
26-
border="2px dashed"
27-
borderRadius="lg"
28-
display="inline-block"
29-
minW="fit-content"
30-
p={4}
31-
position="relative"
32-
>
33-
<Badge
34-
alignItems="center"
35-
borderRadius="full"
36-
display="flex"
37-
fontSize="sm"
38-
gap={1}
39-
left="50%"
40-
position="absolute"
41-
px={3}
42-
py={1}
43-
top="-3"
44-
transform="translateX(-50%)"
24+
export const AndGateNode = ({ children }: PropsWithChildren) => {
25+
const { t: translate } = useTranslation("common");
26+
27+
return (
28+
<Box
29+
bg="bg.subtle"
30+
border="2px dashed"
31+
borderRadius="lg"
32+
display="inline-block"
33+
minW="fit-content"
34+
p={4}
35+
position="relative"
4536
>
46-
<TbLogicAnd size={18} />
47-
AND
48-
</Badge>
49-
<VStack align="center" gap={4} mt={3}>
50-
{children}
51-
</VStack>
52-
</Box>
53-
);
37+
<Badge
38+
alignItems="center"
39+
borderRadius="full"
40+
display="flex"
41+
fontSize="sm"
42+
gap={1}
43+
left="50%"
44+
position="absolute"
45+
px={3}
46+
py={1}
47+
top="-3"
48+
transform="translateX(-50%)"
49+
>
50+
<TbLogicAnd size={18} />
51+
{translate("expression.and")}
52+
</Badge>
53+
<VStack align="center" gap={4} mt={3}>
54+
{children}
55+
</VStack>
56+
</Box>
57+
);
58+
};

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
import { Box, Badge } from "@chakra-ui/react";
2020
import { Fragment } from "react";
21+
import { useTranslation } from "react-i18next";
2122
import { TbLogicOr } from "react-icons/tb";
2223

2324
import { AndGateNode } from "./AndGateNode";
@@ -32,6 +33,8 @@ export const AssetExpression = ({
3233
readonly events?: Array<NextRunEvent>;
3334
readonly expression: ExpressionType | null;
3435
}) => {
36+
const { t: translate } = useTranslation("common");
37+
3538
if (expression === null) {
3639
return undefined;
3740
}
@@ -54,7 +57,7 @@ export const AssetExpression = ({
5457
{expression.any && index === expression.any.length - 1 ? undefined : (
5558
<Badge alignItems="center" borderRadius="full" fontSize="sm" px={3} py={1}>
5659
<TbLogicOr size={18} />
57-
OR
60+
{translate("expression.or")}
5861
</Badge>
5962
)}
6063
</Fragment>

airflow-core/src/airflow/ui/src/components/Banner/BackfillBanner.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
import { Box, HStack, Spacer, Text, type ButtonProps } from "@chakra-ui/react";
2020
import { useQueryClient } from "@tanstack/react-query";
21+
import { useTranslation } from "react-i18next";
2122
import { MdPause, MdPlayArrow, MdStop } from "react-icons/md";
2223
import { RiArrowGoBackFill } from "react-icons/ri";
2324

@@ -46,6 +47,7 @@ const buttonProps = {
4647
} satisfies ButtonProps;
4748

4849
const BackfillBanner = ({ dagId }: Props) => {
50+
const { t: translate } = useTranslation("components");
4951
const { data, isLoading } = useBackfillServiceListBackfillsUi({
5052
dagId,
5153
});
@@ -91,7 +93,7 @@ const BackfillBanner = ({ dagId }: Props) => {
9193
<Box bg="blue.solid" borderRadius="full" color="blue.contrast" my="1" px="2" py="1">
9294
<HStack alignItems="center" ml={3}>
9395
<RiArrowGoBackFill />
94-
<Text key="backfill">Backfill in progress:</Text>
96+
<Text key="backfill">{translate("banner.backfillInProgress")}:</Text>
9597
<Text fontSize="sm">
9698
{" "}
9799
<Time datetime={data?.backfills[0]?.from_date} /> - <Time datetime={data?.backfills[0]?.to_date} />
@@ -100,7 +102,7 @@ const BackfillBanner = ({ dagId }: Props) => {
100102
<Spacer flex="max-content" />
101103
<ProgressBar size="xs" visibility="visible" />
102104
<Button
103-
aria-label={backfill.is_paused ? "Unpause backfill" : "Pause backfill"}
105+
aria-label={backfill.is_paused ? translate("banner.unpause") : translate("banner.pause")}
104106
loading={isPausePending || isUnPausePending}
105107
onClick={() => {
106108
togglePause();
@@ -110,7 +112,7 @@ const BackfillBanner = ({ dagId }: Props) => {
110112
{backfill.is_paused ? <MdPlayArrow /> : <MdPause />}
111113
</Button>
112114
<Button
113-
aria-label="Cancel backfill"
115+
aria-label={translate("banner.cancel")}
114116
loading={isStopPending}
115117
onClick={() => {
116118
cancel();

airflow-core/src/airflow/ui/src/components/Clear/columns.tsx

Lines changed: 0 additions & 66 deletions
This file was deleted.

airflow-core/src/airflow/ui/src/components/DagActions/ParseDag.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
import { useTranslation } from "react-i18next";
1920
import { AiOutlineFileSync } from "react-icons/ai";
2021

2122
import { Button } from "src/components/ui";
@@ -27,17 +28,18 @@ type Props = {
2728
};
2829

2930
const ParseDag = ({ dagId, fileToken }: Props) => {
31+
const { t: translate } = useTranslation("components");
3032
const { isPending, mutate } = useDagParsing({ dagId });
3133

3234
return (
3335
<Button
34-
aria-label="Reparse Dag"
36+
aria-label={translate("reparseDag")}
3537
loading={isPending}
3638
onClick={() => mutate({ fileToken })}
3739
variant="outline"
3840
>
3941
<AiOutlineFileSync height={5} width={5} />
40-
Reparse Dag
42+
{translate("reparseDag")}
4143
</Button>
4244
);
4345
};

airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Input, Box, Spacer, HStack, Field, VStack, Flex, Text, Skeleton } from
2020
import dayjs from "dayjs";
2121
import { useEffect, useState } from "react";
2222
import { useForm, Controller, useWatch } from "react-hook-form";
23+
import { useTranslation } from "react-i18next";
2324

2425
import type { DAGResponse, DAGWithLatestDagRunsResponse, BackfillPostBody } from "openapi/requests/types.gen";
2526
import { Button } from "src/components/ui";
@@ -29,7 +30,6 @@ import { useCreateBackfillDryRun } from "src/queries/useCreateBackfillDryRun";
2930
import { useDagParams } from "src/queries/useDagParams";
3031
import { useParamStore } from "src/queries/useParamStore";
3132
import { useTogglePause } from "src/queries/useTogglePause";
32-
import { pluralize } from "src/utils";
3333

3434
import ConfigForm from "../ConfigForm";
3535
import { DateTimeInput } from "../DateTimeInput";
@@ -47,6 +47,7 @@ const today = new Date().toISOString().slice(0, 16);
4747
type BackfillFormProps = DagRunTriggerParams & Omit<BackfillPostBody, "dag_run_conf">;
4848

4949
const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
50+
const { t: translate } = useTranslation("components");
5051
const [errors, setErrors] = useState<{ conf?: string; date?: unknown }>({});
5152
const [unpause, setUnpause] = useState(true);
5253
const [formError, setFormError] = useState(false);
@@ -67,7 +68,6 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
6768
const values = useWatch<BackfillFormProps>({
6869
control,
6970
});
70-
7171
const { data, isPending: isPendingDryRun } = useCreateBackfillDryRun({
7272
requestBody: {
7373
requestBody: {
@@ -81,9 +81,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
8181
},
8282
},
8383
});
84-
8584
const { mutate: togglePause } = useTogglePause({ dagId: dag.dag_id });
86-
8785
const { createBackfill, dateValidationError, error, isPending } = useCreateBackfill({
8886
onSuccessConfirm: onClose,
8987
});
@@ -141,13 +139,17 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
141139

142140
const inlineMessage = isPendingDryRun ? (
143141
<Skeleton height="20px" width="100px" />
142+
) : affectedTasks.total_entries > 1 ? (
143+
<Text color="fg.success" fontSize="sm">
144+
{translate("backfill.affectedOne")}
145+
</Text>
144146
) : affectedTasks.total_entries > 0 ? (
145147
<Text color="fg.success" fontSize="sm">
146-
{pluralize("run", affectedTasks.total_entries)} will be triggered
148+
{translate("backfill.affectedMultiple", { count: affectedTasks.total_entries })}
147149
</Text>
148150
) : (
149151
<Text color="fg.error" fontSize="sm" fontWeight="medium">
150-
No runs matching selected criteria.
152+
{translate("backfill.affectedNone")}
151153
</Text>
152154
);
153155

@@ -157,17 +159,17 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
157159
<VStack alignItems="stretch" gap={2} pt={4}>
158160
<Box>
159161
<Text fontSize="md" fontWeight="semibold" mb={3}>
160-
Date Range
162+
{translate("backfill.dateRange")}
161163
</Text>
162164
<HStack alignItems="flex-start" w="full">
163165
<Controller
164166
control={control}
165167
name="from_date"
166168
render={({ field }) => (
167169
<Field.Root invalid={Boolean(errors.date) || dataIntervalInvalid} required>
168-
<Field.Label>From</Field.Label>
170+
<Field.Label>{translate("backfill.dateRangeFrom")}</Field.Label>
169171
<DateTimeInput {...field} max={today} onBlur={resetDateError} size="sm" />
170-
<Field.ErrorText>Start Date must be before the End Date</Field.ErrorText>
172+
<Field.ErrorText>{translate("backfill.errorStartDateBeforeEndDate")}</Field.ErrorText>
171173
</Field.Root>
172174
)}
173175
/>
@@ -176,7 +178,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
176178
name="to_date"
177179
render={({ field }) => (
178180
<Field.Root invalid={Boolean(errors.date) || dataIntervalInvalid} required>
179-
<Field.Label>To</Field.Label>
181+
<Field.Label>{translate("backfill.dateRangeTo")}</Field.Label>
180182
<DateTimeInput {...field} max={today} onBlur={resetDateError} size="sm" />
181183
</Field.Root>
182184
)}
@@ -196,7 +198,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
196198
}}
197199
>
198200
<RadioCardLabel fontSize="md" fontWeight="semibold" mb={3}>
199-
Reprocess Behaviour
201+
{translate("backfill.reprocessBehavior")}
200202
</RadioCardLabel>
201203
<HStack>
202204
{reprocessBehaviors.map((item) => (
@@ -226,7 +228,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
226228
type="number"
227229
width={24}
228230
/>
229-
<Flex>Max Active Runs</Flex>
231+
<Flex>{translate("backfill.maxRuns")}</Flex>
230232
</HStack>
231233
)}
232234
/>
@@ -236,7 +238,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
236238
name="run_backwards"
237239
render={({ field }) => (
238240
<Checkbox checked={field.value} colorPalette="blue" onChange={field.onChange}>
239-
Run Backwards
241+
{translate("backfill.backwards")}
240242
</Checkbox>
241243
)}
242244
/>
@@ -249,7 +251,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
249251
onChange={() => setUnpause(!unpause)}
250252
wordBreak="break-all"
251253
>
252-
Unpause {dag.dag_display_name} on trigger
254+
{translate("backfill.unpause", { dag_display_name: dag.dag_display_name })}
253255
</Checkbox>
254256
<Spacer />
255257
</>
@@ -266,7 +268,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
266268
<Box as="footer" display="flex" justifyContent="flex-end" mt={4}>
267269
<HStack w="full">
268270
<Spacer />
269-
<Button onClick={() => void handleSubmit(onCancel)()}>Cancel</Button>
271+
<Button onClick={() => void handleSubmit(onCancel)()}>{translate("common:modal.cancel")}</Button>
270272
<Button
271273
colorPalette="blue"
272274
disabled={
@@ -275,7 +277,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
275277
loading={isPending}
276278
onClick={() => void handleSubmit(onSubmit)()}
277279
>
278-
Run Backfill
280+
{translate("backfill.run")}
279281
</Button>
280282
</HStack>
281283
</Box>

0 commit comments

Comments
 (0)