Skip to content

The Open Source DocuSign Alternative.

fix(i18n): add pluralization to envelope items (#2183)

Konrad90f8340af406
diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-upload-page.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-upload-page.tsx
index 5fa911955..439c821a0 100644
--- a/apps/remix/app/components/general/envelope-editor/envelope-editor-upload-page.tsx
+++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-upload-page.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react';
import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd';
import type { DropResult } from '@hello-pangea/dnd';
-import { msg } from '@lingui/core/macro';
+import { msg, plural } from '@lingui/core/macro';
import { Trans, useLingui } from '@lingui/react/macro';
import { DocumentStatus } from '@prisma/client';
import { FileWarningIcon, GripVerticalIcon, Loader2 } from 'lucide-react';
@@ -226,7 +226,12 @@ export const EnvelopeEditorUploadPage = () => {
}
if (maximumEnvelopeItemCount <= localFiles.length) {
- return msg`You cannot upload more than ${maximumEnvelopeItemCount} items per envelope.`;
+ return msg({
+ message: plural(maximumEnvelopeItemCount, {
+ one: `You cannot upload more than # item per envelope.`,
+ other: `You cannot upload more than # items per envelope.`,
+ }),
+ });
}
return null;
@@ -240,7 +245,10 @@ export const EnvelopeEditorUploadPage = () => {
if (maxItemsReached) {
toast({
- title: t`You cannot upload more than ${maximumEnvelopeItemCount} items per envelope.`,
+ title: plural(maximumEnvelopeItemCount, {
+ one: `You cannot upload more than # item per envelope.`,
+ other: `You cannot upload more than # items per envelope.`,
+ }),
duration: 5000,
variant: 'destructive',
});
diff --git a/apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx b/apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx
index 374aa6d55..82ff02f81 100644
--- a/apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx
+++ b/apps/remix/app/components/general/envelope/envelope-drop-zone-wrapper.tsx
@@ -1,5 +1,6 @@
import { type ReactNode, useState } from 'react';
+import { plural } from '@lingui/core/macro';
import { useLingui } from '@lingui/react/macro';
import { Trans } from '@lingui/react/macro';
import { EnvelopeType } from '@prisma/client';
@@ -153,7 +154,10 @@ export const EnvelopeDropZoneWrapper = ({
if (maxItemsReached) {
toast({
- title: t`You cannot upload more than ${maximumEnvelopeItemCount} items per envelope.`,
+ title: plural(maximumEnvelopeItemCount, {
+ one: `You cannot upload more than # item per envelope.`,
+ other: `You cannot upload more than # items per envelope.`,
+ }),
duration: 5000,
variant: 'destructive',
});
diff --git a/apps/remix/app/components/general/envelope/envelope-upload-button.tsx b/apps/remix/app/components/general/envelope/envelope-upload-button.tsx
index 96a025c22..52e5a1311 100644
--- a/apps/remix/app/components/general/envelope/envelope-upload-button.tsx
+++ b/apps/remix/app/components/general/envelope/envelope-upload-button.tsx
@@ -1,6 +1,6 @@
import { useMemo, useState } from 'react';
-import { msg } from '@lingui/core/macro';
+import { msg, plural } from '@lingui/core/macro';
import { useLingui } from '@lingui/react/macro';
import { Trans } from '@lingui/react/macro';
import { EnvelopeType } from '@prisma/client';
@@ -153,7 +153,10 @@ export const EnvelopeUploadButton = ({ className, type, folderId }: EnvelopeUplo
if (maxItemsReached) {
toast({
- title: t`You cannot upload more than ${maximumEnvelopeItemCount} items per envelope.`,
+ title: plural(maximumEnvelopeItemCount, {
+ one: `You cannot upload more than # item per envelope.`,
+ other: `You cannot upload more than # items per envelope.`,
+ }),
duration: 5000,
variant: 'destructive',
});