This is an automated email from the ASF dual-hosted git repository.

potiuk 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 75a814e72cc Replace manual count check with react-i18next plurals 
(#54818)
75a814e72cc is described below

commit 75a814e72cc2bb6cde9b42773b436ba3f40d60c7
Author: Guan Ming(Wesley) Chiu <[email protected]>
AuthorDate: Sat Aug 23 02:59:25 2025 +0800

    Replace manual count check with react-i18next plurals (#54818)
---
 airflow-core/src/airflow/ui/src/components/DurationChart.tsx   | 10 +++-------
 airflow-core/src/airflow/ui/src/components/Graph/TaskNode.tsx  |  4 +---
 .../src/airflow/ui/src/components/ui/DagWarningsModal.tsx      |  5 +----
 airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx    |  2 +-
 4 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/airflow-core/src/airflow/ui/src/components/DurationChart.tsx 
b/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
index 190ee70d496..b3a0b6ae1a4 100644
--- a/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DurationChart.tsx
@@ -99,13 +99,9 @@ export const DurationChart = ({
   return (
     <Box>
       <Heading pb={2} size="sm" textAlign="center">
-        {entries.length > 1
-          ? kind === "Dag Run"
-            ? translate("durationChart.lastDagRun_other", { count: 
entries.length })
-            : translate("durationChart.lastTaskInstance_other", { count: 
entries.length })
-          : kind === "Dag Run"
-            ? translate("durationChart.lastDagRun_one")
-            : translate("durationChart.lastTaskInstance_one")}
+        {kind === "Dag Run"
+          ? translate("durationChart.lastDagRun", { count: entries.length })
+          : translate("durationChart.lastTaskInstance", { count: 
entries.length })}
       </Heading>
       <Bar
         data={{
diff --git a/airflow-core/src/airflow/ui/src/components/Graph/TaskNode.tsx 
b/airflow-core/src/airflow/ui/src/components/Graph/TaskNode.tsx
index 79b421e787e..5f84881418d 100644
--- a/airflow-core/src/airflow/ui/src/components/Graph/TaskNode.tsx
+++ b/airflow-core/src/airflow/ui/src/components/Graph/TaskNode.tsx
@@ -127,9 +127,7 @@ export const TaskNode = ({
                 variant="plain"
               >
                 {isOpen ? "- " : "+ "}
-                {childCount !== undefined && childCount > 1
-                  ? translate("graph.taskCount_other", { count: childCount })
-                  : translate("graph.taskCount_one", { count: childCount ?? 0 
})}
+                {translate("graph.taskCount", { count: childCount ?? 0 })}
               </Button>
             ) : undefined}
           </Box>
diff --git a/airflow-core/src/airflow/ui/src/components/ui/DagWarningsModal.tsx 
b/airflow-core/src/airflow/ui/src/components/ui/DagWarningsModal.tsx
index 32090f16b8f..fd447b8e822 100644
--- a/airflow-core/src/airflow/ui/src/components/ui/DagWarningsModal.tsx
+++ b/airflow-core/src/airflow/ui/src/components/ui/DagWarningsModal.tsx
@@ -38,10 +38,7 @@ export const DAGWarningsModal: 
React.FC<ImportDAGErrorModalProps> = ({ error, on
   const heading = Boolean(error)
     ? warnings?.length !== undefined && warnings.length > 0
       ? translate("dagWarnings.errorAndWarning", {
-          warning:
-            warnings.length > 1
-              ? translate("dagWarnings.warning_other", { count: 
warnings.length })
-              : translate("dagWarnings.warning_one"),
+          warning: translate("dagWarnings.warning", { count: warnings.length 
}),
         })
       : translate("dagWarnings.error_one")
     : "";
diff --git a/airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx 
b/airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx
index 2cbae81555f..ac4b32f3ef9 100644
--- a/airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/DagsList/DagsList.tsx
@@ -280,7 +280,7 @@ export const DagsList = () => {
         <HStack justifyContent="space-between">
           <HStack>
             <Heading py={3} size="md">
-              {`${data?.total_entries ?? 0} ${(data?.total_entries ?? 0) === 1 
? translate("dag_one") : translate("dag_other")}`}
+              {`${data?.total_entries ?? 0} ${translate("dag", { count: 
data?.total_entries ?? 0 })}`}
             </Heading>
             <DAGImportErrors iconOnly />
           </HStack>

Reply via email to