From 4393a94265da711c10e8cbe88ea9a85b69dabff3 Mon Sep 17 00:00:00 2001
From: Alexander Polyankin <alexander.polyankin@metabase.com>
Date: Fri, 11 Aug 2023 18:46:03 +0300
Subject: [PATCH] Fix dynamic message id in translations (#33122)

---
 .../33079-drill-underlying-records.cy.spec.js | 34 +++++++++++++++++++
 .../drill/UnderlyingRecordsDrill.ts           |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 e2e/test/scenarios/question/reproductions/33079-drill-underlying-records.cy.spec.js

diff --git a/e2e/test/scenarios/question/reproductions/33079-drill-underlying-records.cy.spec.js b/e2e/test/scenarios/question/reproductions/33079-drill-underlying-records.cy.spec.js
new file mode 100644
index 00000000000..ad6a9f55868
--- /dev/null
+++ b/e2e/test/scenarios/question/reproductions/33079-drill-underlying-records.cy.spec.js
@@ -0,0 +1,34 @@
+import { popover, restore } from "e2e/support/helpers";
+import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
+const { ORDERS, ORDERS_ID } = SAMPLE_DATABASE;
+
+const questionDetails = {
+  display: "line",
+  query: {
+    "source-table": ORDERS_ID,
+    aggregation: [["count"]],
+    breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }]],
+  },
+};
+
+describe("issue 33079", () => {
+  beforeEach(() => {
+    restore();
+    cy.signInAsAdmin();
+
+    cy.intercept("POST", "/api/dataset").as("dataset");
+    cy.request("GET", "/api/user/current").then(({ body: user }) => {
+      cy.request("PUT", `/api/user/${user.id}`, { locale: "de" });
+    });
+  });
+
+  it("underlying records drill should work in a non-English locale (metabase#33079)", () => {
+    cy.createQuestion(questionDetails, { visitQuestion: true });
+    cy.get(".dot").eq(1).click({ force: true });
+    popover()
+      .findByText(/Order/) // See these Orders
+      .click();
+    cy.wait("@dataset");
+    cy.findByTestId("question-row-count").should("contain", "19");
+  });
+});
diff --git a/frontend/src/metabase/modes/components/drill/UnderlyingRecordsDrill.ts b/frontend/src/metabase/modes/components/drill/UnderlyingRecordsDrill.ts
index 5a237a9f048..43b522b53d0 100644
--- a/frontend/src/metabase/modes/components/drill/UnderlyingRecordsDrill.ts
+++ b/frontend/src/metabase/modes/components/drill/UnderlyingRecordsDrill.ts
@@ -22,7 +22,8 @@ export const UnderlyingRecordsDrill: Drill = ({ question, clicked }) => {
       : ngettext(msgid`record`, `records`, rowCount);
 
   const actionTitle = ngettext(
-    msgid`See this ${tableTitle}`,
+    // extra argument is required to avoid a collision with a singular form translation (metabase#33079)
+    msgid`See this ${tableTitle}${""}`,
     `See these ${tableTitle}`,
     rowCount,
   );
-- 
GitLab