Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

feat(i18n): localize Atomic CRM UI labels and messages

Anibal Svarcas80208f9a3bca
diff --git a/src/components/atomic-crm/companies/CompanyEmpty.tsx b/src/components/atomic-crm/companies/CompanyEmpty.tsx
index 90cd66d2..d1b3e2f3 100644
--- a/src/components/atomic-crm/companies/CompanyEmpty.tsx
+++ b/src/components/atomic-crm/companies/CompanyEmpty.tsx
@@ -1,9 +1,11 @@
import { CreateButton } from "@/components/admin/create-button";
+import { useTranslate } from "ra-core";
import useAppBarHeight from "../misc/useAppBarHeight";
export const CompanyEmpty = () => {
const appbarHeight = useAppBarHeight();
+ const translate = useTranslate();
return (
<div
className="flex flex-col justify-center items-center gap-6"
@@ -11,15 +13,24 @@ export const CompanyEmpty = () => {
height: `calc(100dvh - ${appbarHeight}px)`,
}}
>
- <img src="./img/empty.svg" alt="No companies found" />
+ <img
+ src="./img/empty.svg"
+ alt={translate("crm.companies.empty.title", {
+ _: "No companies found",
+ })}
+ />
<div className="flex flex-col gap-0 items-center">
- <h6 className="text-lg font-bold">No companies found</h6>
+ <h6 className="text-lg font-bold">
+ {translate("crm.companies.empty.title", { _: "No companies found" })}
+ </h6>
<p className="text-sm text-center text-muted-foreground mb-4">
- It seems your company list is empty.
+ {translate("crm.companies.empty.description", {
+ _: "It seems your company list is empty.",
+ })}
</p>
</div>
<div className="flex space-x-2">
- <CreateButton label="Create Company" />
+ <CreateButton label="crm.companies.action.create" />
</div>
</div>
);
diff --git a/src/components/atomic-crm/companies/CompanyInputs.tsx b/src/components/atomic-crm/companies/CompanyInputs.tsx
index 5c819c0c..1d55a17c 100644
--- a/src/components/atomic-crm/companies/CompanyInputs.tsx
+++ b/src/components/atomic-crm/companies/CompanyInputs.tsx
@@ -1,4 +1,4 @@
-import { required, useRecordContext } from "ra-core";
+import { required, useRecordContext, useTranslate } from "ra-core";
import { ReferenceInput } from "@/components/admin/reference-input";
import { TextInput } from "@/components/admin/text-input";
import { SelectInput } from "@/components/admin/select-input";
@@ -46,6 +46,7 @@ export const CompanyInputs = () => {
};
const CompanyDisplayInputs = () => {
+ const translate = useTranslate();
const record = useRecordContext<Company>();
return (
<div className="flex gap-4 flex-1 flex-row">
@@ -62,16 +63,21 @@ const CompanyDisplayInputs = () => {
className="w-full h-fit"
validate={required()}
helperText={false}
- placeholder="Company name"
+ placeholder={translate("resources.companies.fields.name", {
+ _: "Company name",
+ })}
/>
</div>
);
};
const CompanyContactInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Contact</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.companies.inputs.contact", { _: "Contact" })}
+ </h6>
<TextInput source="website" helperText={false} validate={isUrl} />
<TextInput
source="linkedin_url"
@@ -84,10 +90,13 @@ const CompanyContactInputs = () => {
};
const CompanyContextInputs = () => {
+ const translate = useTranslate();
const { companySectors } = useConfigurationContext();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Context</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.companies.inputs.context", { _: "Context" })}
+ </h6>
<SelectInput
source="sector"
choices={companySectors}
@@ -103,9 +112,12 @@ const CompanyContextInputs = () => {
};
const CompanyAddressInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Address</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.companies.inputs.address", { _: "Address" })}
+ </h6>
<TextInput source="address" helperText={false} />
<TextInput source="city" helperText={false} />
<TextInput source="zipcode" helperText={false} />
@@ -116,9 +128,14 @@ const CompanyAddressInputs = () => {
};
const CompanyAdditionalInformationInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Additional information</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.companies.inputs.additional_information", {
+ _: "Additional information",
+ })}
+ </h6>
<TextInput source="description" multiline helperText={false} />
<ArrayInput source="context_links" helperText={false}>
<SimpleFormIterator disableReordering fullWidth getItemLabel={false}>
@@ -135,9 +152,12 @@ const CompanyAdditionalInformationInputs = () => {
};
const CompanyAccountManagerInput = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Account manager</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.common.account_manager", { _: "Account manager" })}
+ </h6>
<ReferenceInput
source="sales_id"
reference="sales"
@@ -146,7 +166,7 @@ const CompanyAccountManagerInput = () => {
}}
>
<SelectInput
- label="Account manager"
+ label="crm.common.account_manager"
helperText={false}
optionText={saleOptionRenderer}
/>
diff --git a/src/components/atomic-crm/companies/CompanyShow.tsx b/src/components/atomic-crm/companies/CompanyShow.tsx
index e726578a..c5cdd453 100644
--- a/src/components/atomic-crm/companies/CompanyShow.tsx
+++ b/src/components/atomic-crm/companies/CompanyShow.tsx
@@ -11,6 +11,7 @@ import {
useListContext,
useRecordContext,
useShowContext,
+ useTranslate,
} from "ra-core";
import {
Link,
@@ -51,6 +52,7 @@ export const CompanyShow = () => {
};
const CompanyShowContentMobile = () => {
+ const translate = useTranslate();
const { record, isPending } = useShowContext<Company>();
if (isPending || !record) return null;
@@ -60,7 +62,11 @@ const CompanyShowContentMobile = () => {
<MobileBackButton to="/" />
<div className="flex flex-1">
<Link to="/">
- <h1 className="text-xl font-semibold">Company</h1>
+ <h1 className="text-xl font-semibold">
+ {translate("resources.companies.forcedCaseName", {
+ _: "Company",
+ })}
+ </h1>
</Link>
</div>
</MobileHeader>
@@ -84,6 +90,7 @@ const CompanyShowContentMobile = () => {
};
const CompanyShowContent = () => {
+ const translate = useTranslate();
const { record, isPending } = useShowContext<Company>();
const navigate = useNavigate();
@@ -113,19 +120,31 @@ const CompanyShowContent = () => {
</div>
<Tabs defaultValue={currentTab} onValueChange={handleTabChange}>
<TabsList className="grid w-full grid-cols-3">
- <TabsTrigger value="activity">Activity</TabsTrigger>
+ <TabsTrigger value="activity">
+ {translate("crm.common.activity", { _: "Activity" })}
+ </TabsTrigger>
<TabsTrigger value="contacts">
{record.nb_contacts
? record.nb_contacts === 1
- ? "1 Contact"
- : `${record.nb_contacts} Contacts`
- : "No Contacts"}
+ ? translate("crm.companies.contacts.one", {
+ _: "1 Contact",
+ })
+ : translate("crm.companies.contacts.many", {
+ smart_count: record.nb_contacts,
+ _: `${record.nb_contacts} Contacts`,
+ })
+ : translate("crm.companies.contacts.none", {
+ _: "No Contacts",
+ })}
</TabsTrigger>
{record.nb_deals ? (
<TabsTrigger value="deals">
{record.nb_deals === 1
- ? "1 deal"
- : `${record.nb_deals} deals`}
+ ? translate("crm.companies.deals.one", { _: "1 deal" })
+ : translate("crm.companies.deals.many", {
+ smart_count: record.nb_deals,
+ _: `${record.nb_deals} deals`,
+ })}
</TabsTrigger>
) : null}
</TabsList>
@@ -180,6 +199,7 @@ const CompanyShowContent = () => {
};
const ContactsIterator = () => {
+ const translate = useTranslate();
const location = useLocation();
const { data: contacts, error, isPending } = useListContext<Contact>();
@@ -206,9 +226,13 @@ const ContactsIterator = () => {
<div className="text-sm text-muted-foreground">
{contact.title}
{contact.nb_tasks
- ? ` - ${contact.nb_tasks} task${
- contact.nb_tasks > 1 ? "s" : ""
- }`
+ ? ` - ${contact.nb_tasks} ${translate(
+ "crm.common.task_count",
+ {
+ smart_count: contact.nb_tasks,
+ _: contact.nb_tasks > 1 ? "tasks" : "task",
+ },
+ )}`
: ""}
&nbsp; &nbsp;
<TagsList />
@@ -217,7 +241,11 @@ const ContactsIterator = () => {
{contact.last_seen && (
<div className="text-right">
<div className="text-sm text-muted-foreground">
- last activity {formatDistance(contact.last_seen, now)} ago{" "}
+ {translate("crm.common.last_activity", {
+ _: "last activity",
+ })}{" "}
+ {formatDistance(contact.last_seen, now)}{" "}
+ {translate("crm.common.ago", { _: "ago" })}{" "}
<Status status={contact.status} />
</div>
</div>
@@ -231,6 +259,7 @@ const ContactsIterator = () => {
};
const CreateRelatedContactButton = () => {
+ const translate = useTranslate();
const company = useRecordContext<Company>();
return (
<Button variant="outline" asChild size="sm" className="h-9">
@@ -240,13 +269,14 @@ const CreateRelatedContactButton = () => {
className="flex items-center gap-2"
>
<UserPlus className="h-4 w-4" />
- Add contact
+ {translate("crm.contacts.action.add", { _: "Add contact" })}
</RouterLink>
</Button>
);
};
const DealsIterator = () => {
+ const translate = useTranslate();
const { data: deals, error, isPending } = useListContext<Deal>();
const { dealStages, dealCategories } = useConfigurationContext();
if (isPending || error) return null;
@@ -279,7 +309,11 @@ const DealsIterator = () => {
</div>
<div className="text-right">
<div className="text-sm text-muted-foreground">
- last activity {formatDistance(deal.updated_at, now)} ago{" "}
+ {translate("crm.common.last_activity", {
+ _: "last activity",
+ })}{" "}
+ {formatDistance(deal.updated_at, now)}{" "}
+ {translate("crm.common.ago", { _: "ago" })}{" "}
</div>
</div>
</RouterLink>
diff --git a/src/components/atomic-crm/companies/GridList.tsx b/src/components/atomic-crm/companies/GridList.tsx
index 9bf1b4ab..1ecaa701 100644
--- a/src/components/atomic-crm/companies/GridList.tsx
+++ b/src/components/atomic-crm/companies/GridList.tsx
@@ -1,4 +1,4 @@
-import { RecordContextProvider, useListContext } from "ra-core";
+import { RecordContextProvider, useListContext, useTranslate } from "ra-core";
import type { Company } from "../types";
import { CompanyCard } from "./CompanyCard";
@@ -19,6 +19,7 @@ const LoadingGridList = () => (
const LoadedGridList = () => {
const { data, error, isPending } = useListContext<Company>();
+ const translate = useTranslate();
if (isPending || error) return null;
@@ -35,7 +36,11 @@ const LoadedGridList = () => {
</RecordContextProvider>
))}
- {data.length === 0 && <div className="p-2">No companies found</div>}
+ {data.length === 0 && (
+ <div className="p-2">
+ {translate("crm.companies.empty.title", { _: "No companies found" })}
+ </div>
+ )}
</div>
);
};
diff --git a/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx b/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
index c891d764..b632d7e4 100644
--- a/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
+++ b/src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx
@@ -1,4 +1,4 @@
-import { useRecordContext, WithRecord } from "ra-core";
+import { useRecordContext, useTranslate, WithRecord } from "ra-core";
import { ReferenceField } from "@/components/admin/reference-field";
import { TextField } from "@/components/admin/text-field";
import { DateField } from "@/components/admin/date-field";
@@ -7,6 +7,7 @@ import type { Contact } from "../types";
export const ContactBackgroundInfo = () => {
const record = useRecordContext<Contact>();
+ const translate = useTranslate();
if (!record) return null;
@@ -22,7 +23,9 @@ export const ContactBackgroundInfo = () => {
}
/>
<div className="text-muted-foreground md:py-0.5">
- <span className="text-sm">Added on</span>{" "}
+ <span className="text-sm">
+ {translate("crm.contacts.background.added_on", { _: "Added on" })}
+ </span>{" "}
<DateField
source="first_seen"
options={{ year: "numeric", month: "long", day: "numeric" }}
@@ -31,7 +34,11 @@ export const ContactBackgroundInfo = () => {
</div>
<div className="text-muted-foreground md:py-0.5">
- <span className="text-sm">Last activity on</span>{" "}
+ <span className="text-sm">
+ {translate("crm.contacts.background.last_activity_on", {
+ _: "Last activity on",
+ })}
+ </span>{" "}
<DateField
source="last_seen"
options={{ year: "numeric", month: "long", day: "numeric" }}
@@ -40,7 +47,10 @@ export const ContactBackgroundInfo = () => {
</div>
<div className="inline-flex text-muted-foreground text-sm md:py-0.5">
- Followed by&nbsp;
+ {translate("crm.contacts.background.followed_by", {
+ _: "Followed by",
+ })}
+ &nbsp;
<ReferenceField source="sales_id" reference="sales">
<SaleName />
</ReferenceField>
diff --git a/src/components/atomic-crm/contacts/ContactEmpty.tsx b/src/components/atomic-crm/contacts/ContactEmpty.tsx
index 5c4f05a4..c9a2db0e 100644
--- a/src/components/atomic-crm/contacts/ContactEmpty.tsx
+++ b/src/components/atomic-crm/contacts/ContactEmpty.tsx
@@ -2,6 +2,7 @@ import { CreateButton } from "@/components/admin/create-button";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Plus } from "lucide-react";
+import { useTranslate } from "ra-core";
import useAppBarHeight from "../misc/useAppBarHeight";
import { ContactImportButton } from "./ContactImportButton";
@@ -11,6 +12,7 @@ import { useIsMobile } from "@/hooks/use-mobile";
export const ContactEmpty = () => {
const appbarHeight = useAppBarHeight();
const isMobile = useIsMobile();
+ const translate = useTranslate();
const [createOpen, setCreateOpen] = useState(false);
return (
<>
@@ -21,11 +23,20 @@ export const ContactEmpty = () => {
height: `calc(100dvh - ${appbarHeight}px)`,
}}
>
- <img src="./img/empty.svg" alt="No contacts found" />
+ <img
+ src="./img/empty.svg"
+ alt={translate("crm.contacts.empty.title", {
+ _: "No contacts found",
+ })}
+ />
<div className="flex flex-col gap-0 items-center">
- <h6 className="text-lg font-bold">No contacts found</h6>
+ <h6 className="text-lg font-bold">
+ {translate("crm.contacts.empty.title", { _: "No contacts found" })}
+ </h6>
<p className="text-sm text-muted-foreground text-center mb-4">
- It seems your contact list is empty.
+ {translate("crm.contacts.empty.description", {
+ _: "It seems your contact list is empty.",
+ })}
</p>
</div>
<div className="flex flex-row gap-2">
@@ -36,11 +47,11 @@ export const ContactEmpty = () => {
className="gap-2"
>
<Plus className="h-4 w-4" />
- New Contact
+ {translate("crm.contacts.action.new", { _: "New Contact" })}
</Button>
) : (
<>
- <CreateButton label="New Contact" />
+ <CreateButton label="crm.contacts.action.new" />
<ContactImportButton />
</>
)}
diff --git a/src/components/atomic-crm/contacts/ContactImportButton.tsx b/src/components/atomic-crm/contacts/ContactImportButton.tsx
index 147533da..99252d12 100644
--- a/src/components/atomic-crm/contacts/ContactImportButton.tsx
+++ b/src/components/atomic-crm/contacts/ContactImportButton.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import type { MouseEvent } from "react";
import { Upload, Loader2 } from "lucide-react";
-import { Form, useRefresh } from "ra-core";
+import { Form, useRefresh, useTranslate } from "ra-core";
import { Link } from "react-router";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
@@ -21,6 +21,7 @@ import { useContactImport } from "./useContactImport";
import * as sampleCsv from "./contacts_export.csv?raw";
export const ContactImportButton = () => {
+ const translate = useTranslate();
const [modalOpen, setModalOpen] = useState(false);
const handleOpenModal = () => {
@@ -38,7 +39,8 @@ export const ContactImportButton = () => {
onClick={handleOpenModal}
className="flex items-center gap-2 cursor-pointer"
>
- <Upload /> Import CSV
+ <Upload />{" "}
+ {translate("crm.contacts.import.button", { _: "Import CSV" })}
</Button>
<ContactImportDialog open={modalOpen} onClose={handleCloseModal} />
</>
@@ -58,6 +60,7 @@ export function ContactImportDialog({
open,
onClose,
}: ContactImportModalProps) {
+ const translate = useTranslate();
const refresh = useRefresh();
const processBatch = useContactImport();
const { importer, parseCsv, reset } = usePapaParse<ContactImportSchema>({
@@ -97,7 +100,9 @@ export function ContactImportDialog({
<DialogContent className="max-w-2xl">
<Form className="flex flex-col gap-4">
<DialogHeader>
- <DialogTitle>Import</DialogTitle>
+ <DialogTitle>
+ {translate("crm.import.action.import", { _: "Import" })}
+ </DialogTitle>
</DialogHeader>
<div className="flex flex-col space-y-2">
@@ -106,20 +111,30 @@ export function ContactImportDialog({
<Alert>
<AlertDescription className="flex flex-row gap-4">
<Loader2 className="h-5 w-5 animate-spin" />
- The import is running, please do not close this tab.
+ {translate("crm.contacts.import.running", {
+ _: "The import is running, please do not close this tab.",
+ })}
</AlertDescription>
</Alert>
<div className="text-sm">
- Imported{" "}
+ {translate("crm.contacts.import.imported", { _: "Imported" })}{" "}
<strong>
{importer.importCount} / {importer.rowCount}
</strong>{" "}
- contacts, with <strong>{importer.errorCount}</strong> errors.
+ {translate("resources.contacts.name", {
+ smart_count: 2,
+ _: "contacts",
+ })}
+ , {translate("crm.common.with", { _: "with" })}{" "}
+ <strong>{importer.errorCount}</strong>{" "}
+ {translate("crm.common.errors", { _: "errors" })}.
{importer.remainingTime !== null && (
<>
{" "}
- Estimated remaining time:{" "}
+ {translate("crm.contacts.import.remaining_time", {
+ _: "Estimated remaining time:",
+ })}{" "}
<strong>
{millisecondsToTime(importer.remainingTime)}
</strong>
@@ -128,7 +143,9 @@ export function ContactImportDialog({
onClick={handleReset}
className="text-red-600 underline hover:text-red-800"
>
- Stop import
+ {translate("crm.contacts.import.stop", {
+ _: "Stop import",
+ })}
</button>
</>
)}
@@ -139,8 +156,9 @@ export function ContactImportDialog({
{importer.state === "error" && (
<Alert variant="destructive">
<AlertDescription>
- Failed to import this file, please make sure your provided a
- valid CSV file.
+ {translate("crm.contacts.import.error", {
+ _: "Failed to import this file, please make sure your provided a valid CSV file.",
+ })}
</AlertDescription>
</Alert>
)}
@@ -148,8 +166,9 @@ export function ContactImportDialog({
{importer.state === "complete" && (
<Alert>
<AlertDescription>
- Contacts import complete. Imported {importer.importCount}{" "}
- contacts, with {importer.errorCount} errors
+ {translate("crm.contacts.import.complete", {
+ _: `Contacts import complete. Imported ${importer.importCount} contacts, with ${importer.errorCount} errors`,
+ })}
</AlertDescription>
</Alert>
)}
@@ -158,13 +177,17 @@ export function ContactImportDialog({
<>
<Alert>
<AlertDescription className="flex flex-col gap-4">
- Here is a sample CSV file you can use as a template
+ {translate("crm.contacts.import.sample_hint", {
+ _: "Here is a sample CSV file you can use as a template",
+ })}
<Button asChild variant="outline" size="sm">
<Link
to={SAMPLE_URL}
download={"crm_contacts_sample.csv"}
>
- Download CSV sample
+ {translate("crm.contacts.import.sample_download", {
+ _: "Download CSV sample",
+ })}
</Link>
</Button>{" "}
</AlertDescription>
@@ -172,7 +195,7 @@ export function ContactImportDialog({
<FileInput
source="csv"
- label="CSV File"
+ label="crm.contacts.import.csv_file"
accept={{ "text/csv": [".csv"] }}
onChange={handleFileChange}
>
@@ -187,7 +210,7 @@ export function ContactImportDialog({
<FormToolbar>
{importer.state === "idle" ? (
<Button onClick={startImport} disabled={!file}>
- Import
+ {translate("crm.import.action.import", { _: "Import" })}
</Button>
) : (
<Button
@@ -195,7 +218,7 @@ export function ContactImportDialog({
onClick={handleClose}
disabled={importer.state === "running"}
>
- Close
+ {translate("ra.action.close", { _: "Close" })}
</Button>
)}
</FormToolbar>
diff --git a/src/components/atomic-crm/contacts/ContactInputs.tsx b/src/components/atomic-crm/contacts/ContactInputs.tsx
index 73be197f..ba4ec976 100644
--- a/src/components/atomic-crm/contacts/ContactInputs.tsx
+++ b/src/components/atomic-crm/contacts/ContactInputs.tsx
@@ -1,4 +1,4 @@
-import { email, required } from "ra-core";
+import { email, required, useTranslate } from "ra-core";
import type { FocusEvent, ClipboardEventHandler } from "react";
import { useFormContext } from "react-hook-form";
import { Separator } from "@/components/ui/separator";
@@ -43,9 +43,12 @@ export const ContactInputs = () => {
};
const ContactIdentityInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Identity</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.contacts.inputs.identity", { _: "Identity" })}
+ </h6>
<RadioButtonGroupInput
label={false}
row
@@ -63,9 +66,12 @@ const ContactIdentityInputs = () => {
};
const ContactPositionInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Position</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.contacts.inputs.position", { _: "Position" })}
+ </h6>
<TextInput source="title" helperText={false} />
<ReferenceInput source="company_id" reference="companies" perPage={10}>
<AutocompleteCompanyInput />
@@ -75,6 +81,7 @@ const ContactPositionInputs = () => {
};
const ContactPersonalInformationInputs = () => {
+ const translate = useTranslate();
const { getValues, setValue } = useFormContext();
// set first and last name based on email
@@ -105,10 +112,12 @@ const ContactPersonalInformationInputs = () => {
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Personal info</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.contacts.inputs.personal_info", { _: "Personal info" })}
+ </h6>
<ArrayInput
source="email_jsonb"
- label="Email addresses"
+ label="crm.contacts.inputs.email_addresses"
helperText={false}
>
<SimpleFormIterator
@@ -122,7 +131,7 @@ const ContactPersonalInformationInputs = () => {
className="w-full"
helperText={false}
label={false}
- placeholder="Email"
+ placeholder={translate("crm.contacts.inputs.email", { _: "Email" })}
validate={email()}
onPaste={handleEmailPaste}
onBlur={handleEmailBlur}
@@ -138,7 +147,11 @@ const ContactPersonalInformationInputs = () => {
/>
</SimpleFormIterator>
</ArrayInput>
- <ArrayInput source="phone_jsonb" label="Phone numbers" helperText={false}>
+ <ArrayInput
+ source="phone_jsonb"
+ label="crm.contacts.inputs.phone_numbers"
+ helperText={false}
+ >
<SimpleFormIterator
inline
disableReordering
@@ -150,7 +163,9 @@ const ContactPersonalInformationInputs = () => {
className="w-full"
helperText={false}
label={false}
- placeholder="Phone number"
+ placeholder={translate("crm.contacts.inputs.phone_number", {
+ _: "Phone number",
+ })}
/>
<SelectInput
source="type"
@@ -165,7 +180,7 @@ const ContactPersonalInformationInputs = () => {
</ArrayInput>
<TextInput
source="linkedin_url"
- label="Linkedin URL"
+ label="crm.contacts.inputs.linkedin_url"
helperText={false}
validate={isLinkedinUrl}
/>
@@ -176,12 +191,15 @@ const ContactPersonalInformationInputs = () => {
const personalInfoTypes = [{ id: "Work" }, { id: "Home" }, { id: "Other" }];
const ContactMiscInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
- <h6 className="text-lg font-semibold">Misc</h6>
+ <h6 className="text-lg font-semibold">
+ {translate("crm.common.misc", { _: "Misc" })}
+ </h6>
<TextInput
source="background"
- label="Background info (bio, how you met, etc)"
+ label="crm.contacts.inputs.background_info"
multiline
helperText={false}
/>
@@ -196,7 +214,7 @@ const ContactMiscInputs = () => {
>
<SelectInput
helperText={false}
- label="Account manager"
+ label="crm.common.account_manager"
optionText={saleOptionRenderer}
validate={required()}
/>
diff --git a/src/components/atomic-crm/contacts/ContactListContent.tsx b/src/components/atomic-crm/contacts/ContactListContent.tsx
index b3264956..02f6845f 100644
--- a/src/components/atomic-crm/contacts/ContactListContent.tsx
+++ b/src/components/atomic-crm/contacts/ContactListContent.tsx
@@ -6,6 +6,7 @@ import {
RecordRepresentation,
useListContext,
useTimeout,
+ useTranslate,
} from "ra-core";
import { type MouseEvent, useCallback, useRef } from "react";
import { Link } from "react-router";
@@ -22,6 +23,7 @@ import { Avatar } from "./Avatar";
import { TagsList } from "./TagsList";
export const ContactListContent = () => {
+ const translate = useTranslate();
const {
data: contacts,
error,
@@ -85,7 +87,9 @@ export const ContactListContent = () => {
{contacts.length === 0 && (
<div className="p-4">
- <div className="text-muted-foreground">No contacts found</div>
+ <div className="text-muted-foreground">
+ {translate("crm.contacts.empty.title", { _: "No contacts found" })}
+ </div>
</div>
)}
</div>
@@ -99,6 +103,7 @@ const ContactItemContent = ({
contact: Contact;
handleToggleItem: (id: Identifier, event: MouseEvent) => void;
}) => {
+ const translate = useTranslate();
const { selectedIds } = useListContext<Contact>();
const now = Date.now();
@@ -125,7 +130,9 @@ const ContactItemContent = ({
{contact.title || contact.company_id != null || contact.nb_tasks ? (
<div className="text-sm text-muted-foreground">
{contact.title}
- {contact.title && contact.company_id != null && " at "}
+ {contact.title &&
+ contact.company_id != null &&
+ ` ${translate("crm.common.at", { _: "at" })} `}
{contact.company_id != null && (
<ReferenceField
source="company_id"
@@ -136,7 +143,10 @@ const ContactItemContent = ({
</ReferenceField>
)}
{contact.nb_tasks
- ? ` - ${contact.nb_tasks} task${contact.nb_tasks > 1 ? "s" : ""}`
+ ? ` - ${contact.nb_tasks} ${translate("crm.common.task_count", {
+ smart_count: contact.nb_tasks,
+ _: contact.nb_tasks > 1 ? "tasks" : "task",
+ })}`
: ""}
&nbsp;&nbsp;
<TagsList />
@@ -149,7 +159,7 @@ const ContactItemContent = ({
className="text-sm text-muted-foreground"
title={contact.last_seen}
>
- {"last activity "}
+ {`${translate("crm.common.last_activity", { _: "last activity" })} `}
{formatRelative(contact.last_seen, now)}{" "}
<Status status={contact.status} />
</div>
@@ -161,6 +171,7 @@ const ContactItemContent = ({
};
export const ContactListContentMobile = () => {
+ const translate = useTranslate();
const {
data: contacts,
error,
@@ -197,7 +208,9 @@ export const ContactListContentMobile = () => {
return (
<div className="p-4">
<div className="text-center text-muted-foreground mb-4">
- Error loading contacts
+ {translate("crm.contacts.list.error_loading", {
+ _: "Error loading contacts",
+ })}
</div>
<div className="text-center mt-2">
<Button
@@ -206,7 +219,7 @@ export const ContactListContentMobile = () => {
}}
>
<RotateCcw />
- Retry
+ {translate("crm.common.retry", { _: "Retry" })}
</Button>
</div>
</div>
@@ -222,50 +235,61 @@ export const ContactListContentMobile = () => {
))}
{contacts.length === 0 && (
<div className="p-4">
- <div className="text-muted-foreground">No contacts found</div>
+ <div className="text-muted-foreground">
+ {translate("crm.contacts.empty.title", { _: "No contacts found" })}
+ </div>
</div>
)}
</div>
);
};
-const ContactItemContentMobile = ({ contact }: { contact: Contact }) => (
- <Link
- to={`/contacts/${contact.id}/show`}
- className="flex flex-row gap-4 items-center py-2 hover:bg-muted transition-colors"
- >
- <Avatar />
- <div className="flex flex-col grow justify-between">
- <div className="flex-1 min-w-0">
- <div className="flex justify-between">
- <div className="font-medium">
- <RecordRepresentation />
+const ContactItemContentMobile = ({ contact }: { contact: Contact }) => {
+ const translate = useTranslate();
+ return (
+ <Link
+ to={`/contacts/${contact.id}/show`}
+ className="flex flex-row gap-4 items-center py-2 hover:bg-muted transition-colors"
+ >
+ <Avatar />
+ <div className="flex flex-col grow justify-between">
+ <div className="flex-1 min-w-0">
+ <div className="flex justify-between">
+ <div className="font-medium">
+ <RecordRepresentation />
+ </div>
+ <Status status={contact.status} />
</div>
- <Status status={contact.status} />
- </div>
- <div className="text-sm text-muted-foreground">
- <div className="flex flex-col gap-1">
- <span>
- {contact.title}
- {contact.title && contact.company_id != null && " at "}
- {contact.company_id != null && (
- <ReferenceField
- source="company_id"
- reference="companies"
- link={false}
- >
- <TextField source="name" />
- </ReferenceField>
- )}
- </span>
- {contact.nb_tasks ? (
+ <div className="text-sm text-muted-foreground">
+ <div className="flex flex-col gap-1">
<span>
- {contact.nb_tasks} task{contact.nb_tasks > 1 ? "s" : ""}
+ {contact.title}
+ {contact.title &&
+ contact.company_id != null &&
+ ` ${translate("crm.common.at", { _: "at" })} `}
+ {contact.company_id != null && (
+ <ReferenceField
+ source="company_id"
+ reference="companies"
+ link={false}
+ >
+ <TextField source="name" />
+ </ReferenceField>
+ )}
</span>
- ) : null}
+ {contact.nb_tasks ? (
+ <span>
+ {contact.nb_tasks}{" "}
+ {translate("crm.common.task_count", {
+ smart_count: contact.nb_tasks,
+ _: contact.nb_tasks > 1 ? "tasks" : "task",
+ })}
+ </span>
+ ) : null}
+ </div>
</div>
</div>
</div>
- </div>
- </Link>
-);
+ </Link>
+ );
+};
diff --git a/src/components/atomic-crm/contacts/ContactMergeButton.tsx b/src/components/atomic-crm/contacts/ContactMergeButton.tsx
index 0c908d63..fffe6803 100644
--- a/src/components/atomic-crm/contacts/ContactMergeButton.tsx
+++ b/src/components/atomic-crm/contacts/ContactMergeButton.tsx
@@ -9,6 +9,7 @@ import {
Form,
useNotify,
useRedirect,
+ useTranslate,
} from "ra-core";
import type { Identifier } from "ra-core";
import { useMutation } from "@tanstack/react-query";
@@ -28,6 +29,7 @@ import type { Contact } from "../types";
import { contactOptionText } from "../misc/ContactOption";
export const ContactMergeButton = () => {
+ const translate = useTranslate();
const [mergeDialogOpen, setMergeDialogOpen] = useState(false);
return (
<>
@@ -38,7 +40,9 @@ export const ContactMergeButton = () => {
onClick={() => setMergeDialogOpen(true)}
>
<Merge className="w-4 h-4" />
- Merge with another contact
+ {translate("crm.contacts.merge.action", {
+ _: "Merge with another contact",
+ })}
</Button>
<ContactMergeDialog
open={mergeDialogOpen}
@@ -57,6 +61,7 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
const loserContact = useRecordContext<Contact>();
const notify = useNotify();
const redirect = useRedirect();
+ const translate = useTranslate();
const dataProvider = useDataProvider();
const [winnerId, setWinnerId] = useState<Identifier | null>(null);
const [suggestedWinnerId, setSuggestedWinnerId] = useState<Identifier | null>(
@@ -125,7 +130,12 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
const handleMerge = async () => {
if (!winnerId || !loserContact) {
- notify("Please select a contact to merge with", { type: "warning" });
+ notify("crm.contacts.merge.select_target", {
+ type: "warning",
+ messageArgs: {
+ _: "Please select a contact to merge with",
+ },
+ });
return;
}
@@ -133,12 +143,22 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
setIsMerging(true);
await mutateAsync();
setIsMerging(false);
- notify("Contacts merged successfully", { type: "success" });
+ notify("crm.contacts.merge.success", {
+ type: "success",
+ messageArgs: {
+ _: "Contacts merged successfully",
+ },
+ });
redirect(`/contacts/${winnerId}/show`);
onClose();
} catch (error) {
setIsMerging(false);
- notify("Failed to merge contacts", { type: "error" });
+ notify("crm.contacts.merge.error", {
+ type: "error",
+ messageArgs: {
+ _: "Failed to merge contacts",
+ },
+ });
console.error("Merge failed:", error);
}
};
@@ -149,16 +169,22 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
<Dialog open={open} onOpenChange={onClose}>
<DialogContent className="md:min-w-lg max-w-2xl">
<DialogHeader>
- <DialogTitle>Merge Contact</DialogTitle>
+ <DialogTitle>
+ {translate("crm.contacts.merge.title", { _: "Merge Contact" })}
+ </DialogTitle>
<DialogDescription>
- Merge this contact with another one.
+ {translate("crm.contacts.merge.description", {
+ _: "Merge this contact with another one.",
+ })}
</DialogDescription>
</DialogHeader>
<div className="space-y-4">
<div className="p-4 bg-primary/5 rounded-lg border border-primary/20">
<p className="font-medium text-sm">
- Current Contact (will be deleted)
+ {translate("crm.contacts.merge.current_contact", {
+ _: "Current Contact (will be deleted)",
+ })}
</p>
<div className="font-medium text-sm mt-4">{contactOptionText}</div>
@@ -167,7 +193,9 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
</div>
<p className="font-medium text-sm mb-2">
- Target Contact (will be kept)
+ {translate("crm.contacts.merge.target_contact", {
+ _: "Target Contact (will be kept)",
+ })}
</p>
<Form>
<ReferenceInput
@@ -190,7 +218,11 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
{winnerId && (
<>
<div className="space-y-2">
- <p className="font-medium text-sm">What will be merged:</p>
+ <p className="font-medium text-sm">
+ {translate("crm.contacts.merge.what_will_be_merged", {
+ _: "What will be merged:",
+ })}
+ </p>
<ul className="text-sm text-muted-foreground space-y-1 ml-4">
{notesCount != null && notesCount > 0 && (
<li>
@@ -230,17 +262,24 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
!loserContact.email_jsonb?.length &&
!loserContact.phone_jsonb?.length && (
<li className="text-muted-foreground/60">
- No additional data to merge
+ {translate("crm.contacts.merge.no_additional_data", {
+ _: "No additional data to merge",
+ })}
</li>
)}
</ul>
</div>
<Alert variant="destructive">
<AlertTriangle className="h-4 w-4" />
- <AlertTitle>Warning: Destructive Operation</AlertTitle>
+ <AlertTitle>
+ {translate("crm.contacts.merge.warning_title", {
+ _: "Warning: Destructive Operation",
+ })}
+ </AlertTitle>
<AlertDescription>
- All data will be transferred to the second contact. This
- action cannot be undone.
+ {translate("crm.contacts.merge.warning_description", {
+ _: "All data will be transferred to the second contact. This action cannot be undone.",
+ })}
</AlertDescription>
</Alert>
</>
@@ -250,11 +289,15 @@ const ContactMergeDialog = ({ open, onClose }: ContactMergeDialogProps) => {
<DialogFooter>
<Button variant="ghost" onClick={onClose} disabled={isMerging}>
<CircleX />
- Cancel
+ {translate("ra.action.cancel", { _: "Cancel" })}
</Button>
<Button onClick={handleMerge} disabled={!winnerId || isMerging}>
<Merge />
- {isMerging ? "Merging..." : "Merge Contacts"}
+ {isMerging
+ ? translate("crm.contacts.merge.merging", { _: "Merging..." })
+ : translate("crm.contacts.merge.confirm", {
+ _: "Merge Contacts",
+ })}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/src/components/atomic-crm/contacts/ContactShow.tsx b/src/components/atomic-crm/contacts/ContactShow.tsx
index ade63c63..7bcf8301 100644
--- a/src/components/atomic-crm/contacts/ContactShow.tsx
+++ b/src/components/atomic-crm/contacts/ContactShow.tsx
@@ -1,6 +1,12 @@
import { useState } from "react";
-import { RecordRepresentation, ShowBase, useShowContext } from "ra-core";
+import {
+ RecordRepresentation,
+ ShowBase,
+ useShowContext,
+ useTranslate,
+} from "ra-core";
import { useIsMobile } from "@/hooks/use-mobile";
+import { ReferenceManyCount } from "@/components/admin/reference-many-count";
import { ReferenceField } from "@/components/admin/reference-field";
import { ReferenceManyField } from "@/components/admin/reference-many-field";
import { TextField } from "@/components/admin/text-field";
@@ -47,6 +53,7 @@ export const ContactShow = () => {
};
const ContactShowContentMobile = () => {
+ const translate = useTranslate();
const { record, isPending } = useShowContext<Contact>();
const [noteCreateOpen, setNoteCreateOpen] = useState(false);
const [editOpen, setEditOpen] = useState(false);
@@ -83,7 +90,9 @@ const ContactShowContentMobile = () => {
onClick={() => setEditOpen(true)}
>
<Pencil className="size-5" />
- <span className="sr-only">Edit record</span>
+ <span className="sr-only">
+ {translate("ra.action.edit", { _: "Edit record" })}
+ </span>
</Button>
</MobileHeader>
<MobileContent>
@@ -96,7 +105,9 @@ const ContactShowContentMobile = () => {
</h2>
<div className="text-sm text-muted-foreground">
{record.title}
- {record.title && record.company_id != null && " at "}
+ {record.title &&
+ record.company_id != null &&
+ ` ${translate("crm.common.at", { _: "at" })} `}
{record.company_id != null && (
<ReferenceField
source="company_id"
@@ -123,11 +134,26 @@ const ContactShowContentMobile = () => {
<Tabs defaultValue="notes" className="w-full">
<TabsList className="grid w-full grid-cols-3 h-10">
- <TabsTrigger value="notes">Notes</TabsTrigger>
+ <TabsTrigger value="notes">
+ {translate("resources.contact_notes.name", {
+ smart_count: 2,
+ _: "Notes",
+ })}
+ </TabsTrigger>
<TabsTrigger value="tasks">
- {`${record.nb_tasks ?? 0} Tasks`}
+ <ReferenceManyCount
+ target="contact_id"
+ reference="tasks"
+ filter={{ "done_date@is": null }}
+ />{" "}
+ {translate("resources.tasks.name", {
+ smart_count: 2,
+ _: "Tasks",
+ })}
+ </TabsTrigger>
+ <TabsTrigger value="details">
+ {translate("crm.common.details", { _: "Details" })}
</TabsTrigger>
- <TabsTrigger value="details">Details</TabsTrigger>
</TabsList>
<TabsContent value="notes" className="mt-2">
@@ -137,12 +163,14 @@ const ContactShowContentMobile = () => {
sort={{ field: "date", order: "DESC" }}
empty={
<div className="flex flex-col items-center justify-center py-8 text-center">
- <p className="text-muted-foreground mb-4">No notes yet</p>
+ <p className="text-muted-foreground mb-4">
+ {translate("crm.notes.empty", { _: "No notes yet" })}
+ </p>
<Button
variant="outline"
onClick={() => setNoteCreateOpen(true)}
>
- Add note
+ {translate("crm.notes.action.add", { _: "Add note" })}
</Button>
</div>
}
@@ -169,21 +197,34 @@ const ContactShowContentMobile = () => {
<TabsContent value="details" className="mt-4">
<div className="space-y-6">
<div>
- <h3 className="text-lg font-semibold">Personal info</h3>
+ <h3 className="text-lg font-semibold">
+ {translate("crm.contacts.inputs.personal_info", {
+ _: "Personal info",
+ })}
+ </h3>
<Separator />
<div className="mt-3">
<ContactPersonalInfo />
</div>
</div>
<div>
- <h3 className="text-lg font-semibold">Background info</h3>
+ <h3 className="text-lg font-semibold">
+ {translate("crm.contacts.inputs.background_info_short", {
+ _: "Background info",
+ })}
+ </h3>
<Separator />
<div className="mt-3">
<ContactBackgroundInfo />
</div>
</div>
<div>
- <h3 className="text-lg font-semibold">Tags</h3>
+ <h3 className="text-lg font-semibold">
+ {translate("resources.tags.name", {
+ smart_count: 2,
+ _: "Tags",
+ })}
+ </h3>
<Separator />
<div className="mt-3">
<TagsListEdit />
@@ -198,6 +239,7 @@ const ContactShowContentMobile = () => {
};
const ContactShowContent = () => {
+ const translate = useTranslate();
const { record, isPending } = useShowContext<Contact>();
if (isPending || !record) return null;
@@ -214,7 +256,9 @@ const ContactShowContent = () => {
</h5>
<div className="inline-flex text-sm text-muted-foreground">
{record.title}
- {record.title && record.company_id != null && " at "}
+ {record.title &&
+ record.company_id != null &&
+ ` ${translate("crm.common.at", { _: "at" })} `}
{record.company_id != null && (
<ReferenceField
source="company_id"
diff --git a/src/components/atomic-crm/contacts/ContactTasksList.tsx b/src/components/atomic-crm/contacts/ContactTasksList.tsx
index 5a778b84..d852afb3 100644
--- a/src/components/atomic-crm/contacts/ContactTasksList.tsx
+++ b/src/components/atomic-crm/contacts/ContactTasksList.tsx
@@ -1,5 +1,5 @@
import { useState } from "react";
-import { useRecordContext } from "ra-core";
+import { useRecordContext, useTranslate } from "ra-core";
import { Skeleton } from "@/components/ui/skeleton";
import { Button } from "@/components/ui/button";
@@ -9,6 +9,7 @@ import type { Contact } from "../types";
export const ContactTasksList = () => {
const record = useRecordContext<Contact>();
+ const translate = useTranslate();
const [taskCreateOpen, setTaskCreateOpen] = useState(false);
if (!record) return null;
@@ -24,9 +25,11 @@ export const ContactTasksList = () => {
contact_id={record.id}
/>
<div className="flex flex-col items-center justify-center py-8 text-center">
- <p className="text-muted-foreground mb-4">No tasks yet</p>
+ <p className="text-muted-foreground mb-4">
+ {translate("crm.tasks.empty", { _: "No tasks yet" })}
+ </p>
<Button variant="outline" onClick={() => setTaskCreateOpen(true)}>
- Add task
+ {translate("crm.tasks.action.add", { _: "Add task" })}
</Button>
</div>
</>
diff --git a/src/components/atomic-crm/dashboard/DashboardStepper.tsx b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
index df1e9356..0ed74097 100644
--- a/src/components/atomic-crm/dashboard/DashboardStepper.tsx
+++ b/src/components/atomic-crm/dashboard/DashboardStepper.tsx
@@ -1,5 +1,6 @@
import { CheckCircle, Circle, Plus } from "lucide-react";
import type { Identifier } from "ra-core";
+import { useTranslate } from "ra-core";
import { Link } from "react-router";
import { useState } from "react";
import { CreateButton } from "@/components/admin/create-button";
@@ -20,6 +21,7 @@ export const DashboardStepper = ({
step: number;
contactId?: Identifier;
}) => {
+ const translate = useTranslate();
const appbarHeight = useAppBarHeight();
const isMobile = useIsMobile();
const [contactCreateOpen, setContactCreateOpen] = useState(false);
@@ -44,16 +46,29 @@ export const DashboardStepper = ({
<Card className="w-full max-w-[600px]">
<CardContent className="px-6">
<div className="flex items-center justify-between mb-8">
- <h3 className="text-lg font-bold">What's next?</h3>
+ <h3 className="text-lg font-bold">
+ {translate("crm.dashboard.stepper.whats_next", {
+ _: "What's next?",
+ })}
+ </h3>
<div className="w-[150px]">
<Progress value={(step / 3) * 100} className="mb-2" />
- <div className="text-right text-sm">{step}/3 done</div>
+ <div className="text-right text-sm">
+ {translate("crm.dashboard.stepper.progress", {
+ _: `${step}/3 done`,
+ step,
+ })}
+ </div>
</div>
</div>
<div className="flex flex-col gap-12">
<div className="flex gap-8 items-center">
<CheckCircle className="text-green-600 w-5 h-5 shrink-0" />
- <h4 className="font-bold">Install Atomic CRM</h4>
+ <h4 className="font-bold">
+ {translate("crm.dashboard.stepper.install", {
+ _: "Install Atomic CRM",
+ })}
+ </h4>
</div>
<div className="flex gap-8 items-start">
{step > 1 ? (
@@ -63,7 +78,11 @@ export const DashboardStepper = ({
)}
<div className="flex flex-col gap-4">
- <h4 className="font-bold">Add your first contact</h4>
+ <h4 className="font-bold">
+ {translate("crm.contacts.action.add_first", {
+ _: "Add your first contact",
+ })}
+ </h4>
<div className="flex gap-8">
{isMobile ? (
@@ -73,11 +92,16 @@ export const DashboardStepper = ({
variant="outline"
>
<Plus className="h-4 w-4" />
- New Contact
+ {translate("crm.contacts.action.new", {
+ _: "New Contact",
+ })}
</Button>
) : (
<>
- <CreateButton label="New Contact" resource="contacts" />
+ <CreateButton
+ label="crm.contacts.action.new"
+ resource="contacts"
+ />
<ContactImportButton />
</>
)}
@@ -87,8 +111,16 @@ export const DashboardStepper = ({
<div className="flex gap-8 items-start">
<Circle className="text-muted-foreground w-5 h-5 mt-1 shrink-0" />
<div className="flex flex-col gap-4">
- <h4 className="font-bold">Add your first note</h4>
- <p>Go to a contact page and add a note</p>
+ <h4 className="font-bold">
+ {translate("crm.notes.action.add_first", {
+ _: "Add your first note",
+ })}
+ </h4>
+ <p>
+ {translate("crm.notes.stepper.hint", {
+ _: "Go to a contact page and add a note",
+ })}
+ </p>
{isMobile ? (
<Button
onClick={() => setNoteCreateOpen(true)}
@@ -96,11 +128,13 @@ export const DashboardStepper = ({
className="w-[100px] gap-2"
>
<Plus className="h-4 w-4" />
- Add note
+ {translate("crm.notes.action.add", { _: "Add note" })}
</Button>
) : (
<Button asChild disabled={step < 2} className="w-[100px]">
- <Link to={`/contacts/${contactId}/show`}>Add note</Link>
+ <Link to={`/contacts/${contactId}/show`}>
+ {translate("crm.notes.action.add", { _: "Add note" })}
+ </Link>
</Button>
)}
</div>
diff --git a/src/components/atomic-crm/dashboard/Welcome.tsx b/src/components/atomic-crm/dashboard/Welcome.tsx
index ecadb143..756f2cda 100644
--- a/src/components/atomic-crm/dashboard/Welcome.tsx
+++ b/src/components/atomic-crm/dashboard/Welcome.tsx
@@ -1,41 +1,54 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+import { useTranslate } from "ra-core";
-export const Welcome = () => (
- <Card>
- <CardHeader className="px-4">
- <CardTitle>Your CRM Starter Kit</CardTitle>
- </CardHeader>
- <CardContent className="px-4">
- <p className="text-sm mb-4">
- <a
- href="https://marmelab.com/atomic-crm"
- className="underline hover:no-underline"
- >
- Atomic CRM
- </a>{" "}
- is a template designed to help you quickly build your own CRM.
- </p>
- <p className="text-sm mb-4">
- This demo runs on a mock API, so you can explore and modify the data. It
- resets on reload. The full version uses Supabase for the backend.
- </p>
- <p className="text-sm">
- Powered by{" "}
- <a
- href="https://marmelab.com/shadcn-admin-kit"
- className="underline hover:no-underline"
- >
- shadcn-admin-kit
- </a>
- , Atomic CRM is fully open-source. You can find the code at{" "}
- <a
- href="https://github.com/marmelab/atomic-crm"
- className="underline hover:no-underline"
- >
- marmelab/atomic-crm
- </a>
- .
- </p>
- </CardContent>
- </Card>
-);
+export const Welcome = () => {
+ const translate = useTranslate();
+ return (
+ <Card>
+ <CardHeader className="px-4">
+ <CardTitle>
+ {translate("crm.dashboard.welcome.title", {
+ _: "Your CRM Starter Kit",
+ })}
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="px-4">
+ <p className="text-sm mb-4">
+ <a
+ href="https://marmelab.com/atomic-crm"
+ className="underline hover:no-underline"
+ >
+ Atomic CRM
+ </a>{" "}
+ {translate("crm.dashboard.welcome.paragraph_1", {
+ _: "is a template designed to help you quickly build your own CRM.",
+ })}
+ </p>
+ <p className="text-sm mb-4">
+ {translate("crm.dashboard.welcome.paragraph_2", {
+ _: "This demo runs on a mock API, so you can explore and modify the data. It resets on reload. The full version uses Supabase for the backend.",
+ })}
+ </p>
+ <p className="text-sm">
+ {translate("crm.dashboard.welcome.powered_by", { _: "Powered by" })}{" "}
+ <a
+ href="https://marmelab.com/shadcn-admin-kit"
+ className="underline hover:no-underline"
+ >
+ shadcn-admin-kit
+ </a>
+ {translate("crm.dashboard.welcome.paragraph_3", {
+ _: ", Atomic CRM is fully open-source. You can find the code at",
+ })}{" "}
+ <a
+ href="https://github.com/marmelab/atomic-crm"
+ className="underline hover:no-underline"
+ >
+ marmelab/atomic-crm
+ </a>
+ .
+ </p>
+ </CardContent>
+ </Card>
+ );
+};
diff --git a/src/components/atomic-crm/deals/DealArchivedList.tsx b/src/components/atomic-crm/deals/DealArchivedList.tsx
index 07466187..26afa49b 100644
--- a/src/components/atomic-crm/deals/DealArchivedList.tsx
+++ b/src/components/atomic-crm/deals/DealArchivedList.tsx
@@ -1,5 +1,5 @@
/* eslint-disable react-refresh/only-export-components */
-import { useGetIdentity, useGetList } from "ra-core";
+import { useGetIdentity, useGetList, useTranslate } from "ra-core";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
@@ -8,6 +8,7 @@ import type { Deal } from "../types";
import { DealCardContent } from "./DealCard";
export const DealArchivedList = () => {
+ const translate = useTranslate();
const { identity } = useGetIdentity();
const {
data: archivedLists,
@@ -52,11 +53,15 @@ export const DealArchivedList = () => {
onClick={() => setOpenDialog(true)}
className="my-4"
>
- View archived deals
+ {translate("crm.deals.archived.view", { _: "View archived deals" })}
</Button>
<Dialog open={openDialog} onOpenChange={() => setOpenDialog(false)}>
<DialogContent className="lg:max-w-4xl overflow-y-auto max-h-9/10 top-1/20 translate-y-0">
- <DialogTitle>Archived Deals</DialogTitle>
+ <DialogTitle>
+ {translate("crm.deals.archived.list_title", {
+ _: "Archived Deals",
+ })}
+ </DialogTitle>
<div className="flex flex-col gap-8">
{Object.entries(archivedListsByDate).map(([date, deals]) => (
<div key={date} className="flex flex-col gap-4">
diff --git a/src/components/atomic-crm/deals/DealEdit.tsx b/src/components/atomic-crm/deals/DealEdit.tsx
index e8c8117d..bc966e93 100644
--- a/src/components/atomic-crm/deals/DealEdit.tsx
+++ b/src/components/atomic-crm/deals/DealEdit.tsx
@@ -4,6 +4,7 @@ import {
useNotify,
useRecordContext,
useRedirect,
+ useTranslate,
} from "ra-core";
import { Link } from "react-router";
import { DeleteButton } from "@/components/admin/delete-button";
@@ -35,7 +36,9 @@ export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => {
mutationMode="pessimistic"
mutationOptions={{
onSuccess: () => {
- notify("Deal updated");
+ notify("crm.deals.updated", {
+ messageArgs: { _: "Deal updated" },
+ });
redirect(`/deals/${id}/show`, undefined, undefined, undefined, {
_scrollToTop: false,
});
@@ -55,6 +58,7 @@ export const DealEdit = ({ open, id }: { open: boolean; id?: string }) => {
};
function EditHeader() {
+ const translate = useTranslate();
const deal = useRecordContext<Deal>();
if (!deal) {
return null;
@@ -67,12 +71,21 @@ function EditHeader() {
<ReferenceField source="company_id" reference="companies" link="show">
<CompanyAvatar />
</ReferenceField>
- <h2 className="text-2xl font-semibold">Edit {deal.name} deal</h2>
+ <h2 className="text-2xl font-semibold">
+ {translate("crm.deals.edit.title", {
+ _: `Edit ${deal.name} deal`,
+ name: deal.name,
+ })}
+ </h2>
</div>
<div className="flex gap-2 pr-12">
<DeleteButton />
<Button asChild variant="outline" className="h-9">
- <Link to={`/deals/${deal.id}/show`}>Back to deal</Link>
+ <Link to={`/deals/${deal.id}/show`}>
+ {translate("crm.deals.action.back_to_deal", {
+ _: "Back to deal",
+ })}
+ </Link>
</Button>
</div>
</div>
diff --git a/src/components/atomic-crm/deals/DealEmpty.tsx b/src/components/atomic-crm/deals/DealEmpty.tsx
index f1ff1cb3..eca98828 100644
--- a/src/components/atomic-crm/deals/DealEmpty.tsx
+++ b/src/components/atomic-crm/deals/DealEmpty.tsx
@@ -1,4 +1,4 @@
-import { useGetList } from "ra-core";
+import { useGetList, useTranslate } from "ra-core";
import { matchPath, useLocation, Link } from "react-router";
import type { ReactNode } from "react";
import { CreateButton } from "@/components/admin/create-button";
@@ -9,6 +9,7 @@ import type { Contact } from "../types";
import { DealCreate } from "./DealCreate";
export const DealEmpty = ({ children }: { children?: ReactNode }) => {
+ const translate = useTranslate();
const location = useLocation();
const matchCreate = matchPath("/deals/create", location.pathname);
const appbarHeight = useAppBarHeight();
@@ -30,31 +31,46 @@ export const DealEmpty = ({ children }: { children?: ReactNode }) => {
height: `calc(100dvh - ${appbarHeight}px)`,
}}
>
- <img src="./img/empty.svg" alt="No deals found" />
+ <img
+ src="./img/empty.svg"
+ alt={translate("crm.deals.empty.title", { _: "No deals found" })}
+ />
{contacts && contacts.length > 0 ? (
<>
<div className="flex flex-col items-center gap-0">
- <h3 className="text-lg font-bold">No deals found</h3>
+ <h3 className="text-lg font-bold">
+ {translate("crm.deals.empty.title", { _: "No deals found" })}
+ </h3>
<p className="text-sm text-center text-muted-foreground mb-4">
- It seems your deal list is empty.
+ {translate("crm.deals.empty.description", {
+ _: "It seems your deal list is empty.",
+ })}
</p>
</div>
<div className="flex space-x-8">
- <CreateButton label="Create deal" />
+ <CreateButton label="crm.deals.action.create" />
</div>
<DealCreate open={!!matchCreate} />
{children}
</>
) : (
<div className="flex flex-col items-center gap-0">
- <h3 className="text-lg font-bold">No deals found</h3>
+ <h3 className="text-lg font-bold">
+ {translate("crm.deals.empty.title", { _: "No deals found" })}
+ </h3>
<p className="text-sm text-center text-muted-foreground mb-4">
- It seems your contact list is empty.
+ {translate("crm.contacts.empty.description", {
+ _: "It seems your contact list is empty.",
+ })}
<br />
<Link to="/contacts/create" className="hover:underline">
- Add your first contact
+ {translate("crm.contacts.action.add_first", {
+ _: "Add your first contact",
+ })}
</Link>{" "}
- before creating a deal.
+ {translate("crm.deals.empty.before_create", {
+ _: "before creating a deal.",
+ })}
</p>
</div>
)}
diff --git a/src/components/atomic-crm/deals/DealInputs.tsx b/src/components/atomic-crm/deals/DealInputs.tsx
index 6d8a11eb..3ec667ff 100644
--- a/src/components/atomic-crm/deals/DealInputs.tsx
+++ b/src/components/atomic-crm/deals/DealInputs.tsx
@@ -1,4 +1,4 @@
-import { required } from "ra-core";
+import { required, useTranslate } from "ra-core";
import { AutocompleteArrayInput } from "@/components/admin/autocomplete-array-input";
import { ReferenceArrayInput } from "@/components/admin/reference-array-input";
import { ReferenceInput } from "@/components/admin/reference-input";
@@ -33,7 +33,7 @@ const DealInfoInputs = () => {
<div className="flex flex-col gap-4 flex-1">
<TextInput
source="name"
- label="Deal name"
+ label="crm.deals.inputs.name"
validate={required()}
helperText={false}
/>
@@ -43,16 +43,19 @@ const DealInfoInputs = () => {
};
const DealLinkedToInputs = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4 flex-1">
- <h3 className="text-base font-medium">Linked to</h3>
+ <h3 className="text-base font-medium">
+ {translate("crm.deals.inputs.linked_to", { _: "Linked to" })}
+ </h3>
<ReferenceInput source="company_id" reference="companies">
<AutocompleteCompanyInput validate={required()} />
</ReferenceInput>
<ReferenceArrayInput source="contact_ids" reference="contacts_summary">
<AutocompleteArrayInput
- label="Contacts"
+ label="crm.deals.inputs.contacts"
optionText={contactOptionText}
helperText={false}
/>
@@ -62,14 +65,17 @@ const DealLinkedToInputs = () => {
};
const DealMiscInputs = () => {
+ const translate = useTranslate();
const { dealStages, dealCategories } = useConfigurationContext();
return (
<div className="flex flex-col gap-4 flex-1">
- <h3 className="text-base font-medium">Misc</h3>
+ <h3 className="text-base font-medium">
+ {translate("crm.common.misc", { _: "Misc" })}
+ </h3>
<SelectInput
source="category"
- label="Category"
+ label="crm.deals.inputs.category"
choices={dealCategories}
optionText="label"
optionValue="value"
diff --git a/src/components/atomic-crm/deals/DealShow.tsx b/src/components/atomic-crm/deals/DealShow.tsx
index ea83d8d6..26c4c16a 100644
--- a/src/components/atomic-crm/deals/DealShow.tsx
+++ b/src/components/atomic-crm/deals/DealShow.tsx
@@ -8,6 +8,7 @@ import {
useRecordContext,
useRedirect,
useRefresh,
+ useTranslate,
useUpdate,
} from "ra-core";
import { DeleteButton } from "@/components/admin/delete-button";
@@ -49,6 +50,7 @@ export const DealShow = ({ open, id }: { open: boolean; id?: string }) => {
};
const DealShowContent = () => {
+ const translate = useTranslate();
const { dealStages, dealCategories } = useConfigurationContext();
const record = useRecordContext<Deal>();
if (!record) return null;
@@ -87,23 +89,29 @@ const DealShowContent = () => {
<div className="flex gap-8 m-4">
<div className="flex flex-col mr-10">
<span className="text-xs text-muted-foreground tracking-wide">
- Expected closing date
+ {translate("crm.deals.fields.expected_closing_date", {
+ _: "Expected closing date",
+ })}
</span>
<div className="flex items-center gap-2">
<span className="text-sm">
{isValid(new Date(record.expected_closing_date))
? formatISODateString(record.expected_closing_date)
- : "Invalid date"}
+ : translate("crm.common.invalid_date", {
+ _: "Invalid date",
+ })}
</span>
{new Date(record.expected_closing_date) < new Date() ? (
- <Badge variant="destructive">Past</Badge>
+ <Badge variant="destructive">
+ {translate("crm.common.past", { _: "Past" })}
+ </Badge>
) : null}
</div>
</div>
<div className="flex flex-col mr-10">
<span className="text-xs text-muted-foreground tracking-wide">
- Budget
+ {translate("crm.deals.fields.budget", { _: "Budget" })}
</span>
<span className="text-sm">
{record.amount.toLocaleString("en-US", {
@@ -119,7 +127,7 @@ const DealShowContent = () => {
{record.category && (
<div className="flex flex-col mr-10">
<span className="text-xs text-muted-foreground tracking-wide">
- Category
+ {translate("crm.deals.fields.category", { _: "Category" })}
</span>
<span className="text-sm">
{dealCategories.find((c) => c.value === record.category)
@@ -130,7 +138,7 @@ const DealShowContent = () => {
<div className="flex flex-col mr-10">
<span className="text-xs text-muted-foreground tracking-wide">
- Stage
+ {translate("crm.deals.fields.stage", { _: "Stage" })}
</span>
<span className="text-sm">
{findDealLabel(dealStages, record.stage)}
@@ -142,7 +150,10 @@ const DealShowContent = () => {
<div className="m-4">
<div className="flex flex-col min-h-12 mr-10">
<span className="text-xs text-muted-foreground tracking-wide">
- Contacts
+ {translate("resources.contacts.name", {
+ smart_count: 2,
+ _: "Contacts",
+ })}
</span>
<ReferenceArrayField
source="contact_ids"
@@ -157,7 +168,9 @@ const DealShowContent = () => {
{record.description && (
<div className="m-4 whitespace-pre-line">
<span className="text-xs text-muted-foreground tracking-wide">
- Description
+ {translate("crm.deals.fields.description", {
+ _: "Description",
+ })}
</span>
<p className="text-sm leading-6">{record.description}</p>
</div>
@@ -180,13 +193,19 @@ const DealShowContent = () => {
);
};
-const ArchivedTitle = () => (
- <div className="bg-orange-500 px-6 py-4">
- <h3 className="text-lg font-bold text-white">Archived Deal</h3>
- </div>
-);
+const ArchivedTitle = () => {
+ const translate = useTranslate();
+ return (
+ <div className="bg-orange-500 px-6 py-4">
+ <h3 className="text-lg font-bold text-white">
+ {translate("crm.deals.archived.title", { _: "Archived Deal" })}
+ </h3>
+ </div>
+ );
+};
const ArchiveButton = ({ record }: { record: Deal }) => {
+ const translate = useTranslate();
const [update] = useUpdate();
const redirect = useRedirect();
const notify = useNotify();
@@ -202,11 +221,18 @@ const ArchiveButton = ({ record }: { record: Deal }) => {
{
onSuccess: () => {
redirect("list", "deals");
- notify("Deal archived", { type: "info", undoable: false });
+ notify("crm.deals.archived.success", {
+ type: "info",
+ undoable: false,
+ messageArgs: { _: "Deal archived" },
+ });
refresh();
},
onError: () => {
- notify("Error: deal not archived", { type: "error" });
+ notify("crm.deals.archived.error", {
+ type: "error",
+ messageArgs: { _: "Error: deal not archived" },
+ });
},
},
);
@@ -220,12 +246,13 @@ const ArchiveButton = ({ record }: { record: Deal }) => {
className="flex items-center gap-2 h-9"
>
<Archive className="w-4 h-4" />
- Archive
+ {translate("crm.deals.archived.action", { _: "Archive" })}
</Button>
);
};
const UnarchiveButton = ({ record }: { record: Deal }) => {
+ const translate = useTranslate();
const dataProvider = useDataProvider();
const redirect = useRedirect();
const notify = useNotify();
@@ -235,14 +262,18 @@ const UnarchiveButton = ({ record }: { record: Deal }) => {
mutationFn: () => dataProvider.unarchiveDeal(record),
onSuccess: () => {
redirect("list", "deals");
- notify("Deal unarchived", {
+ notify("crm.deals.unarchived.success", {
type: "info",
undoable: false,
+ messageArgs: { _: "Deal unarchived" },
});
refresh();
},
onError: () => {
- notify("Error: deal not unarchived", { type: "error" });
+ notify("crm.deals.unarchived.error", {
+ type: "error",
+ messageArgs: { _: "Error: deal not unarchived" },
+ });
},
});
@@ -258,7 +289,9 @@ const UnarchiveButton = ({ record }: { record: Deal }) => {
className="flex items-center gap-2 h-9"
>
<ArchiveRestore className="w-4 h-4" />
- Send back to the board
+ {translate("crm.deals.unarchived.action", {
+ _: "Send back to the board",
+ })}
</Button>
);
};
diff --git a/src/components/atomic-crm/deals/OnlyMineInput.tsx b/src/components/atomic-crm/deals/OnlyMineInput.tsx
index 9953b47a..c6db0d24 100644
--- a/src/components/atomic-crm/deals/OnlyMineInput.tsx
+++ b/src/components/atomic-crm/deals/OnlyMineInput.tsx
@@ -1,8 +1,9 @@
-import { useGetIdentity, useListFilterContext } from "ra-core";
+import { useGetIdentity, useListFilterContext, useTranslate } from "ra-core";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
export const OnlyMineInput = (_: { alwaysOn: boolean; source: string }) => {
+ const translate = useTranslate();
const { filterValues, displayedFilters, setFilters } = useListFilterContext();
const { identity } = useGetIdentity();
@@ -23,7 +24,11 @@ export const OnlyMineInput = (_: { alwaysOn: boolean; source: string }) => {
checked={typeof filterValues.sales_id !== "undefined"}
onCheckedChange={handleChange}
/>
- <Label htmlFor="only-mine">Only companies I manage</Label>
+ <Label htmlFor="only-mine">
+ {translate("crm.companies.filters.only_mine", {
+ _: "Only companies I manage",
+ })}
+ </Label>
</div>
</div>
);
diff --git a/src/components/atomic-crm/layout/Header.tsx b/src/components/atomic-crm/layout/Header.tsx
index e76b1f11..c6f1e932 100644
--- a/src/components/atomic-crm/layout/Header.tsx
+++ b/src/components/atomic-crm/layout/Header.tsx
@@ -21,6 +21,7 @@ import { ImportPage } from "../misc/ImportPage";
const Header = () => {
const { darkModeLogo, lightModeLogo, title } = useConfigurationContext();
const location = useLocation();
+ const translate = useTranslate();
let currentPath: string | boolean = "/";
if (matchPath("/", location.pathname)) {
@@ -60,22 +61,31 @@ const Header = () => {
<div>
<nav className="flex">
<NavigationTab
- label="Dashboard"
+ label={translate("ra.page.dashboard", { _: "Dashboard" })}
to="/"
isActive={currentPath === "/"}
/>
<NavigationTab
- label="Contacts"
+ label={translate("resources.contacts.name", {
+ smart_count: 2,
+ _: "Contacts",
+ })}
to="/contacts"
isActive={currentPath === "/contacts"}
/>
<NavigationTab
- label="Companies"
+ label={translate("resources.companies.name", {
+ smart_count: 2,
+ _: "Companies",
+ })}
to="/companies"
isActive={currentPath === "/companies"}
/>
<NavigationTab
- label="Deals"
+ label={translate("resources.deals.name", {
+ smart_count: 2,
+ _: "Deals",
+ })}
to="/deals"
isActive={currentPath === "/deals"}
/>
diff --git a/src/components/atomic-crm/layout/MobileNavigation.tsx b/src/components/atomic-crm/layout/MobileNavigation.tsx
index 71b59a4b..f331db5d 100644
--- a/src/components/atomic-crm/layout/MobileNavigation.tsx
+++ b/src/components/atomic-crm/layout/MobileNavigation.tsx
@@ -39,6 +39,7 @@ import { TaskCreateSheet } from "../tasks/TaskCreateSheet";
export const MobileNavigation = () => {
const location = useLocation();
+ const translate = useTranslate();
let currentPath: string | boolean = "/";
if (matchPath("/", location.pathname)) {
@@ -79,20 +80,26 @@ export const MobileNavigation = () => {
<NavigationButton
href="/"
Icon={Home}
- label="Home"
+ label={translate("ra.page.dashboard", { _: "Home" })}
isActive={currentPath === "/"}
/>
<NavigationButton
href="/contacts"
Icon={Users}
- label="Contacts"
+ label={translate("resources.contacts.name", {
+ smart_count: 2,
+ _: "Contacts",
+ })}
isActive={currentPath === "/contacts"}
/>
<CreateButton />
<NavigationButton
href="/tasks"
Icon={ListTodo}
- label="Tasks"
+ label={translate("resources.tasks.name", {
+ smart_count: 2,
+ _: "Tasks",
+ })}
isActive={currentPath === "/tasks"}
/>
<SettingsButton />
@@ -129,6 +136,7 @@ const NavigationButton = ({
);
const CreateButton = () => {
+ const translate = useTranslate();
const contact_id = useMatch("/contacts/:id/*")?.params.id;
const [contactCreateOpen, setContactCreateOpen] = useState(false);
const [noteCreateOpen, setNoteCreateOpen] = useState(false);
@@ -156,7 +164,7 @@ const CreateButton = () => {
variant="default"
size="icon"
className="h-16 w-16 rounded-full -mt-3"
- aria-label="Create"
+ aria-label={translate("ra.action.create", { _: "Create" })}
>
<Plus className="size-10" />
</Button>
@@ -168,7 +176,7 @@ const CreateButton = () => {
setContactCreateOpen(true);
}}
>
- Contact
+ {translate("resources.contacts.forcedCaseName", { _: "Contact" })}
</DropdownMenuItem>
<DropdownMenuItem
className="h-12 px-4 text-base"
@@ -176,7 +184,7 @@ const CreateButton = () => {
setNoteCreateOpen(true);
}}
>
- Note
+ {translate("resources.contact_notes.forcedCaseName", { _: "Note" })}
</DropdownMenuItem>
<DropdownMenuItem
className="h-12 px-4 text-base"
@@ -184,7 +192,7 @@ const CreateButton = () => {
setTaskCreateOpen(true);
}}
>
- Task
+ {translate("resources.tasks.forcedCaseName", { _: "Task" })}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
@@ -257,6 +265,7 @@ const SettingsButton = () => {
};
const ThemeMenu = () => {
+ const translate = useTranslate();
const { theme, setTheme } = useTheme();
return (
<div className="px-3 py-2">
@@ -272,23 +281,33 @@ const ThemeMenu = () => {
>
<ToggleGroupItem
value="system"
- aria-label="System theme"
+ aria-label={translate("crm.theme.system", { _: "System theme" })}
className="px-3"
>
<Smartphone className="size-5 mx-2" />
- <span className="sr-only">System</span>
+ <span className="sr-only">
+ {translate("crm.theme.system_short", { _: "System" })}
+ </span>
</ToggleGroupItem>
<ToggleGroupItem
value="light"
- aria-label="Light theme"
+ aria-label={translate("crm.theme.light", { _: "Light theme" })}
className="px-3"
>
<Sun className="size-5 mx-2" />
- <span className="sr-only">Light</span>
+ <span className="sr-only">
+ {translate("crm.theme.light_short", { _: "Light" })}
+ </span>
</ToggleGroupItem>
- <ToggleGroupItem value="dark" aria-label="Dark theme" className="px-3">
+ <ToggleGroupItem
+ value="dark"
+ aria-label={translate("crm.theme.dark", { _: "Dark theme" })}
+ className="px-3"
+ >
<Moon className="size-5 mx-2" />
- <span className="sr-only">Dark</span>
+ <span className="sr-only">
+ {translate("crm.theme.dark_short", { _: "Dark" })}
+ </span>
</ToggleGroupItem>
</ToggleGroup>
</div>
diff --git a/src/components/atomic-crm/login/ConfirmationRequired.tsx b/src/components/atomic-crm/login/ConfirmationRequired.tsx
index ce1ffbcc..51f46c64 100644
--- a/src/components/atomic-crm/login/ConfirmationRequired.tsx
+++ b/src/components/atomic-crm/login/ConfirmationRequired.tsx
@@ -1,7 +1,9 @@
import { Notification } from "@/components/admin/notification";
+import { useTranslate } from "ra-core";
import { useConfigurationContext } from "../root/ConfigurationContext";
export const ConfirmationRequired = () => {
+ const translate = useTranslate();
const { darkModeLogo: logo, title } = useConfigurationContext();
return (
@@ -17,10 +19,15 @@ export const ConfirmationRequired = () => {
</div>
<div className="h-full text-center">
<div className="max-w-sm mx-auto h-full flex flex-col justify-center gap-4">
- <h1 className="text-2xl font-bold mb-4">Welcome to Atomic CRM</h1>
+ <h1 className="text-2xl font-bold mb-4">
+ {translate("crm.auth.welcome_title", {
+ _: "Welcome to Atomic CRM",
+ })}
+ </h1>
<p className="text-base mb-4">
- Please follow the link we just sent you by email to confirm your
- account.
+ {translate("crm.auth.confirmation_required", {
+ _: "Please follow the link we just sent you by email to confirm your account.",
+ })}
</p>
</div>
</div>
diff --git a/src/components/atomic-crm/login/LoginPage.tsx b/src/components/atomic-crm/login/LoginPage.tsx
index 8d8559aa..77b73d43 100644
--- a/src/components/atomic-crm/login/LoginPage.tsx
+++ b/src/components/atomic-crm/login/LoginPage.tsx
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from "react";
-import { Form, required, useLogin, useNotify } from "ra-core";
+import { Form, required, useLogin, useNotify, useTranslate } from "ra-core";
import type { SubmitHandler, FieldValues } from "react-hook-form";
import { Link, useLocation, useNavigate } from "react-router";
import { Button } from "@/components/ui/button";
@@ -31,6 +31,7 @@ export const LoginPage = (props: { redirectTo?: string }) => {
const navigate = useNavigate();
const login = useLogin();
const notify = useNotify();
+ const translate = useTranslate();
useEffect(() => {
const searchParams = new URLSearchParams(location.search);
@@ -41,12 +42,12 @@ export const LoginPage = (props: { redirectTo?: string }) => {
}
hasDisplayedRecoveryNotification.current = true;
- notify(
- "If you're a registered user, you should receive a password recovery email shortly.",
- {
- type: "success",
+ notify("crm.auth.recovery_email_sent", {
+ type: "success",
+ messageArgs: {
+ _: "If you're a registered user, you should receive a password recovery email shortly.",
},
- );
+ });
searchParams.delete("passwordRecoveryEmailSent");
const nextSearch = searchParams.toString();
@@ -101,18 +102,20 @@ export const LoginPage = (props: { redirectTo?: string }) => {
<div className="flex flex-col justify-center w-full p-4 lg:p-8">
<div className="w-full space-y-6 lg:mx-auto lg:w-[350px]">
<div className="text-center">
- <h1 className="text-2xl font-semibold tracking-tight">Sign in</h1>
+ <h1 className="text-2xl font-semibold tracking-tight">
+ {translate("ra.auth.sign_in", { _: "Sign in" })}
+ </h1>
</div>
{disableEmailPasswordAuthentication ? null : (
<Form className="space-y-8" onSubmit={handleSubmit}>
<TextInput
- label="Email"
+ label="ra.auth.email"
source="email"
type="email"
validate={required()}
/>
<TextInput
- label="Password"
+ label="ra.auth.password"
source="password"
type="password"
validate={required()}
@@ -123,14 +126,16 @@ export const LoginPage = (props: { redirectTo?: string }) => {
className="cursor-pointer"
disabled={loading}
>
- Sign in
+ {translate("ra.auth.sign_in", { _: "Sign in" })}
</Button>
</div>
</Form>
)}
{googleWorkplaceDomain ? (
<SSOAuthButton className="w-full" domain={googleWorkplaceDomain}>
- Sign in with Google Workplace
+ {translate("crm.auth.sign_in_google_workspace", {
+ _: "Sign in with Google Workplace",
+ })}
</SSOAuthButton>
) : null}
{disableEmailPasswordAuthentication ? null : (
@@ -138,7 +143,9 @@ export const LoginPage = (props: { redirectTo?: string }) => {
to={"/forgot-password"}
className="block text-sm text-center hover:underline"
>
- Forgot your password?
+ {translate("ra.auth.forgot_password", {
+ _: "Forgot your password?",
+ })}
</Link>
)}
</div>
diff --git a/src/components/atomic-crm/login/SignupPage.tsx b/src/components/atomic-crm/login/SignupPage.tsx
index d4d9f7ac..a4c880be 100644
--- a/src/components/atomic-crm/login/SignupPage.tsx
+++ b/src/components/atomic-crm/login/SignupPage.tsx
@@ -1,6 +1,6 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Loader2 } from "lucide-react";
-import { useDataProvider, useLogin, useNotify } from "ra-core";
+import { useDataProvider, useLogin, useNotify, useTranslate } from "ra-core";
import { useForm, type SubmitHandler } from "react-hook-form";
import { Navigate, useNavigate } from "react-router";
import { Button } from "@/components/ui/button";
@@ -24,6 +24,7 @@ export const SignupPage = () => {
googleWorkplaceDomain,
} = useConfigurationContext();
const navigate = useNavigate();
+ const translate = useTranslate();
const { data: isInitialized, isPending } = useQuery({
queryKey: ["init"],
queryFn: async () => {
@@ -43,7 +44,11 @@ export const SignupPage = () => {
redirectTo: "/contacts",
})
.then(() => {
- notify("Initial user successfully created");
+ notify("crm.auth.signup.initial_user_created", {
+ messageArgs: {
+ _: "Initial user successfully created",
+ },
+ });
// FIXME: We should probably provide a hook for that in the ra-core package
queryClient.invalidateQueries({
queryKey: ["auth", "canAccess"],
@@ -54,8 +59,11 @@ export const SignupPage = () => {
// An email confirmation is required to continue.
navigate(ConfirmationRequired.path);
} else {
- notify("Failed to log in.", {
+ notify("crm.auth.sign_in_failed", {
type: "error",
+ messageArgs: {
+ _: "Failed to log in.",
+ },
});
navigate("/login");
}
@@ -103,13 +111,21 @@ export const SignupPage = () => {
</div>
<div className="h-full">
<div className="max-w-sm mx-auto h-full flex flex-col justify-center gap-4">
- <h1 className="text-2xl font-bold mb-4">Welcome to Atomic CRM</h1>
+ <h1 className="text-2xl font-bold mb-4">
+ {translate("crm.auth.welcome_title", {
+ _: "Welcome to Atomic CRM",
+ })}
+ </h1>
<p className="text-base mb-4">
- Create the first user account to complete the setup.
+ {translate("crm.auth.signup.create_first_user", {
+ _: "Create the first user account to complete the setup.",
+ })}
</p>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
<div className="flex flex-col gap-2">
- <Label htmlFor="first_name">First name</Label>
+ <Label htmlFor="first_name">
+ {translate("ra.auth.first_name", { _: "First name" })}
+ </Label>
<Input
{...register("first_name", { required: true })}
id="first_name"
@@ -118,7 +134,9 @@ export const SignupPage = () => {
/>
</div>
<div className="flex flex-col gap-2">
- <Label htmlFor="last_name">Last name</Label>
+ <Label htmlFor="last_name">
+ {translate("ra.auth.last_name", { _: "Last name" })}
+ </Label>
<Input
{...register("last_name", { required: true })}
id="last_name"
@@ -127,7 +145,9 @@ export const SignupPage = () => {
/>
</div>
<div className="flex flex-col gap-2">
- <Label htmlFor="email">Email</Label>
+ <Label htmlFor="email">
+ {translate("ra.auth.email", { _: "Email" })}
+ </Label>
<Input
{...register("email", { required: true })}
id="email"
@@ -136,7 +156,9 @@ export const SignupPage = () => {
/>
</div>
<div className="flex flex-col gap-2">
- <Label htmlFor="password">Password</Label>
+ <Label htmlFor="password">
+ {translate("ra.auth.password", { _: "Password" })}
+ </Label>
<Input
{...register("password", { required: true })}
id="password"
@@ -153,10 +175,14 @@ export const SignupPage = () => {
{isSignUpPending ? (
<>
<Loader2 className="w-4 h-4 animate-spin mr-2" />
- Creating...
+ {translate("crm.auth.signup.creating", {
+ _: "Creating...",
+ })}
</>
) : (
- "Create account"
+ translate("crm.auth.signup.create_account", {
+ _: "Create account",
+ })
)}
</Button>
{googleWorkplaceDomain ? (
@@ -164,7 +190,9 @@ export const SignupPage = () => {
className="w-full"
domain={googleWorkplaceDomain}
>
- Sign in with Google Workplace
+ {translate("crm.auth.sign_in_google_workspace", {
+ _: "Sign in with Google Workplace",
+ })}
</SSOAuthButton>
) : null}
</div>
diff --git a/src/components/atomic-crm/misc/ImageEditorField.tsx b/src/components/atomic-crm/misc/ImageEditorField.tsx
index 6fe71599..85ae6939 100644
--- a/src/components/atomic-crm/misc/ImageEditorField.tsx
+++ b/src/components/atomic-crm/misc/ImageEditorField.tsx
@@ -1,4 +1,4 @@
-import { useFieldValue } from "ra-core";
+import { useFieldValue, useTranslate } from "ra-core";
import { createRef, useCallback, useState } from "react";
import type { ReactCropperElement } from "react-cropper";
import { Cropper } from "react-cropper";
@@ -17,6 +17,7 @@ import {
import "cropperjs/dist/cropper.css";
const ImageEditorField = (props: ImageEditorFieldProps) => {
+ const translate = useTranslate();
const { getValues } = useFormContext();
const source = getValues(props.source);
const imageUrl = source?.src;
@@ -61,7 +62,9 @@ const ImageEditorField = (props: ImageEditorFieldProps) => {
{...commonProps}
className="cursor-pointer object-cover"
style={{ width, height }}
- alt="Editable content"
+ alt={translate("crm.image_editor.editable_content", {
+ _: "Editable content",
+ })}
/>
)}
</div>
@@ -71,7 +74,7 @@ const ImageEditorField = (props: ImageEditorFieldProps) => {
onClick={() => setIsDialogOpen(true)}
className="text-xs underline hover:no-underline cursor-pointer text-center"
>
- Change
+ {translate("crm.image_editor.change", { _: "Change" })}
</button>
)}
</div>
@@ -85,6 +88,7 @@ const ImageEditorField = (props: ImageEditorFieldProps) => {
};
const ImageEditorDialog = (props: ImageEditorDialogProps) => {
+ const translate = useTranslate();
const { setValue, handleSubmit } = useFormContext();
const cropperRef = createRef<ReactCropperElement>();
const initialValue = useFieldValue({ source: props.source });
@@ -151,7 +155,11 @@ const ImageEditorDialog = (props: ImageEditorDialogProps) => {
)}
<DialogContent>
<DialogHeader>
- <DialogTitle>Upload and resize image</DialogTitle>
+ <DialogTitle>
+ {translate("crm.image_editor.title", {
+ _: "Upload and resize image",
+ })}
+ </DialogTitle>
</DialogHeader>
<div className="flex flex-col gap-2 justify-center">
<div
@@ -160,7 +168,9 @@ const ImageEditorDialog = (props: ImageEditorDialogProps) => {
>
<input {...getInputProps()} />
<p className="text-gray-600">
- Drop a file to upload, or click to select it.
+ {translate("crm.image_editor.drop_hint", {
+ _: "Drop a file to upload, or click to select it.",
+ })}
</p>
</div>
@@ -177,10 +187,10 @@ const ImageEditorDialog = (props: ImageEditorDialogProps) => {
<DialogFooter className="flex justify-between w-full">
<Button type="button" onClick={updateImage}>
- Update Image
+ {translate("crm.image_editor.update_image", { _: "Update Image" })}
</Button>
<Button type="button" variant="destructive" onClick={deleteImage}>
- Delete
+ {translate("ra.action.delete", { _: "Delete" })}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/src/components/atomic-crm/misc/ImportPage.tsx b/src/components/atomic-crm/misc/ImportPage.tsx
index 42a6ad2f..2dbf8cf3 100644
--- a/src/components/atomic-crm/misc/ImportPage.tsx
+++ b/src/components/atomic-crm/misc/ImportPage.tsx
@@ -1,5 +1,5 @@
import { AlertCircleIcon } from "lucide-react";
-import { Form, required } from "ra-core";
+import { Form, required, useTranslate } from "ra-core";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -25,26 +25,37 @@ import {
import sampleFile from "./import-sample.json?url";
export const ImportPage = () => {
+ const translate = useTranslate();
const [importState, importFile, reset] = useImportFromJson();
return (
<div className="max-w-2xl mx-auto mt-8">
<Card>
<CardHeader>
- <CardTitle>Import Data</CardTitle>
+ <CardTitle>
+ {translate("crm.import.title", { _: "Import Data" })}
+ </CardTitle>
</CardHeader>
<CardContent>
{importState.status === "idle" ? (
- <ImportFromJsonIdle importFile={importFile} />
+ <ImportFromJsonIdle importFile={importFile} translate={translate} />
) : importState.status === "error" ? (
<ImportFromJsonError
importState={importState}
importFile={importFile}
+ translate={translate}
/>
) : importState.status === "importing" ? (
- <ImportFromJsonStatus importState={importState} />
+ <ImportFromJsonStatus
+ importState={importState}
+ translate={translate}
+ />
) : (
- <ImportFromJsonSuccess importState={importState} reset={reset} />
+ <ImportFromJsonSuccess
+ importState={importState}
+ reset={reset}
+ translate={translate}
+ />
)}
</CardContent>
</Card>
@@ -56,16 +67,22 @@ ImportPage.path = "/import";
const ImportFromJsonIdle = ({
importFile,
+ translate,
}: {
importFile: ImportFromJsonFunction;
+ translate: (key: string, options?: any) => string;
}) => (
<>
<div className="mb-4">
<p className="text-sm">
- You can import sales, companies, contacts, companies, notes, and tasks.
+ {translate("crm.import.idle.description_1", {
+ _: "You can import sales, companies, contacts, companies, notes, and tasks.",
+ })}
</p>
<p className="text-sm">
- Data must be in a JSON file matching the following sample:{" "}
+ {translate("crm.import.idle.description_2", {
+ _: "Data must be in a JSON file matching the following sample:",
+ })}{" "}
<a
className="underline"
download="import-sample.json"
@@ -75,33 +92,41 @@ const ImportFromJsonIdle = ({
</a>
</p>
</div>
- <ImportFromJsonForm importFile={importFile} />
+ <ImportFromJsonForm importFile={importFile} translate={translate} />
</>
);
const ImportFromJsonError = ({
importState,
importFile,
+ translate,
}: {
importFile: ImportFromJsonFunction;
importState: ImportFromJsonErrorState;
+ translate: (key: string, options?: any) => string;
}) => (
<>
<Alert variant="destructive" className="mb-4">
<AlertCircleIcon />
- <AlertTitle>Unable to import this file.</AlertTitle>
+ <AlertTitle>
+ {translate("crm.import.error.unable", {
+ _: "Unable to import this file.",
+ })}
+ </AlertTitle>
<AlertDescription>
<p>{importState.error.message}</p>
</AlertDescription>
</Alert>
- <ImportFromJsonForm importFile={importFile} />
+ <ImportFromJsonForm importFile={importFile} translate={translate} />
</>
);
const ImportFromJsonForm = ({
importFile,
+ translate,
}: {
importFile: ImportFromJsonFunction;
+ translate: (key: string, options?: any) => string;
}) => (
<Form
onSubmit={(values: any) => {
@@ -112,50 +137,69 @@ const ImportFromJsonForm = ({
<FileField source="src" title="title" />
</FileInput>
<div className="flex justify-end mt-4">
- <Button type="submit">Import</Button>
+ <Button type="submit">
+ {translate("crm.import.action.import", { _: "Import" })}
+ </Button>
</div>
</Form>
);
const ImportFromJsonStatus = ({
importState,
+ translate,
}: {
importState: ImportFromJsonState;
+ translate: (key: string, options?: any) => string;
}) => (
<>
<Spinner />
<p className="my-4 text-sm text-center text-muted-foreground">
- Import in progress, please don't navigate away from this page.
+ {translate("crm.import.status.in_progress", {
+ _: "Import in progress, please don't navigate away from this page.",
+ })}
</p>
- <ImportStats importState={importState} />
+ <ImportStats importState={importState} translate={translate} />
</>
);
const ImportFromJsonSuccess = ({
importState,
reset,
+ translate,
}: {
importState: ImportFromJsonState;
reset: () => void;
+ translate: (key: string, options?: any) => string;
}) => (
<>
<p className="mb-4 text-sm">
- Import complete.{" "}
+ {translate("crm.import.status.complete", { _: "Import complete." })}{" "}
{hasFailedImports(importState.failedImports) ? (
<>
<span className="text-destructive">
- Some records were not imported.{" "}
+ {translate("crm.import.status.some_failed", {
+ _: "Some records were not imported.",
+ })}{" "}
</span>
- <DownloadErrorFileButton failedImports={importState.failedImports} />
+ <DownloadErrorFileButton
+ failedImports={importState.failedImports}
+ translate={translate}
+ />
</>
) : (
- <span>All records were imported successfully.</span>
+ <span>
+ {translate("crm.import.status.all_success", {
+ _: "All records were imported successfully.",
+ })}
+ </span>
)}
</p>
- <ImportStats importState={importState} />
+ <ImportStats importState={importState} translate={translate} />
<div className="flex justify-end mt-4">
<Button variant="outline" onClick={reset}>
- Import another file
+ {translate("crm.import.action.import_another", {
+ _: "Import another file",
+ })}
</Button>
</div>
</>
@@ -173,8 +217,10 @@ const hasFailedImports = (failedImports: ImportFromJsonFailures) => {
const DownloadErrorFileButton = ({
failedImports,
+ translate,
}: {
failedImports: ImportFromJsonFailures;
+ translate: (key: string, options?: any) => string;
}) => {
return (
<a
@@ -187,15 +233,19 @@ const DownloadErrorFileButton = ({
}}
download="atomic-crm-import-report.json"
>
- Download the error report
+ {translate("crm.import.action.download_error_report", {
+ _: "Download the error report",
+ })}
</a>
);
};
const ImportStats = ({
importState: { stats, failedImports },
+ translate,
}: {
importState: ImportFromJsonState;
+ translate: (key: string, options?: any) => string;
}) => {
const data = [
{
@@ -226,12 +276,18 @@ const ImportStats = ({
];
return (
<Table>
- <TableCaption className="sr-only">Import status</TableCaption>
+ <TableCaption className="sr-only">
+ {translate("crm.import.status.table_caption", { _: "Import status" })}
+ </TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-25"></TableHead>
- <TableHead className="text-right">Imported</TableHead>
- <TableHead className="text-right">Failed</TableHead>
+ <TableHead className="text-right">
+ {translate("crm.import.status.imported", { _: "Imported" })}
+ </TableHead>
+ <TableHead className="text-right">
+ {translate("crm.import.status.failed", { _: "Failed" })}
+ </TableHead>
</TableRow>
</TableHeader>
<TableBody>
diff --git a/src/components/atomic-crm/misc/ResponsiveFilters.tsx b/src/components/atomic-crm/misc/ResponsiveFilters.tsx
index 069c8421..766c7503 100644
--- a/src/components/atomic-crm/misc/ResponsiveFilters.tsx
+++ b/src/components/atomic-crm/misc/ResponsiveFilters.tsx
@@ -1,4 +1,4 @@
-import { FilterLiveForm, useListContext } from "ra-core";
+import { FilterLiveForm, useListContext, useTranslate } from "ra-core";
import { SearchInput, type SearchInputProps } from "@/components/admin";
import {
Sheet,
@@ -25,6 +25,7 @@ export const ResponsiveFilters = ({
children: React.ReactNode;
searchInput?: Partial<SearchInputProps>;
}) => {
+ const translate = useTranslate();
const {
source = "q",
className,
@@ -61,7 +62,7 @@ export const ResponsiveFilters = ({
variant="ghost"
size="icon"
className="relative size-9"
- aria-label="Filter"
+ aria-label={translate("ra.action.add_filter", { _: "Filter" })}
>
<Filter className="size-5" />
{activeFiltersCount > 0 && (
@@ -77,7 +78,9 @@ export const ResponsiveFilters = ({
<SheetContent side="bottom" className="h-dvh p-4 flex flex-col">
<SheetHeader className="-p-4">
<SheetTitle>
- <h1 className="text-xl font-semibold">Filters</h1>
+ <h1 className="text-xl font-semibold">
+ {translate("ra.action.add_filter", { _: "Filters" })}
+ </h1>
</SheetTitle>
</SheetHeader>
<div className="flex-1 overflow-y-auto flex flex-col gap-3 pb-4">
@@ -93,11 +96,15 @@ export const ResponsiveFilters = ({
variant="secondary"
className="flex-1"
>
- Clear filters
+ {translate("ra.navigation.clear_filters", {
+ _: "Clear filters",
+ })}
</Button>
</SheetClose>
<SheetClose asChild>
- <Button className="flex-1">Apply</Button>
+ <Button className="flex-1">
+ {translate("ra.action.confirm", { _: "Apply" })}
+ </Button>
</SheetClose>
</div>
</SheetFooter>
diff --git a/src/components/atomic-crm/notes/Note.tsx b/src/components/atomic-crm/notes/Note.tsx
index 411d8b69..7ad40141 100644
--- a/src/components/atomic-crm/notes/Note.tsx
+++ b/src/components/atomic-crm/notes/Note.tsx
@@ -4,6 +4,7 @@ import {
useDelete,
useNotify,
useResourceContext,
+ useTranslate,
useUpdate,
WithRecord,
} from "ra-core";
@@ -43,6 +44,7 @@ export const Note = ({
const contentRef = useRef<HTMLDivElement>(null);
const resource = useResourceContext();
const notify = useNotify();
+ const translate = useTranslate();
// Detect if content is truncated
useEffect(() => {
@@ -57,7 +59,13 @@ export const Note = ({
const [deleteNote] = useDelete(resource, undefined, {
mutationMode: "undoable",
onSuccess: () => {
- notify("Note deleted", { type: "info", undoable: true });
+ notify("crm.notes.deleted", {
+ type: "info",
+ undoable: true,
+ messageArgs: {
+ _: "Note deleted",
+ },
+ });
},
});
@@ -126,7 +134,7 @@ export const Note = ({
</Button>
</TooltipTrigger>
<TooltipContent>
- <p>Edit note</p>
+ <p>{translate("crm.notes.action.edit", { _: "Edit note" })}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -143,7 +151,9 @@ export const Note = ({
</Button>
</TooltipTrigger>
<TooltipContent>
- <p>Delete note</p>
+ <p>
+ {translate("crm.notes.action.delete", { _: "Delete note" })}
+ </p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -164,7 +174,7 @@ export const Note = ({
className="cursor-pointer"
>
<CircleX className="w-4 h-4" />
- Cancel
+ {translate("ra.action.cancel", { _: "Cancel" })}
</Button>
<Button
type="submit"
@@ -172,7 +182,7 @@ export const Note = ({
className="flex items-center gap-2 cursor-pointer"
>
<Save className="w-4 h-4" />
- Update note
+ {translate("crm.notes.action.update", { _: "Update note" })}
</Button>
</div>
</Form>
@@ -199,7 +209,9 @@ export const Note = ({
}}
className="text-primary text-sm mt-1 underline hover:no-underline cursor-pointer"
>
- {isExpanded ? "Show less" : "Read more"}
+ {isExpanded
+ ? translate("crm.common.show_less", { _: "Show less" })
+ : translate("crm.common.read_more", { _: "Read more" })}
</button>
)}
diff --git a/src/components/atomic-crm/notes/NoteShowPage.tsx b/src/components/atomic-crm/notes/NoteShowPage.tsx
index 1cb3eb03..ad5a66b5 100644
--- a/src/components/atomic-crm/notes/NoteShowPage.tsx
+++ b/src/components/atomic-crm/notes/NoteShowPage.tsx
@@ -1,5 +1,10 @@
import { Pencil } from "lucide-react";
-import { RecordRepresentation, useGetOne, WithRecord } from "ra-core";
+import {
+ RecordRepresentation,
+ useGetOne,
+ useTranslate,
+ WithRecord,
+} from "ra-core";
import { useState } from "react";
import { Link, useParams } from "react-router";
import { ReferenceField } from "@/components/admin/reference-field";
@@ -17,6 +22,7 @@ import { NoteAttachments } from "./NoteAttachments";
import { NoteEditSheet } from "./NoteEditSheet";
export const NoteShowPage = () => {
+ const translate = useTranslate();
const { id: contactId, noteId } = useParams<{
id: string;
noteId: string;
@@ -41,7 +47,7 @@ export const NoteShowPage = () => {
<div className="flex flex-1 min-w-0">
<Link to={`/contacts/${contactId}/show`} className="flex-1 min-w-0">
<h1 className="truncate text-xl font-semibold">
- Note for{" "}
+ {translate("crm.notes.note_for", { _: "Note for" })}{" "}
<ReferenceField
record={note}
resource="contact_notes"
@@ -62,14 +68,16 @@ export const NoteShowPage = () => {
onClick={() => setEditOpen(true)}
>
<Pencil className="size-5" />
- <span className="sr-only">Edit note</span>
+ <span className="sr-only">
+ {translate("crm.notes.action.edit", { _: "Edit note" })}
+ </span>
</Button>
</MobileHeader>
<MobileContent>
<div className="mb-4">
<div className="flex items-center space-x-2 w-full text-sm text-muted-foreground">
<span>
- By{" "}
+ {translate("crm.common.by", { _: "By" })}{" "}
<ReferenceField
record={note}
resource="contact_notes"
diff --git a/src/components/atomic-crm/root/i18nProvider.tsx b/src/components/atomic-crm/root/i18nProvider.tsx
index cc483c8c..507898fc 100644
--- a/src/components/atomic-crm/root/i18nProvider.tsx
+++ b/src/components/atomic-crm/root/i18nProvider.tsx
@@ -25,12 +25,95 @@ const raSupabaseFrenchMessagesOverride = {
const englishCrmMessages = {
crm: {
language: "Language",
+ common: {
+ account_manager: "Account manager",
+ },
+ companies: {
+ action: {
+ create: "Create Company",
+ },
+ },
+ contacts: {
+ action: {
+ new: "New Contact",
+ },
+ inputs: {
+ email_addresses: "Email addresses",
+ phone_numbers: "Phone numbers",
+ linkedin_url: "LinkedIn URL",
+ background_info: "Background info (bio, how you met, etc)",
+ },
+ import: {
+ csv_file: "CSV File",
+ },
+ },
+ deals: {
+ action: {
+ create: "Create deal",
+ },
+ inputs: {
+ name: "Deal name",
+ contacts: "Contacts",
+ category: "Category",
+ },
+ fields: {
+ description: "Description",
+ },
+ },
+ settings: {
+ app_title: "App Title",
+ sections: {
+ branding: "Branding",
+ },
+ },
},
};
const frenchCrmMessages = {
crm: {
language: "Langue",
+ common: {
+ account_manager: "Responsable de compte",
+ },
+ companies: {
+ action: {
+ create: "Créer une entreprise",
+ },
+ },
+ contacts: {
+ action: {
+ new: "Nouveau contact",
+ },
+ inputs: {
+ email_addresses: "Adresses e-mail",
+ phone_numbers: "Numéros de téléphone",
+ linkedin_url: "URL LinkedIn",
+ background_info:
+ "Informations de contexte (bio, comment vous vous êtes rencontrés, etc.)",
+ },
+ import: {
+ csv_file: "Fichier CSV",
+ },
+ },
+ deals: {
+ action: {
+ create: "Créer un deal",
+ },
+ inputs: {
+ name: "Nom du deal",
+ contacts: "Contacts",
+ category: "Catégorie",
+ },
+ fields: {
+ description: "Description",
+ },
+ },
+ settings: {
+ app_title: "Titre de l'application",
+ sections: {
+ branding: "Image de marque",
+ },
+ },
},
};
diff --git a/src/components/atomic-crm/sales/SalesCreate.tsx b/src/components/atomic-crm/sales/SalesCreate.tsx
index 24585b29..e56658b1 100644
--- a/src/components/atomic-crm/sales/SalesCreate.tsx
+++ b/src/components/atomic-crm/sales/SalesCreate.tsx
@@ -1,5 +1,5 @@
import { useMutation } from "@tanstack/react-query";
-import { useDataProvider, useNotify, useRedirect } from "ra-core";
+import { useDataProvider, useNotify, useRedirect, useTranslate } from "ra-core";
import type { SubmitHandler } from "react-hook-form";
import { SimpleForm } from "@/components/admin/simple-form";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -11,6 +11,7 @@ import { SalesInputs } from "./SalesInputs";
export function SalesCreate() {
const dataProvider = useDataProvider<CrmDataProvider>();
const notify = useNotify();
+ const translate = useTranslate();
const redirect = useRedirect();
const { mutate } = useMutation({
@@ -19,15 +20,23 @@ export function SalesCreate() {
return dataProvider.salesCreate(data);
},
onSuccess: () => {
- notify(
- "User created. They will soon receive an email to set their password.",
- );
+ notify("crm.sales.create.success", {
+ messageArgs: {
+ _: "User created. They will soon receive an email to set their password.",
+ },
+ });
redirect("/sales");
},
onError: (error) => {
- notify(error.message || "An error occurred while creating the user.", {
- type: "error",
- });
+ notify(
+ error.message ||
+ translate("crm.sales.create.error", {
+ _: "An error occurred while creating the user.",
+ }),
+ {
+ type: "error",
+ },
+ );
},
});
const onSubmit: SubmitHandler<SalesFormData> = async (data) => {
@@ -38,7 +47,9 @@ export function SalesCreate() {
<div className="max-w-lg w-full mx-auto mt-8">
<Card>
<CardHeader>
- <CardTitle>Create a new user</CardTitle>
+ <CardTitle>
+ {translate("crm.sales.create.title", { _: "Create a new user" })}
+ </CardTitle>
</CardHeader>
<CardContent>
<SimpleForm onSubmit={onSubmit as SubmitHandler<any>}>
diff --git a/src/components/atomic-crm/settings/SettingsPage.tsx b/src/components/atomic-crm/settings/SettingsPage.tsx
index 43ac8fd7..a6039700 100644
--- a/src/components/atomic-crm/settings/SettingsPage.tsx
+++ b/src/components/atomic-crm/settings/SettingsPage.tsx
@@ -1,6 +1,13 @@
import { RotateCcw, Save } from "lucide-react";
import type { RaRecord } from "ra-core";
-import { EditBase, Form, useGetList, useInput, useNotify } from "ra-core";
+import {
+ EditBase,
+ Form,
+ useGetList,
+ useInput,
+ useNotify,
+ useTranslate,
+} from "ra-core";
import { useCallback, useMemo } from "react";
import { useFormContext } from "react-hook-form";
import { Button } from "@/components/ui/button";
@@ -20,11 +27,19 @@ import {
import { defaultConfiguration } from "../root/defaultConfiguration";
const SECTIONS = [
- { id: "branding", label: "Branding" },
- { id: "companies", label: "Companies" },
- { id: "deals", label: "Deals" },
- { id: "notes", label: "Notes" },
- { id: "tasks", label: "Tasks" },
+ {
+ id: "branding",
+ label: "crm.settings.sections.branding",
+ fallback: "Branding",
+ },
+ {
+ id: "companies",
+ label: "resources.companies.name",
+ fallback: "Companies",
+ },
+ { id: "deals", label: "resources.deals.name", fallback: "Deals" },
+ { id: "notes", label: "resources.contact_notes.name", fallback: "Notes" },
+ { id: "tasks", label: "resources.tasks.name", fallback: "Tasks" },
];
/** Ensure every item in a { value, label } array has a value (slug from label). */
@@ -100,10 +115,19 @@ export const SettingsPage = () => {
mutationOptions={{
onSuccess: (data: any) => {
updateConfiguration(data.config);
- notify("Configuration saved successfully");
+ notify("crm.settings.saved", {
+ messageArgs: {
+ _: "Configuration saved successfully",
+ },
+ });
},
onError: () => {
- notify("Failed to save configuration", { type: "error" });
+ notify("crm.settings.save_error", {
+ type: "error",
+ messageArgs: {
+ _: "Failed to save configuration",
+ },
+ });
},
}}
>
@@ -140,6 +164,7 @@ const SettingsForm = () => {
};
const SettingsFormFields = () => {
+ const translate = useTranslate();
const {
watch,
setValue,
@@ -171,7 +196,9 @@ const SettingsFormFields = () => {
{/* Left navigation */}
<nav className="hidden md:block w-48 shrink-0">
<div className="sticky top-4 space-y-1">
- <h1 className="text-2xl font-semibold px-3 mb-2">Settings</h1>
+ <h1 className="text-2xl font-semibold px-3 mb-2">
+ {translate("crm.settings.title", { _: "Settings" })}
+ </h1>
{SECTIONS.map((section) => (
<button
key={section.id}
@@ -183,7 +210,10 @@ const SettingsFormFields = () => {
}}
className="block w-full text-left px-3 py-1 text-sm rounded-md hover:text-foreground hover:bg-muted transition-colors"
>
- {section.label}
+ {translate(section.label, {
+ _: section.fallback,
+ smart_count: 2,
+ })}
</button>
))}
</div>
@@ -195,12 +225,16 @@ const SettingsFormFields = () => {
<Card id="branding">
<CardContent className="space-y-4">
<h2 className="text-xl font-semibold text-muted-foreground">
- Branding
+ {translate("crm.settings.sections.branding", { _: "Branding" })}
</h2>
- <TextInput source="title" label="App Title" />
+ <TextInput source="title" label="crm.settings.app_title" />
<div className="flex gap-8">
<div className="flex flex-col items-center gap-1">
- <p className="text-sm text-muted-foreground">Light Mode Logo</p>
+ <p className="text-sm text-muted-foreground">
+ {translate("crm.settings.light_mode_logo", {
+ _: "Light Mode Logo",
+ })}
+ </p>
<ImageEditorField
source="lightModeLogo"
width={100}
@@ -210,7 +244,11 @@ const SettingsFormFields = () => {
/>
</div>
<div className="flex flex-col items-center gap-1">
- <p className="text-sm text-muted-foreground">Dark Mode Logo</p>
+ <p className="text-sm text-muted-foreground">
+ {translate("crm.settings.dark_mode_logo", {
+ _: "Dark Mode Logo",
+ })}
+ </p>
<ImageEditorField
source="darkModeLogo"
width={100}
@@ -227,10 +265,13 @@ const SettingsFormFields = () => {
<Card id="companies">
<CardContent className="space-y-4">
<h2 className="text-xl font-semibold text-muted-foreground">
- Companies
+ {translate("resources.companies.name", {
+ smart_count: 2,
+ _: "Companies",
+ })}
</h2>
<h3 className="text-lg font-medium text-muted-foreground">
- Sectors
+ {translate("crm.settings.companies.sectors", { _: "Sectors" })}
</h3>
<ArrayInput
source="companySectors"
@@ -248,10 +289,13 @@ const SettingsFormFields = () => {
<Card id="deals">
<CardContent className="space-y-4">
<h2 className="text-xl font-semibold text-muted-foreground">
- Deals
+ {translate("resources.deals.name", {
+ smart_count: 2,
+ _: "Deals",
+ })}
</h2>
<h3 className="text-lg font-medium text-muted-foreground">
- Stages
+ {translate("crm.settings.deals.stages", { _: "Stages" })}
</h3>
<ArrayInput
source="dealStages"
@@ -267,11 +311,14 @@ const SettingsFormFields = () => {
<Separator />
<h3 className="text-lg font-medium text-muted-foreground">
- Pipeline Statuses
+ {translate("crm.settings.deals.pipeline_statuses", {
+ _: "Pipeline Statuses",
+ })}
</h3>
<p className="text-sm text-muted-foreground">
- Select which deal stages count as &quot;pipeline&quot; (completed)
- deals.
+ {translate("crm.settings.deals.pipeline_help", {
+ _: 'Select which deal stages count as "pipeline" (completed) deals.',
+ })}
</p>
<div className="flex flex-wrap gap-2">
{dealStages?.map(
@@ -309,7 +356,7 @@ const SettingsFormFields = () => {
<Separator />
<h3 className="text-lg font-medium text-muted-foreground">
- Categories
+ {translate("crm.settings.deals.categories", { _: "Categories" })}
</h3>
<ArrayInput
source="dealCategories"
@@ -328,10 +375,13 @@ const SettingsFormFields = () => {
<Card id="notes">
<CardContent className="space-y-4">
<h2 className="text-xl font-semibold text-muted-foreground">
- Notes
+ {translate("resources.contact_notes.name", {
+ smart_count: 2,
+ _: "Notes",
+ })}
</h2>
<h3 className="text-lg font-medium text-muted-foreground">
- Statuses
+ {translate("crm.settings.notes.statuses", { _: "Statuses" })}
</h3>
<ArrayInput source="noteStatuses" label={false} helperText={false}>
<SimpleFormIterator inline disableReordering disableClear>
@@ -346,9 +396,14 @@ const SettingsFormFields = () => {
<Card id="tasks">
<CardContent className="space-y-4">
<h2 className="text-xl font-semibold text-muted-foreground">
- Tasks
+ {translate("resources.tasks.name", {
+ smart_count: 2,
+ _: "Tasks",
+ })}
</h2>
- <h3 className="text-lg font-medium text-muted-foreground">Types</h3>
+ <h3 className="text-lg font-medium text-muted-foreground">
+ {translate("crm.settings.tasks.types", { _: "Types" })}
+ </h3>
<ArrayInput source="taskTypes" label={false} helperText={false}>
<SimpleFormIterator disableReordering disableClear>
<TextInput source="label" label={false} />
@@ -377,7 +432,9 @@ const SettingsFormFields = () => {
}
>
<RotateCcw className="h-4 w-4 mr-1" />
- Reset to Defaults
+ {translate("crm.settings.reset_defaults", {
+ _: "Reset to Defaults",
+ })}
</Button>
<div className="flex gap-2">
<Button
@@ -385,11 +442,13 @@ const SettingsFormFields = () => {
variant="outline"
onClick={() => window.history.back()}
>
- Cancel
+ {translate("ra.action.cancel", { _: "Cancel" })}
</Button>
<Button type="submit" disabled={isSubmitting}>
<Save className="h-4 w-4 mr-1" />
- {isSubmitting ? "Saving..." : "Save"}
+ {isSubmitting
+ ? translate("crm.settings.saving", { _: "Saving..." })
+ : translate("ra.action.save", { _: "Save" })}
</Button>
</div>
</div>
diff --git a/src/components/atomic-crm/tasks/AddTask.tsx b/src/components/atomic-crm/tasks/AddTask.tsx
index 58c282bc..e747bab1 100644
--- a/src/components/atomic-crm/tasks/AddTask.tsx
+++ b/src/components/atomic-crm/tasks/AddTask.tsx
@@ -7,6 +7,7 @@ import {
useGetIdentity,
useNotify,
useRecordContext,
+ useTranslate,
useUpdate,
} from "ra-core";
import { useState } from "react";
@@ -39,6 +40,7 @@ export const AddTask = ({
const dataProvider = useDataProvider();
const [update] = useUpdate();
const notify = useNotify();
+ const translate = useTranslate();
const contact = useRecordContext();
const [open, setOpen] = useState(false);
const handleOpen = () => {
@@ -58,7 +60,9 @@ export const AddTask = ({
previousData: contact.data,
});
- notify("Task added");
+ notify("crm.tasks.added", {
+ messageArgs: { _: "Task added" },
+ });
};
if (!identity) return null;
@@ -78,7 +82,9 @@ export const AddTask = ({
<Plus className="w-4 h-4" />
</Button>
</TooltipTrigger>
- <TooltipContent>Create task</TooltipContent>
+ <TooltipContent>
+ {translate("crm.tasks.action.create", { _: "Create task" })}
+ </TooltipContent>
</Tooltip>
</TooltipProvider>
) : (
@@ -90,7 +96,7 @@ export const AddTask = ({
size="sm"
>
<Plus className="w-4 h-4" />
- Add task
+ {translate("crm.tasks.action.add", { _: "Add task" })}
</Button>
</div>
)}
@@ -111,8 +117,12 @@ export const AddTask = ({
<DialogHeader>
<DialogTitle>
{!selectContact
- ? "Create a new task for "
- : "Create a new task"}
+ ? translate("crm.tasks.dialog.create_for", {
+ _: "Create a new task for ",
+ })
+ : translate("crm.tasks.dialog.create", {
+ _: "Create a new task",
+ })}
{!selectContact && (
<RecordRepresentation
record={contact}
diff --git a/src/components/atomic-crm/tasks/MobileTasksList.tsx b/src/components/atomic-crm/tasks/MobileTasksList.tsx
index a0639c95..e2661f03 100644
--- a/src/components/atomic-crm/tasks/MobileTasksList.tsx
+++ b/src/components/atomic-crm/tasks/MobileTasksList.tsx
@@ -1,14 +1,20 @@
import { MobileContent } from "../layout/MobileContent";
import MobileHeader from "../layout/MobileHeader";
import { TasksListContent } from "./TasksListContent";
+import { useTranslate } from "ra-core";
-export const MobileTasksList = () => (
- <>
- <MobileHeader>
- <h1 className="text-xl font-semibold">Tasks</h1>
- </MobileHeader>
- <MobileContent>
- <TasksListContent />
- </MobileContent>
- </>
-);
+export const MobileTasksList = () => {
+ const translate = useTranslate();
+ return (
+ <>
+ <MobileHeader>
+ <h1 className="text-xl font-semibold">
+ {translate("resources.tasks.name", { smart_count: 2, _: "Tasks" })}
+ </h1>
+ </MobileHeader>
+ <MobileContent>
+ <TasksListContent />
+ </MobileContent>
+ </>
+ );
+};
diff --git a/src/components/atomic-crm/tasks/Task.tsx b/src/components/atomic-crm/tasks/Task.tsx
index dc1d86d2..f4ae0817 100644
--- a/src/components/atomic-crm/tasks/Task.tsx
+++ b/src/components/atomic-crm/tasks/Task.tsx
@@ -1,6 +1,11 @@
import { useQueryClient } from "@tanstack/react-query";
import { MoreVertical } from "lucide-react";
-import { useDeleteWithUndoController, useNotify, useUpdate } from "ra-core";
+import {
+ useDeleteWithUndoController,
+ useNotify,
+ useTranslate,
+ useUpdate,
+} from "ra-core";
import { useEffect, useState } from "react";
import { ReferenceField } from "@/components/admin/reference-field";
import { DateField } from "@/components/admin/date-field";
@@ -29,6 +34,7 @@ export const Task = ({
const isMobile = useIsMobile();
const { taskTypes } = useConfigurationContext();
const notify = useNotify();
+ const translate = useTranslate();
const queryClient = useQueryClient();
const [openEdit, setOpenEdit] = useState(false);
@@ -44,7 +50,12 @@ export const Task = ({
redirect: false,
mutationOptions: {
onSuccess() {
- notify("Task deleted successfully", { undoable: true });
+ notify("crm.tasks.deleted", {
+ undoable: true,
+ messageArgs: {
+ _: "Task deleted successfully",
+ },
+ });
},
},
});
@@ -106,7 +117,7 @@ export const Task = ({
{task.text}
</div>
<div className="text-sm text-muted-foreground">
- due&nbsp;
+ {translate("crm.tasks.fields.due", { _: "due" })}&nbsp;
<DateField source="due_date" record={task} showDate showTime />
{showContact && (
<ReferenceField<TData, Contact>
@@ -120,7 +131,7 @@ export const Task = ({
return (
<>
{" "}
- (Re:&nbsp;
+ ({translate("crm.common.regarding", { _: "Re:" })}&nbsp;
{referenceRecord?.first_name}{" "}
{referenceRecord?.last_name})
</>
@@ -138,7 +149,9 @@ export const Task = ({
variant="ghost"
size="icon"
className="h-5 pr-0! size-8 cursor-pointer"
- aria-label="task actions"
+ aria-label={translate("crm.tasks.actions.title", {
+ _: "task actions",
+ })}
>
<MoreVertical className="size-5 md:size-4" />
</Button>
@@ -158,7 +171,9 @@ export const Task = ({
});
}}
>
- Postpone to tomorrow
+ {translate("crm.tasks.actions.postpone_tomorrow", {
+ _: "Postpone to tomorrow",
+ })}
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer h-12 md:h-8 px-4 md:px-2 text-base md:text-sm"
@@ -174,19 +189,21 @@ export const Task = ({
});
}}
>
- Postpone to next week
+ {translate("crm.tasks.actions.postpone_next_week", {
+ _: "Postpone to next week",
+ })}
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer h-12 md:h-8 px-4 md:px-2 text-base md:text-sm"
onClick={handleEdit}
>
- Edit
+ {translate("ra.action.edit", { _: "Edit" })}
</DropdownMenuItem>
<DropdownMenuItem
className="cursor-pointer h-12 md:h-8 px-4 md:px-2 text-base md:text-sm"
onClick={handleDelete}
>
- Delete
+ {translate("ra.action.delete", { _: "Delete" })}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
diff --git a/src/components/atomic-crm/tasks/TaskEdit.tsx b/src/components/atomic-crm/tasks/TaskEdit.tsx
index 7201c039..0658c06d 100644
--- a/src/components/atomic-crm/tasks/TaskEdit.tsx
+++ b/src/components/atomic-crm/tasks/TaskEdit.tsx
@@ -1,4 +1,10 @@
-import { EditBase, Form, useNotify, type Identifier } from "ra-core";
+import {
+ EditBase,
+ Form,
+ useNotify,
+ useTranslate,
+ type Identifier,
+} from "ra-core";
import { DeleteButton } from "@/components/admin/delete-button";
import { SaveButton } from "@/components/admin/form";
import {
@@ -21,6 +27,7 @@ export const TaskEdit = ({
close: () => void;
}) => {
const notify = useNotify();
+ const translate = useTranslate();
return (
<Dialog open={open} onOpenChange={close}>
{open && taskId && (
@@ -31,9 +38,12 @@ export const TaskEdit = ({
mutationOptions={{
onSuccess: () => {
close();
- notify("Task updated", {
+ notify("crm.tasks.updated", {
type: "info",
undoable: true,
+ messageArgs: {
+ _: "Task updated",
+ },
});
},
}}
@@ -42,7 +52,9 @@ export const TaskEdit = ({
<DialogContent className="lg:max-w-xl overflow-y-auto max-h-9/10 top-1/20 translate-y-0">
<Form className="flex flex-col gap-4">
<DialogHeader>
- <DialogTitle>Edit task</DialogTitle>
+ <DialogTitle>
+ {translate("crm.tasks.action.edit", { _: "Edit task" })}
+ </DialogTitle>
</DialogHeader>
<TaskFormContent />
<DialogFooter className="w-full sm:justify-between gap-4">
@@ -50,15 +62,18 @@ export const TaskEdit = ({
mutationOptions={{
onSuccess: () => {
close();
- notify("Task deleted", {
+ notify("crm.tasks.deleted", {
type: "info",
undoable: true,
+ messageArgs: {
+ _: "Task deleted",
+ },
});
},
}}
redirect={false}
/>
- <SaveButton label="Save" />
+ <SaveButton label="ra.action.save" />
</DialogFooter>
</Form>
</DialogContent>
diff --git a/src/components/atomic-crm/tasks/TasksListByDueDate.tsx b/src/components/atomic-crm/tasks/TasksListByDueDate.tsx
index 6ea94047..e567df6f 100644
--- a/src/components/atomic-crm/tasks/TasksListByDueDate.tsx
+++ b/src/components/atomic-crm/tasks/TasksListByDueDate.tsx
@@ -4,6 +4,7 @@ import {
useGetIdentity,
useGetList,
useTimeout,
+ useTranslate,
} from "ra-core";
import { useIsMobile } from "@/hooks/use-mobile";
@@ -30,6 +31,7 @@ export const TasksListByDueDate = ({
}) => {
const { identity } = useGetIdentity();
const isMobile = useIsMobile();
+ const translate = useTranslate();
const { data: tasks, isPending } = useGetList(
"tasks",
@@ -101,33 +103,33 @@ export const TasksListByDueDate = ({
<div className="flex flex-col gap-4">
<TaskListFilter
tasks={overdueTasks}
- title="Overdue"
+ title={translate("crm.tasks.filters.overdue", { _: "Overdue" })}
showContact={showContact}
isMobile={isMobile}
/>
<TaskListFilter
tasks={dueTodayTasks}
- title="Today"
+ title={translate("crm.tasks.filters.today", { _: "Today" })}
showContact={showContact}
isMobile={isMobile}
/>
<TaskListFilter
tasks={dueTomorrowTasks}
- title="Tomorrow"
+ title={translate("crm.tasks.filters.tomorrow", { _: "Tomorrow" })}
showContact={showContact}
isMobile={isMobile}
/>
{(!filterByContact || (filterByContact && isBeforeFriday())) && (
<TaskListFilter
tasks={dueThisWeekTasks}
- title="This week"
+ title={translate("crm.tasks.filters.this_week", { _: "This week" })}
showContact={showContact}
isMobile={isMobile}
/>
)}
<TaskListFilter
tasks={dueLaterTasks}
- title="Later"
+ title={translate("crm.tasks.filters.later", { _: "Later" })}
showContact={showContact}
isMobile={isMobile}
/>
diff --git a/src/components/atomic-crm/tasks/TasksListContent.tsx b/src/components/atomic-crm/tasks/TasksListContent.tsx
index 050ac671..994dd597 100644
--- a/src/components/atomic-crm/tasks/TasksListContent.tsx
+++ b/src/components/atomic-crm/tasks/TasksListContent.tsx
@@ -1,12 +1,16 @@
import { TasksListByDueDate } from "./TasksListByDueDate";
+import { useTranslate } from "ra-core";
export const TasksListContent = () => {
+ const translate = useTranslate();
return (
<div className="flex flex-col gap-4">
<TasksListByDueDate
emptyPlaceholder={
<p className="text-sm">
- Tasks added to your contacts will appear here.
+ {translate("crm.tasks.empty_list_hint", {
+ _: "Tasks added to your contacts will appear here.",
+ })}
</p>
}
/>
diff --git a/src/components/atomic-crm/tasks/TasksListFilter.tsx b/src/components/atomic-crm/tasks/TasksListFilter.tsx
index 54bd4eb2..fcf01691 100644
--- a/src/components/atomic-crm/tasks/TasksListFilter.tsx
+++ b/src/components/atomic-crm/tasks/TasksListFilter.tsx
@@ -1,4 +1,9 @@
-import { ListContextProvider, ResourceContextProvider, useList } from "ra-core";
+import {
+ ListContextProvider,
+ ResourceContextProvider,
+ useList,
+ useTranslate,
+} from "ra-core";
import { TasksIterator } from "./TasksIterator";
@@ -15,6 +20,7 @@ export const TaskListFilter = ({
showContact,
isMobile,
}: TaskListProps) => {
+ const translate = useTranslate();
const listContext = useList({
data: tasks,
resource: "tasks",
@@ -45,7 +51,7 @@ export const TaskListFilter = ({
}}
className="text-sm underline hover:no-underline"
>
- Load more
+ {translate("crm.common.load_more", { _: "Load more" })}
</a>
</div>
)}