RoyLee1224 commented on code in PR #50626:
URL: https://github.com/apache/airflow/pull/50626#discussion_r2094580201
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/TaskInstanceMetrics.tsx:
##########
@@ -53,36 +54,40 @@ export const TaskInstanceMetrics = ({
startDate,
taskInstanceStates,
total,
-}: TaskInstanceMetricsProps) => (
- <Box borderRadius={5} borderWidth={1} mt={2} p={4}>
- <HStack>
- <RouterLink
- to={`/task_instances?start_date=${startDate}${endDate === undefined ?
"" : `&end_date=${endDate}`}`}
- >
- <StateBadge colorPalette="blue" fontSize="md" variant="solid">
- <MdOutlineTask />
- {total}
- </StateBadge>
- </RouterLink>
- <Heading size="md">Task Instances</Heading>
- </HStack>
- <Separator my={3} />
- <Stack gap={4}>
- {TASK_STATES.sort((stateA, stateB) =>
- taskInstanceStates[stateA] > taskInstanceStates[stateB] ? -1 : 1,
- ).map((state) =>
- taskInstanceStates[state] > 0 ? (
- <MetricSection
- endDate={endDate}
- key={state}
- kind="task_instances"
- runs={taskInstanceStates[state]}
- startDate={startDate}
- state={state as TaskInstanceState}
- total={total}
- />
- ) : undefined,
- )}
- </Stack>
- </Box>
-);
+}: TaskInstanceMetricsProps) => {
+ const { t: translate } = useTranslation("dashboard");
+
+ return (
+ <Box borderRadius={5} borderWidth={1} mt={2} p={4}>
+ <HStack>
+ <RouterLink
+ to={`/task_instances?start_date=${startDate}${endDate === undefined
? "" : `&end_date=${endDate}`}`}
+ >
+ <StateBadge colorPalette="blue" fontSize="md" variant="solid">
+ <MdOutlineTask />
+ {total}
+ </StateBadge>
+ </RouterLink>
+ <Heading size="md">{translate("taskInstances", { count: total
})}</Heading>
Review Comment:
Quick update: I've successfully implemented the pluralization using the
standard i18next keys (`_one`, `_other`). It's working well right now.
I've also considered Shopify's nested format. It seems robust, especially
for handling languages with many plural forms (like Arabic, which has 5 plural
forms besides the singular), but I feel the standard i18next suffixes (`_one`,
`_other`, `_few`, etc.) are quite effective and sufficient for our current
scope(English, Mandarin, German).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]