From 3bd34964cd3421f86321420e0c7a1b22965c6f58 Mon Sep 17 00:00:00 2001
From: Konrad <11725227+mKoonrad@users.noreply.github.com>
Date: Mon, 8 Dec 2025 23:18:38 +0100
Subject: [PATCH] fix(i18n): add pluralization to ai features (#2301)
---
.../dialogs/ai-field-detection-dialog.tsx | 25 ++++++++++++-----
.../dialogs/ai-recipient-detection-dialog.tsx | 27 +++++++++++++------
.../envelope-editor-recipient-form.tsx | 11 ++++++--
3 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx b/apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx
index a4798a5f7..748966960 100644
--- a/apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx
+++ b/apps/remix/app/components/dialogs/ai-field-detection-dialog.tsx
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import type { MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
-import { Trans } from '@lingui/react/macro';
+import { Plural, Trans } from '@lingui/react/macro';
import { CheckIcon, FormInputIcon, ShieldCheckIcon } from 'lucide-react';
import type { NormalizedFieldWithContext } from '@documenso/lib/server-only/ai/envelope/detect-fields/types';
@@ -232,10 +232,19 @@ export const AiFieldDetectionDialog = ({
{progress && (
-
- Page {progress.pagesProcessed} of {progress.totalPages} -{' '}
- {progress.fieldsDetected} field(s) found
-
+
+ Page {progress.pagesProcessed} of {progress.totalPages} - # field found
+
+ }
+ other={
+
+ Page {progress.pagesProcessed} of {progress.totalPages} - # fields found
+
+ }
+ />
)}
@@ -279,7 +288,11 @@ export const AiFieldDetectionDialog = ({
) : (
<>
- We found {detectedFields.length} field(s) in your document.
+
diff --git a/apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx b/apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx
index 4379a852f..cef7903c9 100644
--- a/apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx
+++ b/apps/remix/app/components/dialogs/ai-recipient-detection-dialog.tsx
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'react';
import { msg } from '@lingui/core/macro';
import { useLingui } from '@lingui/react';
-import { Trans } from '@lingui/react/macro';
+import { Plural, Trans } from '@lingui/react/macro';
import { CheckIcon, ShieldCheckIcon, UserIcon, XIcon } from 'lucide-react';
import { RECIPIENT_ROLES_DESCRIPTION } from '@documenso/lib/constants/recipient-roles';
@@ -190,10 +190,19 @@ export const AiRecipientDetectionDialog = ({
{progress && (
-
- Page {progress.pagesProcessed} of {progress.totalPages} -{' '}
- {progress.recipientsDetected} recipient(s) found
-
+
+ Page {progress.pagesProcessed} of {progress.totalPages} - # recipient found
+
+ }
+ other={
+
+ Page {progress.pagesProcessed} of {progress.totalPages} - # recipients found
+
+ }
+ />
)}
@@ -237,9 +246,11 @@ export const AiRecipientDetectionDialog = ({
) : (
<>
-
- We found {detectedRecipients.length} recipient(s) in your document.
-
+
diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx
index f8ba2d149..5b07d91bf 100644
--- a/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx
+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-recipient-form.tsx
@@ -8,6 +8,7 @@ import {
type SensorAPI,
} from '@hello-pangea/dnd';
import { zodResolver } from '@hookform/resolvers/zod';
+import { plural } from '@lingui/core/macro';
import { Trans, useLingui } from '@lingui/react/macro';
import { DocumentSigningOrder, EnvelopeType, RecipientRole, SendStatus } from '@prisma/client';
import { motion } from 'framer-motion';
@@ -329,8 +330,14 @@ export const EnvelopeEditorRecipientForm = () => {
});
toast({
- title: t`Recipients added`,
- description: t`${detectedRecipients.length} recipient(s) have been added from AI detection.`,
+ title: plural(detectedRecipients.length, {
+ one: `Recipient added`,
+ other: `Recipients added`,
+ }),
+ description: plural(detectedRecipients.length, {
+ one: `# recipient have been added from AI detection.`,
+ other: `# recipients have been added from AI detection.`,
+ }),
});
};