Skip to content

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

Clean remaining i18n fallbacks

Anibal Svarcas21b68ff80c42
diff --git a/doc/src/content/docs/developers/customizing.mdx b/doc/src/content/docs/developers/customizing.mdx
index 2d059155..6d0103f2 100644
--- a/doc/src/content/docs/developers/customizing.mdx
+++ b/doc/src/content/docs/developers/customizing.mdx
@@ -76,7 +76,7 @@ export default App;
## Languages (i18n)
-Atomic CRM language configuration is managed in `src/components/atomic-crm/providers/i18nProvider.tsx`.
+Atomic CRM language configuration is managed in `src/components/atomic-crm/providers/commons/i18nProvider.ts`.
By default, this repository ships with two locales:
@@ -89,13 +89,15 @@ The `i18nProvider` defines:
- the list of available locales (`availableLocales`)
- how messages are resolved for each locale
+Relative date rendering is handled by `src/components/atomic-crm/misc/RelativeDate.tsx`. If you add a new locale, also update that file to load the matching `date-fns` locale so relative dates keep working in the UI.
+
The language switcher appears in the Profile page when more than one locale is configured.
### Adding a New Language
1. Add or create the message catalog for the new locale. Use the English messages catalog as a base.
2. Merge it with base messages (Shadcn Admin Kit comes with [35 languages integrations](https://marmelab.com/ra-core/translationlocales/))
-2. Edit `src/components/atomic-crm/providers/i18nProvider.tsx` and add the locale to `availableLocales`.
+2. Edit `src/components/atomic-crm/providers/commons/i18nProvider.ts` and add the locale to the provider.
5. Start the app, switch locale from the Profile page, and verify fallback behavior.
### Type-Checking Message Catalogs
diff --git a/src/components/admin/filter-form.tsx b/src/components/admin/filter-form.tsx
index 0b04d95d..d9899c33 100644
--- a/src/components/admin/filter-form.tsx
+++ b/src/components/admin/filter-form.tsx
@@ -373,7 +373,6 @@ export const FilterButton = (props: FilterButtonProps) => {
>
<BookmarkMinus className="h-4 w-4 mr-2" />
{translate("ra.saved_queries.remove_label_with_name", {
- _: 'Remove query "%{name}"',
name: savedQuery.label,
})}
</DropdownMenuItem>
@@ -404,9 +403,7 @@ export const FilterButton = (props: FilterButtonProps) => {
{hasFilterValues && !hasSavedCurrentQuery && !disableSaveQuery && (
<DropdownMenuItem onClick={showAddSavedQueryDialog}>
<BookmarkPlus className="h-4 w-4 mr-2" />
- {translate("ra.saved_queries.new_label", {
- _: "Save current query...",
- })}
+ {translate("ra.saved_queries.new_label")}
</DropdownMenuItem>
)}
{hasFilterValues && (
@@ -417,9 +414,7 @@ export const FilterButton = (props: FilterButtonProps) => {
}}
>
<X className="h-4 w-4 mr-2" />
- {translate("ra.action.remove_all_filters", {
- _: "Remove all filters",
- })}
+ {translate("ra.action.remove_all_filters")}
</DropdownMenuItem>
)}
</DropdownMenuContent>
diff --git a/src/components/atomic-crm/settings/SettingsPage.tsx b/src/components/atomic-crm/settings/SettingsPage.tsx
index b3e4bcfc..1cb5fd9e 100644
--- a/src/components/atomic-crm/settings/SettingsPage.tsx
+++ b/src/components/atomic-crm/settings/SettingsPage.tsx
@@ -74,18 +74,11 @@ export const SettingsPage = () => {
mutationOptions={{
onSuccess: (data: any) => {
updateConfiguration(data.config);
- notify("crm.settings.saved", {
- messageArgs: {
- _: "Configuration saved successfully",
- },
- });
+ notify("crm.settings.saved");
},
onError: () => {
notify("crm.settings.save_error", {
type: "error",
- messageArgs: {
- _: "Failed to save configuration",
- },
});
},
}}
@@ -133,13 +126,9 @@ const SettingsFormFields = () => {
const dealStages = watch("dealStages");
const dealPipelineStatuses: string[] = watch("dealPipelineStatuses") ?? [];
- const stageDisplayName = translate(
- "crm.settings.validation.entities.stages",
- { _: "stages" },
- );
+ const stageDisplayName = translate("crm.settings.validation.entities.stages");
const categoryDisplayName = translate(
"crm.settings.validation.entities.categories",
- { _: "categories" },
);
const { data: deals } = useGetList("deals", {
@@ -153,19 +142,13 @@ const SettingsFormFields = () => {
translate("crm.settings.validation.duplicate", {
display_name: displayName,
items: duplicates.join(", "),
- _: `Duplicate ${displayName}: ${duplicates.join(", ")}`,
}),
inUse: (displayName, inUse) =>
translate("crm.settings.validation.in_use", {
display_name: displayName,
items: inUse.join(", "),
- _:
- `Cannot remove ${displayName} that are still used by deals: ` +
- inUse.join(", "),
}),
- validating: translate("crm.settings.validation.validating", {
- _: "Validating…",
- }),
+ validating: translate("crm.settings.validation.validating"),
}),
[deals, stageDisplayName, translate],
);
@@ -177,19 +160,13 @@ const SettingsFormFields = () => {
translate("crm.settings.validation.duplicate", {
display_name: displayName,
items: duplicates.join(", "),
- _: `Duplicate ${displayName}: ${duplicates.join(", ")}`,
}),
inUse: (displayName, inUse) =>
translate("crm.settings.validation.in_use", {
display_name: displayName,
items: inUse.join(", "),
- _:
- `Cannot remove ${displayName} that are still used by deals: ` +
- inUse.join(", "),
}),
- validating: translate("crm.settings.validation.validating", {
- _: "Validating…",
- }),
+ validating: translate("crm.settings.validation.validating"),
}),
[categoryDisplayName, deals, translate],
);
@@ -213,10 +190,7 @@ const SettingsFormFields = () => {
}}
className="block w-full text-left px-3 py-1 text-sm rounded-md hover:text-foreground hover:bg-muted transition-colors"
>
- {translate(section.label, {
- _: section.fallback,
- smart_count: 2,
- })}
+ {translate(section.label, { smart_count: 2 })}
</button>
))}
</div>
@@ -308,14 +282,10 @@ const SettingsFormFields = () => {
<Separator />
<h3 className="text-lg font-medium text-muted-foreground">
- {translate("crm.settings.deals.pipeline_statuses", {
- _: "Pipeline Statuses",
- })}
+ {translate("crm.settings.deals.pipeline_statuses")}
</h3>
<p className="text-sm text-muted-foreground">
- {translate("crm.settings.deals.pipeline_help", {
- _: 'Select which deal stages count as "pipeline" (completed) deals.',
- })}
+ {translate("crm.settings.deals.pipeline_help")}
</p>
<div className="flex flex-wrap gap-2">
{dealStages?.map(