The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(i18n): translate hard-coded front-end labels (#27331)
Mahmoud Abasf6735155ae05
diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useCampaignEmailEditorVariables.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useCampaignEmailEditorVariables.tsindex ad4a9fe6389..fe9f94f634d 100644--- a/packages/twenty-front/src/modules/activities/emails/hooks/useCampaignEmailEditorVariables.ts+++ b/packages/twenty-front/src/modules/activities/emails/hooks/useCampaignEmailEditorVariables.ts@@ -11,9 +11,10 @@ export const useCampaignEmailEditorVariables = () => {});const variables = [- ...listCampaignVariablesForFields(personObjectMetadataItem.fields).map(- ({ label, name }) => ({ label, value: `{{${name}}}` }),- ),+ ...listCampaignVariablesForFields(personObjectMetadataItem.fields, {+ firstName: t`First name`,+ lastName: t`Last name`,+ }).map(({ label, name }) => ({ label, value: `{{${name}}}` })),{ label: t`Full name`, value: '{{fullName}}' },{ label: t`Person ID`, value: '{{personId}}' },];diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/utils/getTimelineActivityAuthorFullName.ts b/packages/twenty-front/src/modules/activities/timeline-activities/utils/getTimelineActivityAuthorFullName.tsindex 22651e073b4..5a16362a692 100644--- a/packages/twenty-front/src/modules/activities/timeline-activities/utils/getTimelineActivityAuthorFullName.ts+++ b/packages/twenty-front/src/modules/activities/timeline-activities/utils/getTimelineActivityAuthorFullName.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { type TimelineActivity } from '@/activities/timeline-activities/types/TimelineActivity';import { type CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState';import { isDefined } from 'twenty-shared/utils';@@ -8,7 +9,7 @@ export const getTimelineActivityAuthorFullName = () => {if (isDefined(event.workspaceMember)) {return currentWorkspaceMember.id === event.workspaceMember.id- ? 'You'+ ? t`You`: `${event.workspaceMember?.name.firstName} ${event.workspaceMember?.name.lastName}`;}return 'Twenty';diff --git a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/components/ExportNoteSingleRecordCommand.tsx b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/components/ExportNoteSingleRecordCommand.tsxindex 56c91e2aec0..48a620450e5 100644--- a/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/components/ExportNoteSingleRecordCommand.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/engine-command/record/single-record/components/ExportNoteSingleRecordCommand.tsx@@ -1,5 +1,6 @@import { HeadlessEngineCommandWrapperEffect } from '@/command-menu-item/engine-command/components/HeadlessEngineCommandWrapperEffect';import { useHeadlessCommandContextApi } from '@/command-menu-item/engine-command/hooks/useHeadlessCommandContextApi';+import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';export const ExportNoteSingleRecordCommand = () => {@@ -14,7 +15,7 @@ export const ExportNoteSingleRecordCommand = () => {);}- const filename = `${(selectedRecord.title || 'Untitled Note').replace(/[<>:"/\\|?*]/g, '-')}`;+ const filename = `${(selectedRecord.title || t`Untitled Note`).replace(/[<>:"/\\|?*]/g, '-')}`;const handleExecute = async () => {const initialBody = selectedRecord.bodyV2?.blocknote;diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuItem.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuItem.tsxindex da2219a8ce3..db7f57a3594 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuItem.tsx+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuItem.tsx@@ -27,7 +27,7 @@ type KeyboardMenuItemProps = {export const KeyboardMenuItem = ({ shortcut }: KeyboardMenuItemProps) => (<StyledItem>- {shortcut.label}+ {t(shortcut.label)}<StyledShortcuts>{shortcut.shortcuts.map((definition, index) => (<Fragment key={index}>diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral.tsindex 9d660ef2f6b..355fae7b32a 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral.ts+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral.ts@@ -1,12 +1,13 @@import { type Shortcut } from '@/keyboard-shortcut-menu/types/Shortcut';+import { msg } from '@lingui/core/macro';export const KEYBOARD_SHORTCUTS_GENERAL: Shortcut[] = [{- label: 'Open search',+ label: msg`Open search`,shortcuts: [['Mod', 'K']],},{- label: 'Mark as favourite',+ label: msg`Mark as favourite`,shortcuts: [['⇧', 'F']],},];diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsSidePanel.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsSidePanel.tsindex f91168fa46e..573cb43466c 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsSidePanel.ts+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsSidePanel.ts@@ -1,20 +1,21 @@import { type Shortcut } from '@/keyboard-shortcut-menu/types/Shortcut';+import { msg } from '@lingui/core/macro';export const KEYBOARD_SHORTCUTS_SIDE_PANEL: Shortcut[] = [{- label: 'Clear search, go back, or close',+ label: msg`Clear search, go back, or close`,shortcuts: [['esc']],},{- label: 'Go back when search is empty',+ label: msg`Go back when search is empty`,shortcuts: [['⌫']],},{- label: 'Move through list items',+ label: msg`Move through list items`,shortcuts: [['↑'], ['↓']],},{- label: 'Open selected list item',+ label: msg`Open selected list item`,shortcuts: [['↵']],},];diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsTable.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsTable.tsindex 5e491103634..5d3caebb099 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsTable.ts+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/constants/KeyboardShortcutsTable.ts@@ -1,16 +1,17 @@import { type Shortcut } from '@/keyboard-shortcut-menu/types/Shortcut';+import { msg } from '@lingui/core/macro';export const KEYBOARD_SHORTCUTS_TABLE: Shortcut[] = [{- label: 'Move right',+ label: msg`Move right`,shortcuts: [['→']],},{- label: 'Move left',+ label: msg`Move left`,shortcuts: [['←']],},{- label: 'Clear selection',+ label: msg`Clear selection`,shortcuts: [['esc']],},];diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/types/Shortcut.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/types/Shortcut.tsindex 44d94fc48a8..db7350b2312 100644--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/types/Shortcut.ts+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/types/Shortcut.ts@@ -1,6 +1,7 @@+import { type MessageDescriptor } from '@lingui/core';import { type ShortcutDefinition } from 'twenty-ui/primitives/typography';export type Shortcut = {- label: string;+ label: MessageDescriptor;shortcuts: readonly ShortcutDefinition[];};diff --git a/packages/twenty-front/src/modules/localization/utils/__tests__/getCurrencyLabel.test.ts b/packages/twenty-front/src/modules/localization/utils/__tests__/getCurrencyLabel.test.tsnew file mode 100644index 00000000000..179638e0559--- /dev/null+++ b/packages/twenty-front/src/modules/localization/utils/__tests__/getCurrencyLabel.test.ts@@ -0,0 +1,23 @@+import { CurrencyCode } from 'twenty-shared/constants';++import { getCurrencyLabel } from '@/localization/utils/getCurrencyLabel';++describe('getCurrencyLabel', () => {+ it('should keep the source label for the source locale', () => {+ expect(+ getCurrencyLabel({ currencyCode: CurrencyCode.USD, locale: 'en' }),+ ).toBe('United States dollar');+ });++ it('should use the currency name of the locale', () => {+ expect(+ getCurrencyLabel({ currencyCode: CurrencyCode.EUR, locale: 'fr-FR' }),+ ).toBe('euro');+ });++ it('should fall back to the source label for an invalid locale', () => {+ expect(+ getCurrencyLabel({ currencyCode: CurrencyCode.USD, locale: '%%' }),+ ).toBe('United States dollar');+ });+});diff --git a/packages/twenty-front/src/modules/localization/utils/getCurrencyLabel.ts b/packages/twenty-front/src/modules/localization/utils/getCurrencyLabel.tsnew file mode 100644index 00000000000..5402c32eed4--- /dev/null+++ b/packages/twenty-front/src/modules/localization/utils/getCurrencyLabel.ts@@ -0,0 +1,30 @@+import {+ CURRENCY_CODE_LABELS,+ type CurrencyCode,+} from 'twenty-shared/constants';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++export const getCurrencyLabel = ({+ currencyCode,+ locale,+}: {+ currencyCode: CurrencyCode;+ locale: string;+}): string => {+ const sourceLocaleLabel = CURRENCY_CODE_LABELS[currencyCode].label;++ if (locale === SOURCE_LOCALE) {+ return sourceLocaleLabel;+ }++ try {+ return (+ new Intl.DisplayNames([locale], {+ type: 'currency',+ fallback: 'none',+ }).of(currencyCode) ?? sourceLocaleLabel+ );+ } catch {+ return sourceLocaleLabel;+ }+};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/buildCreateNavigationMenuItemInput.ts b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/buildCreateNavigationMenuItemInput.tsindex 13719aea4bc..79ac25d8b65 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/buildCreateNavigationMenuItemInput.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/buildCreateNavigationMenuItemInput.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import type {CreateNavigationMenuItemInput,NavigationMenuItem,@@ -24,7 +25,7 @@ export const buildCreateNavigationMenuItemInput = (input.name = draftItem.name ?? undefined;input.icon = draftItem.icon ?? null;} else if (isNavigationMenuItemLink(draftItem)) {- input.name = draftItem.name ?? 'Link';+ input.name = draftItem.name ?? t`Link`;const linkUrl = (draftItem.link ?? '').trim();input.link = linkUrl? getLinkNavigationMenuItemComputedLink({ link: linkUrl })diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsxindex 06313d459bd..ec219f374be 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx@@ -1,6 +1,7 @@import { NavigationMenuItemEditable } from '@/navigation-menu-item/edit/components/NavigationMenuItemEditable';import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';import { NavigationMenuItemFolderChevron } from '@/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron';+import { getFolderNavigationMenuItemLabel } from '@/navigation-menu-item/display/folder/utils/getFolderNavigationMenuItemLabel';import { Suspense, lazy } from 'react';import { useIcons } from 'twenty-ui/icon';import { useIsMobile } from 'twenty-ui/utilities';@@ -45,7 +46,7 @@ export const NavigationMenuItemFolder = ({orphanIndex,}: NavigationMenuItemFolderProps) => {const folderId = item.id;- const folderName = item.name ?? 'Folder';+ const folderName = getFolderNavigationMenuItemLabel(item);const folderIconKey = item.icon;const folderColor = 'color' in item ? (item.color as string | null) : null;const folderChildrenNavigationMenuItems =diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/hooks/useNavigationMenuItemsByFolder.ts b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/hooks/useNavigationMenuItemsByFolder.tsindex a1a013c36f4..85e93b44f25 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/hooks/useNavigationMenuItemsByFolder.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/hooks/useNavigationMenuItemsByFolder.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';import { type NavigationMenuItem } from '~/generated-metadata/graphql';@@ -44,7 +45,7 @@ export const useNavigationMenuItemsByFolder = () => {if (isNavigationMenuItemFolder(item)) {const folderEntry: NavigationMenuItemFolderEntry = {id: item.id,- folderName: item.name || 'Folder',+ folderName: item.name || t`Folder`,icon: item.icon ?? undefined,color: item.color ?? undefined,};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/utils/getFolderNavigationMenuItemLabel.ts b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/utils/getFolderNavigationMenuItemLabel.tsindex dc4c7235679..5a5929e1ad1 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/utils/getFolderNavigationMenuItemLabel.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/utils/getFolderNavigationMenuItemLabel.ts@@ -1,7 +1,8 @@+import { t } from '@lingui/core/macro';import { type NavigationMenuItem } from '~/generated-metadata/graphql';export const getFolderNavigationMenuItemLabel = (item: Pick<NavigationMenuItem, 'name'>,): string => {- return item.name ?? 'Folder';+ return item.name ?? t`Folder`;};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/link/utils/getLinkNavigationMenuItemLabel.ts b/packages/twenty-front/src/modules/navigation-menu-item/display/link/utils/getLinkNavigationMenuItemLabel.tsindex 83a85f10311..f7105f266f3 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/link/utils/getLinkNavigationMenuItemLabel.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/link/utils/getLinkNavigationMenuItemLabel.ts@@ -1,8 +1,9 @@+import { t } from '@lingui/core/macro';import { type NavigationMenuItem } from '~/generated-metadata/graphql';export const getLinkNavigationMenuItemLabel = (item: Pick<NavigationMenuItem, 'name' | 'link'>,): string => {const linkUrl = (item.link ?? '').trim();- return (item.name ?? linkUrl) || 'Link';+ return (item.name ?? linkUrl) || t`Link`;};diff --git a/packages/twenty-front/src/modules/object-metadata/utils/metadataLabelErrorMessages.ts b/packages/twenty-front/src/modules/object-metadata/utils/metadataLabelErrorMessages.tsindex 44a122fb63b..cf901974bf9 100644--- a/packages/twenty-front/src/modules/object-metadata/utils/metadataLabelErrorMessages.ts+++ b/packages/twenty-front/src/modules/object-metadata/utils/metadataLabelErrorMessages.ts@@ -1,3 +1,5 @@+import { t } from '@lingui/core/macro';+export enum errors {LabelNotUnique = 'LABEL_NOT_UNIQUE',LabelNotFormattable = 'LABEL_NOT_FORMATTABLE',@@ -7,11 +9,11 @@ export enum errors {export const getErrorMessageFromError = (error?: string) => {switch (error) {case errors.LabelEmpty:- return 'Name cannot be empty.';+ return t`Name cannot be empty.`;case errors.LabelNotFormattable:- return 'Name should start with a letter.';+ return t`Name should start with a letter.`;case errors.LabelNotUnique:- return 'This name is already used.';+ return t`This name is already used.`;default:return '';}diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterLogicalOperatorDropdown.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterLogicalOperatorDropdown.tsxindex 3641114fc5f..fbd69824d0f 100644--- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterLogicalOperatorDropdown.tsx+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterLogicalOperatorDropdown.tsx@@ -4,6 +4,7 @@ import { useUpsertRecordFilterGroup } from '@/object-record/record-filter-group/import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup';import { Select } from '@/ui/input/components/Select';import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';+import { useLingui } from '@lingui/react/macro';import { type RecordFilterGroupLogicalOperator } from 'twenty-shared/types';type AdvancedFilterLogicalOperatorDropdownProps = {@@ -13,6 +14,7 @@ type AdvancedFilterLogicalOperatorDropdownProps = {export const AdvancedFilterLogicalOperatorDropdown = ({recordFilterGroup,}: AdvancedFilterLogicalOperatorDropdownProps) => {+ const { t } = useLingui();const { upsertRecordFilterGroup } = useUpsertRecordFilterGroup();const handleChange = (value: RecordFilterGroupLogicalOperator) => {@@ -25,13 +27,20 @@ export const AdvancedFilterLogicalOperatorDropdown = ({});};+ const logicalOperatorOptions = ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS.map(+ (option) => ({+ ...option,+ label: t(option.label),+ }),+ );+return (<SelectdropdownWidth={GenericDropdownContentWidth.Narrow}dropdownId={`advanced-filter-logical-operator-${recordFilterGroup.id}`}value={recordFilterGroup.logicalOperator}onChange={handleChange}- options={ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS}+ options={logicalOperatorOptions}dropdownSideOffset={DEFAULT_ADVANCED_FILTER_DROPDOWN_SIDE_OFFSET}/>);diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/constants/AdvancedFilterLogicalOperatorOptions.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/constants/AdvancedFilterLogicalOperatorOptions.tsindex c38fa006061..5cc10a61821 100644--- a/packages/twenty-front/src/modules/object-record/advanced-filter/constants/AdvancedFilterLogicalOperatorOptions.ts+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/constants/AdvancedFilterLogicalOperatorOptions.ts@@ -1,12 +1,20 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { RecordFilterGroupLogicalOperator } from 'twenty-shared/types';-export const ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS = [- {- value: RecordFilterGroupLogicalOperator.AND,- label: 'And',- },- {- value: RecordFilterGroupLogicalOperator.OR,- label: 'Or',- },-];+type AdvancedFilterLogicalOperatorOption = {+ value: RecordFilterGroupLogicalOperator;+ label: MessageDescriptor;+};++export const ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS: AdvancedFilterLogicalOperatorOption[] =+ [+ {+ value: RecordFilterGroupLogicalOperator.AND,+ label: msg`And`,+ },+ {+ value: RecordFilterGroupLogicalOperator.OR,+ label: msg`Or`,+ },+ ];diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsxindex 0780aeb86ae..95838dd4e8e 100644--- a/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx@@ -9,7 +9,6 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Geneimport { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useContext } from 'react';-import { capitalize } from 'twenty-shared/utils';import { themeCssVariables } from 'twenty-ui/theme';const StyledText = styled.div`@@ -37,6 +36,17 @@ export const AdvancedFilterSidePanelLogicalOperatorCell = ({}: AdvancedFilterSidePanelLogicalOperatorCellProps) => {const { readonly } = useContext(AdvancedFilterContext);+ const logicalOperatorOptions = ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS.map(+ (option) => ({+ ...option,+ label: t(option.label),+ }),+ );++ const logicalOperatorLabel = logicalOperatorOptions.find(+ (option) => option.value === recordFilterGroup.logicalOperator,+ )?.label;+return (<StyledContainer>{index === 0 ? (@@ -47,7 +57,7 @@ export const AdvancedFilterSidePanelLogicalOperatorCell = ({dropdownWidth={GenericDropdownContentWidth.Narrow}dropdownId={`advanced-filter-logical-operator-${recordFilterGroup.id}`}value={recordFilterGroup.logicalOperator}- options={ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS}+ options={logicalOperatorOptions}dropdownSideOffset={DEFAULT_ADVANCED_FILTER_DROPDOWN_SIDE_OFFSET}disabled/>@@ -57,9 +67,7 @@ export const AdvancedFilterSidePanelLogicalOperatorCell = ({/>)) : (- <StyledText>- {capitalize(recordFilterGroup.logicalOperator.toLowerCase())}- </StyledText>+ <StyledText>{logicalOperatorLabel}</StyledText>)}</StyledContainer>);diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsxindex 8eea071e3e1..bd139ff1043 100644--- a/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx@@ -8,7 +8,7 @@ import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/cimport { FormWorkspaceMemberFilterValueInput } from '@/object-record/record-field/ui/form-types/components/FormWorkspaceMemberFilterValueInput';import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter';-import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useContext } from 'react';import { type SelectOption } from 'twenty-ui/primitives/input';@@ -40,6 +40,8 @@ export const AdvancedFilterSidePanelValueFormCompositeFieldInput = ({const { readonly } = useContext(AdvancedFilterContext);+ const currencies = useCurrencies();+return (<>{filterType === 'ADDRESS' ? (@@ -64,7 +66,7 @@ export const AdvancedFilterSidePanelValueFormCompositeFieldInput = ({defaultValue={recordFilter.value}onChange={onChange}VariablePicker={VariablePicker}- options={CURRENCIES}+ options={currencies}readonly={readonly}/>) : recordFilter.subFieldName === 'amountMicros' ? (diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/utils/getAdvancedFilterInputPlacedholderText.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/utils/getAdvancedFilterInputPlacedholderText.tsindex 0949e304734..c70ee36bde0 100644--- a/packages/twenty-front/src/modules/object-record/advanced-filter/utils/getAdvancedFilterInputPlacedholderText.ts+++ b/packages/twenty-front/src/modules/object-record/advanced-filter/utils/getAdvancedFilterInputPlacedholderText.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';import { FieldMetadataType } from '~/generated-metadata/graphql';@@ -5,6 +6,10 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';export const getAdvancedFilterInputPlaceholderText = (fieldMetadataItem: FieldMetadataItem,) => {+ const fieldLabel = fieldMetadataItem.label;+ const targetObjectNameSingular =+ fieldMetadataItem.relation?.targetObjectMetadata.nameSingular ?? '';+switch (fieldMetadataItem.type) {case FieldMetadataType.TEXT:case FieldMetadataType.ADDRESS:@@ -15,21 +20,21 @@ export const getAdvancedFilterInputPlaceholderText = (case FieldMetadataType.PHONES:case FieldMetadataType.ARRAY:case FieldMetadataType.FULL_NAME:- return `Enter value for ${fieldMetadataItem.label}`;+ return t`Enter value for ${fieldLabel}`;case FieldMetadataType.NUMBER:- return 'Enter number';+ return t`Enter number`;case FieldMetadataType.DATE:case FieldMetadataType.DATE_TIME:- return 'Enter date';+ return t`Enter date`;case FieldMetadataType.ACTOR:- return 'Select actor';+ return t`Select actor`;case FieldMetadataType.RELATION:- return `Select ${fieldMetadataItem.relation?.targetObjectMetadata.nameSingular}`;+ return t`Select ${targetObjectNameSingular}`;case FieldMetadataType.SELECT:case FieldMetadataType.MULTI_SELECT:- return `Select ${fieldMetadataItem.label}`;+ return t`Select ${fieldLabel}`;default:- return 'Enter value';+ return t`Enter value`;}};diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsxindex e97bd8ecb1b..d59afa0faa6 100644--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx@@ -3,6 +3,7 @@ import { ListItem } from 'twenty-ui/primitives/navigation';import { useApplyObjectFilterDropdownFilterValue } from '@/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue';import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector';import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState';+import { getCurrencyFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue';import { turnCurrencyIntoSelectableItem } from '@/object-record/object-filter-dropdown/utils/turnCurrencyIntoSelectableItem';import { type SelectableItem } from '@/object-record/select/types/SelectableItem';import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';@@ -10,6 +11,7 @@ import { LegacyDropdownContent } from '@/ui/layout/dropdown/components/LegacyDroimport { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -20,7 +22,6 @@ import { isDefined, parseJson } from 'twenty-shared/utils';import { z } from 'zod';export const EMPTY_FILTER_VALUE = '[]';-export const MAX_ITEMS_TO_DISPLAY = 3;export const ObjectFilterDropdownCurrencySelect = () => {const [searchText, setSearchText] = useState('');@@ -36,7 +37,9 @@ export const ObjectFilterDropdownCurrencySelect = () => {fieldMetadataItemUsedInDropdownComponentSelector,);- const currenciesAsSelectableItems = CURRENCIES.map(+ const currencies = useCurrencies();++ const currenciesAsSelectableItems = currencies.map(turnCurrencyIntoSelectableItem,);@@ -77,16 +80,11 @@ export const ObjectFilterDropdownCurrencySelect = () => {);}- const selectedItemNames = currenciesAsSelectableItems- .filter((option) => newSelectedItemIds.includes(option.id))- .map((option) => option.name);-- const currenciesLabel = t`currencies`;+ const selectedItemNames = CURRENCIES.filter((currency) =>+ newSelectedItemIds.includes(currency.value),+ ).map((currency) => currency.label);- const filterDisplayValue =- selectedItemNames.length > MAX_ITEMS_TO_DISPLAY- ? `${selectedItemNames.length} ${currenciesLabel}`- : selectedItemNames.join(', ');+ const filterDisplayValue = getCurrencyFilterDisplayValue(selectedItemNames);const newFilterValue =newSelectedItemIds.length > 0diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsxindex 6a4f2e0f31d..32151f7847c 100644--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx@@ -1,7 +1,9 @@+import { ACTOR_SOURCE_FILTER_OPTIONS } from '@/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions';import { useApplyObjectFilterDropdownFilterValue } from '@/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue';import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector';import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState';import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState';+import { getActorSourceFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue';import { getActorSourceMultiSelectOptions } from '@/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions';import { MultipleSelectDropdown } from '@/object-record/select/components/MultipleSelectDropdown';import { type SelectableItem } from '@/object-record/select/types/SelectableItem';@@ -9,13 +11,11 @@ import { LegacyDropdownContent } from '@/ui/layout/dropdown/components/LegacyDroimport { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import { isDefined, parseJson } from 'twenty-shared/utils';import { z } from 'zod';export const EMPTY_FILTER_VALUE = '[]';-export const MAX_ITEMS_TO_DISPLAY = 3;export const ObjectFilterDropdownSourceSelect = ({dropdownId,@@ -66,15 +66,12 @@ export const ObjectFilterDropdownSourceSelect = ({);}- const selectedItemNames = sourceTypes- .filter((option) => newSelectedItemIds.includes(option.id))- .map((option) => option.name);+ const selectedItemNames = ACTOR_SOURCE_FILTER_OPTIONS.filter((option) =>+ newSelectedItemIds.includes(option.id),+ ).map((option) => option.name);- const selectedCount = selectedItemNames.length;const filterDisplayValue =- selectedItemNames.length > MAX_ITEMS_TO_DISPLAY- ? t`${selectedCount} source types`- : selectedItemNames.join(', ');+ getActorSourceFilterDisplayValue(selectedItemNames);const newFilterValue =newSelectedItemIds.length > 0diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions.tsnew file mode 100644index 00000000000..503c7e59cba--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions.ts@@ -0,0 +1,76 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import {+ type IconComponent,+ IconApi,+ IconCsv,+ IconGmail,+ IconGoogleCalendar,+ IconRobot,+ IconSettingsAutomation,+ IconUserCircle,+ IconWebhook,+} from 'twenty-ui/icon';++export const ACTOR_SOURCE_FILTER_OPTIONS: Array<{+ id: string;+ name: string;+ label: MessageDescriptor;+ AvatarIcon: IconComponent;+ isIconInverted?: boolean;+}> = [+ {+ id: 'MANUAL',+ name: 'User',+ label: msg`User`,+ AvatarIcon: IconUserCircle,+ isIconInverted: true,+ },+ {+ id: 'IMPORT',+ name: 'Import',+ label: msg`Import`,+ AvatarIcon: IconCsv,+ isIconInverted: true,+ },+ {+ id: 'API',+ name: 'Api',+ label: msg`API`,+ AvatarIcon: IconApi,+ isIconInverted: true,+ },+ {+ id: 'EMAIL',+ name: 'Email',+ label: msg`Email`,+ AvatarIcon: IconGmail,+ },+ {+ id: 'CALENDAR',+ name: 'Calendar',+ label: msg`Calendar`,+ AvatarIcon: IconGoogleCalendar,+ },+ {+ id: 'WORKFLOW',+ name: 'Workflow',+ label: msg`Workflow`,+ AvatarIcon: IconSettingsAutomation,+ isIconInverted: true,+ },+ {+ id: 'WEBHOOK',+ name: 'Webhook',+ label: msg`Webhook`,+ AvatarIcon: IconWebhook,+ isIconInverted: true,+ },+ {+ id: 'SYSTEM',+ name: 'System',+ label: msg`System`,+ AvatarIcon: IconRobot,+ isIconInverted: true,+ },+];diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getActorSourceFilterDisplayValue.test.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getActorSourceFilterDisplayValue.test.tsnew file mode 100644index 00000000000..d96d5a720d9--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getActorSourceFilterDisplayValue.test.ts@@ -0,0 +1,39 @@+import { ACTOR_SOURCE_FILTER_OPTIONS } from '@/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions';+import { getActorSourceFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue';+import { getActorSourceMultiSelectOptions } from '@/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions';+import { i18n } from '@lingui/core';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++describe('getActorSourceFilterDisplayValue', () => {+ afterEach(() => {+ i18n.activate(SOURCE_LOCALE);+ });++ it('should join up to three source names', () => {+ expect(getActorSourceFilterDisplayValue(['User', 'Api', 'Email'])).toBe(+ 'User, Api, Email',+ );+ });++ it('should count the sources when there are more than three', () => {+ expect(+ getActorSourceFilterDisplayValue(['User', 'Api', 'Email', 'System']),+ ).toBe('4 source types');+ });++ it('should translate the option names but keep the English names to save', () => {+ const userOption = ACTOR_SOURCE_FILTER_OPTIONS.find(+ (actorSourceFilterOption) => actorSourceFilterOption.id === 'MANUAL',+ );++ i18n.load('fr-FR', { [userOption?.label.id ?? '']: 'Utilisateur' });+ i18n.activate('fr-FR');++ expect(+ getActorSourceMultiSelectOptions(['MANUAL']).find(+ (option) => option.id === 'MANUAL',+ ),+ ).toMatchObject({ name: 'Utilisateur', isSelected: true });+ expect(userOption?.name).toBe('User');+ });+});diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getCurrencyFilterDisplayValue.test.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getCurrencyFilterDisplayValue.test.tsnew file mode 100644index 00000000000..e08c956ecd2--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getCurrencyFilterDisplayValue.test.ts@@ -0,0 +1,20 @@+import { getCurrencyFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue';++describe('getCurrencyFilterDisplayValue', () => {+ it('should join up to three currency names', () => {+ expect(+ getCurrencyFilterDisplayValue(['Euro (EUR)', 'US Dollar (USD)']),+ ).toBe('Euro (EUR), US Dollar (USD)');+ });++ it('should count the currencies when there are more than three', () => {+ expect(+ getCurrencyFilterDisplayValue([+ 'Euro (EUR)',+ 'US Dollar (USD)',+ 'Japanese Yen (JPY)',+ 'Swiss Franc (CHF)',+ ]),+ ).toBe('4 currencies');+ });+});diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue.tsnew file mode 100644index 00000000000..0972b80374b--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue.ts@@ -0,0 +1,11 @@+import { t } from '@lingui/core/macro';++const MAX_SOURCE_NAMES_TO_DISPLAY = 3;++export const getActorSourceFilterDisplayValue = (sourceNames: string[]) => {+ const sourceCount = sourceNames.length;++ return sourceCount > MAX_SOURCE_NAMES_TO_DISPLAY+ ? t`${sourceCount} source types`+ : sourceNames.join(', ');+};diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions.tsindex a6450b11926..87b8f8850a4 100644--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions.ts+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions.ts@@ -1,72 +1,14 @@+import { ACTOR_SOURCE_FILTER_OPTIONS } from '@/object-record/object-filter-dropdown/constants/ActorSourceFilterOptions';import { type SelectableItem } from '@/object-record/select/types/SelectableItem';-import {- IconApi,- IconCsv,- IconGmail,- IconGoogleCalendar,- IconRobot,- IconSettingsAutomation,- IconUserCircle,- IconWebhook,-} from 'twenty-ui/icon';+import { t } from '@lingui/core/macro';export const getActorSourceMultiSelectOptions = (selectedSourceNames: string[],-): SelectableItem[] => {- return [- {- id: 'MANUAL',- name: 'User',- isSelected: selectedSourceNames.includes('MANUAL'),- AvatarIcon: IconUserCircle,- isIconInverted: true,- },- {- id: 'IMPORT',- name: 'Import',- isSelected: selectedSourceNames.includes('IMPORT'),- AvatarIcon: IconCsv,- isIconInverted: true,- },- {- id: 'API',- name: 'Api',- isSelected: selectedSourceNames.includes('API'),- AvatarIcon: IconApi,- isIconInverted: true,- },- {- id: 'EMAIL',- name: 'Email',- isSelected: selectedSourceNames.includes('EMAIL'),- AvatarIcon: IconGmail,- },- {- id: 'CALENDAR',- name: 'Calendar',- isSelected: selectedSourceNames.includes('CALENDAR'),- AvatarIcon: IconGoogleCalendar,- },- {- id: 'WORKFLOW',- name: 'Workflow',- isSelected: selectedSourceNames.includes('WORKFLOW'),- AvatarIcon: IconSettingsAutomation,- isIconInverted: true,- },- {- id: 'WEBHOOK',- name: 'Webhook',- isSelected: selectedSourceNames.includes('WEBHOOK'),- AvatarIcon: IconWebhook,- isIconInverted: true,- },- {- id: 'SYSTEM',- name: 'System',- isSelected: selectedSourceNames.includes('SYSTEM'),- AvatarIcon: IconRobot,- isIconInverted: true,- },- ];-};+): SelectableItem[] =>+ ACTOR_SOURCE_FILTER_OPTIONS.map((actorSourceFilterOption) => ({+ id: actorSourceFilterOption.id,+ name: t(actorSourceFilterOption.label),+ isSelected: selectedSourceNames.includes(actorSourceFilterOption.id),+ AvatarIcon: actorSourceFilterOption.AvatarIcon,+ isIconInverted: actorSourceFilterOption.isIconInverted,+ }));diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel.tsindex 8e37bdfc61a..50a70385a9e 100644--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel.ts+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel.ts@@ -1,3 +1,6 @@+import { t } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';+import { SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS } from '@/settings/data-model/constants/SettingsCompositeFieldTypeConfigs';import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType';@@ -5,9 +8,12 @@ export const getCompositeSubFieldLabel = (compositeFieldType: CompositeFieldType,subFieldName: (typeof SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS)[CompositeFieldType]['subFields'][number]['subFieldName'],): string => {- return (- SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS[compositeFieldType].subFields.find(- (subField) => subField.subFieldName === subFieldName,- )?.subFieldLabel || ''- );+ const compositeFieldTypeConfig =+ SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS[compositeFieldType];++ const subFieldLabel = compositeFieldTypeConfig.subFields.find(+ (subField) => subField.subFieldName === subFieldName,+ )?.subFieldLabel;++ return isDefined(subFieldLabel) ? t(subFieldLabel) : '';};diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue.tsnew file mode 100644index 00000000000..64c5bc84f2a--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue.ts@@ -0,0 +1,11 @@+import { t } from '@lingui/core/macro';++const MAX_CURRENCY_NAMES_TO_DISPLAY = 3;++export const getCurrencyFilterDisplayValue = (currencyNames: string[]) => {+ const currenciesLabel = t`currencies`;++ return currencyNames.length > MAX_CURRENCY_NAMES_TO_DISPLAY+ ? `${currencyNames.length} ${currenciesLabel}`+ : currencyNames.join(', ');+};diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsxindex eb9c9d83499..dac875f9ec4 100644--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx@@ -1,6 +1,7 @@import { ListItemButton } from 'twenty-ui/components/navigation';import { isManyToOneRelationField } from '@/object-metadata/utils/isManyToOneRelationField';import { useObjectOptionsDropdown } from '@/object-record/object-options-dropdown/hooks/useObjectOptionsDropdown';+import { RECORD_GROUP_SORT_LABELS } from '@/object-record/record-group/constants/RecordGroupSortLabels';import { hiddenRecordGroupIdsComponentSelector } from '@/object-record/record-group/states/selectors/hiddenRecordGroupIdsComponentSelector';import { RecordGroupSort } from '@/object-record/record-group/types/RecordGroupSort';import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState';@@ -106,7 +107,7 @@ export const ObjectOptionsDropdownRecordGroupSortContent = () => {indicator="check"startIcon={<SelectOptionIcon Icon={IconHandMove} />}>- {RecordGroupSort.Manual}+ {t(RECORD_GROUP_SORT_LABELS[RecordGroupSort.Manual])}</ListItemButton></SelectableListItem>{!isRelationGroupBy && (@@ -132,7 +133,7 @@ export const ObjectOptionsDropdownRecordGroupSortContent = () => {indicator="check"startIcon={<SelectOptionIcon Icon={IconSortAZ} />}>- {RecordGroupSort.Alphabetical}+ {t(RECORD_GROUP_SORT_LABELS[RecordGroupSort.Alphabetical])}</ListItemButton></SelectableListItem><SelectableListItem@@ -164,7 +165,11 @@ export const ObjectOptionsDropdownRecordGroupSortContent = () => {indicator="check"startIcon={<SelectOptionIcon Icon={IconSortZA} />}>- {RecordGroupSort.ReverseAlphabetical}+ {t(+ RECORD_GROUP_SORT_LABELS[+ RecordGroupSort.ReverseAlphabetical+ ],+ )}</ListItemButton></SelectableListItem></>diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsxindex d0cc63ed0ab..9e8823ab3f4 100644--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx@@ -10,6 +10,7 @@ import { isRecordGroupingOptionalForViewType } from '@/object-record/record-grouimport { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector';import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState';import { recordIndexGroupLoadLimitComponentState } from '@/object-record/record-index/states/recordIndexGroupLoadLimitComponentState';+import { RECORD_GROUP_SORT_LABELS } from '@/object-record/record-group/constants/RecordGroupSortLabels';import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState';import { recordIndexShouldHideEmptyRecordGroupsComponentState } from '@/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState';import { LegacyDropdownContent } from '@/ui/layout/dropdown/components/LegacyDropdownContent';@@ -171,7 +172,9 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => {focused={selectedItemId === 'Sort'}onClick={() => onContentChange('recordGroupSort')}startIcon={<IconArrowsSort />}- description={recordIndexRecordGroupSort}+ description={t(+ RECORD_GROUP_SORT_LABELS[recordIndexRecordGroupSort],+ )}descriptionPlacement="end"hasSubmenu>{t`Sort`}</ListItemButton>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsxindex 8e7ee74a2da..98c6ca84ffb 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormCurrencyFieldInput.tsx@@ -6,7 +6,7 @@ import { FormSelectFieldInput } from '@/object-record/record-field/ui/form-typesimport { type FormFieldCurrencyInputSettings } from '@/object-record/record-field/ui/form-types/types/FormFieldCurrencyInputSettings';import { type VariablePickerComponent } from '@/ui/input/types/VariablePickerComponent';import { type FormFieldCurrencyValue } from '@/object-record/record-field/ui/types/FieldMetadata';-import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { Field } from 'twenty-ui/primitives/input';import { t } from '@lingui/core/macro';import { useMemo } from 'react';@@ -30,6 +30,8 @@ export const FormCurrencyFieldInput = ({readonly,amountUnit = 'micros',}: FormCurrencyFieldInputProps) => {+ const localizedCurrencies = useCurrencies();+const currencies = useMemo(() => {return [{@@ -37,9 +39,9 @@ export const FormCurrencyFieldInput = ({value: '',Icon: IconCircleOff,},- ...CURRENCIES,+ ...localizedCurrencies,];- }, []);+ }, [localizedCurrencies]);const handleAmountMicrosChange = (newAmountMicros: string | number | null,diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormFullNameFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormFullNameFieldInput.tsxindex bb490cdfe27..ece10f6c3e6 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormFullNameFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormFullNameFieldInput.tsx@@ -3,8 +3,7 @@ import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputConimport { FormNestedFieldInputContainer } from '@/object-record/record-field/ui/form-types/components/FormNestedFieldInputContainer';import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';import { type VariablePickerComponent } from '@/ui/input/types/VariablePickerComponent';-import { FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder';-import { LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder';+import { addCharactersToAvoidPasswordManagers } from '@/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers';import { type FieldFullNameValue } from '@/object-record/record-field/ui/types/FieldMetadata';import { Field } from 'twenty-ui/primitives/input';@@ -45,9 +44,7 @@ export const FormFullNameFieldInput = ({label={t`First Name`}defaultValue={defaultValue?.firstName}onChange={handleFirstNameChange}- placeholder={- FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }+ placeholder={addCharactersToAvoidPasswordManagers(t`First name`)}readonly={readonly}VariablePicker={VariablePicker}/>@@ -55,9 +52,7 @@ export const FormFullNameFieldInput = ({label={t`Last Name`}defaultValue={defaultValue?.lastName}onChange={handleLastNameChange}- placeholder={- LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }+ placeholder={addCharactersToAvoidPasswordManagers(t`Last name`)}readonly={readonly}VariablePicker={VariablePicker}/>diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FullNameFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FullNameFieldInput.tsxindex c6288afe411..72aee15ce7e 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FullNameFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FullNameFieldInput.tsx@@ -2,16 +2,17 @@ import { useFullNameField } from '@/object-record/record-field/ui/meta-types/hooimport { type FieldDoubleText } from '@/object-record/record-field/ui/types/FieldDoubleText';import { DoubleTextInput } from '@/ui/field/input/components/DoubleTextInput';-import { FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder';-import { LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder';+import { addCharactersToAvoidPasswordManagers } from '@/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers';import { isDoubleTextFieldEmpty } from '@/object-record/record-field/ui/meta-types/input/utils/isDoubleTextFieldEmpty';import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext';import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext';import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';+import { useLingui } from '@lingui/react/macro';import { useContext } from 'react';export const FullNameFieldInput = () => {+ const { t } = useLingui();const { draftValue, setDraftValue } = useFullNameField();const { onEnter, onEscape, onClickOutside, onTab, onShiftTab } = useContext(@@ -73,12 +74,12 @@ export const FullNameFieldInput = () => {instanceId={instanceId}firstValue={draftValue?.firstName ?? ''}secondValue={draftValue?.lastName ?? ''}- firstValuePlaceholder={- FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }- secondValuePlaceholder={- LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }+ firstValuePlaceholder={addCharactersToAvoidPasswordManagers(+ t`First name`,+ )}+ secondValuePlaceholder={addCharactersToAvoidPasswordManagers(+ t`Last name`,+ )}onClickOutside={handleClickOutside}onEnter={handleEnter}onEscape={handleEscape}diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsxindex 08215608d47..632730407a2 100644--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx@@ -8,6 +8,7 @@ import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/reimport { type FieldLinksValue } from '@/object-record/record-field/ui/types/FieldMetadata';import { linksFieldValueSchema } from '@/object-record/record-field/ui/validation-schemas/linksFieldValueSchema';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';+import { useLingui } from '@lingui/react/macro';import { useContext, useMemo } from 'react';import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants';import {@@ -24,6 +25,7 @@ type LinkRecord = {};export const LinksFieldInput = () => {+ const { t } = useLingui();const { draftValue, fieldDefinition, setDraftValue } = useLinksField();const { onEscape, onClickOutside, onEnter, onSubmit } = useContext(@@ -115,7 +117,7 @@ export const LinksFieldInput = () => {onEnter={handleEnter}onSubmit={handleSubmit}onClickOutside={handleClickOutside}- placeholder={isDomainField ? 'Domain' : 'URL'}+ placeholder={isDomainField ? t`Domain` : t`URL`}fieldMetadataType={FieldMetadataType.LINKS}validateInput={(input) => ({isValid: validateInput(input),diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder.tsdeleted file mode 100644index 7eac65e02e1..00000000000--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder.ts+++ /dev/null@@ -1,2 +0,0 @@-export const FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS =- 'First name';diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder.tsdeleted file mode 100644index 04f082144a9..00000000000--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder.ts+++ /dev/null@@ -1,2 +0,0 @@-export const LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS =- 'Last name';diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/__tests__/addCharactersToAvoidPasswordManagers.test.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/__tests__/addCharactersToAvoidPasswordManagers.test.tsnew file mode 100644index 00000000000..5cf3f003168--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/__tests__/addCharactersToAvoidPasswordManagers.test.ts@@ -0,0 +1,39 @@+import { addCharactersToAvoidPasswordManagers } from '@/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers';++describe('addCharactersToAvoidPasswordManagers', () => {+ it('should insert zero-width non-joiners after the first character', () => {+ expect(addCharactersToAvoidPasswordManagers('First name')).toBe(+ 'F\u200C\u200Cirst name',+ );+ });++ it('should keep the visible text unchanged', () => {+ expect(+ addCharactersToAvoidPasswordManagers('Last name').replace(/\u200C/g, ''),+ ).toBe('Last name');+ });++ it('should keep an Arabic placeholder unchanged', () => {+ expect(addCharactersToAvoidPasswordManagers('الاسم الأول')).toBe('الاسم الأول');+ });++ it('should keep a Persian placeholder unchanged', () => {+ expect(addCharactersToAvoidPasswordManagers('نام خانوادگی')).toBe(+ 'نام خانوادگی',+ );+ });++ it('should keep a placeholder written in Arabic presentation forms unchanged', () => {+ expect(addCharactersToAvoidPasswordManagers('\uFE8D\uFEDF\uFEE3')).toBe(+ '\uFE8D\uFEDF\uFEE3',+ );+ });++ it('should still insert the non-joiners in a script that does not join', () => {+ expect(addCharactersToAvoidPasswordManagers('Имя')).toBe('И\u200C\u200Cмя');+ });++ it('should handle an empty placeholder', () => {+ expect(addCharactersToAvoidPasswordManagers('')).toBe('\u200C\u200C');+ });+});diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers.tsnew file mode 100644index 00000000000..ef4c670cb01--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers.ts@@ -0,0 +1,9 @@+const ZERO_WIDTH_NON_JOINER = '';++const JOINING_SCRIPT_FIRST_CHARACTER_PATTERN =+ /^[\p{Script=Adlam}\p{Script=Arabic}\p{Script=Chorasmian}\p{Script=Hanifi_Rohingya}\p{Script=Mandaic}\p{Script=Manichaean}\p{Script=Mongolian}\p{Script=Nko}\p{Script=Old_Uyghur}\p{Script=Phags_Pa}\p{Script=Psalter_Pahlavi}\p{Script=Sogdian}\p{Script=Syriac}]/u;++export const addCharactersToAvoidPasswordManagers = (placeholder: string) =>+ JOINING_SCRIPT_FIRST_CHARACTER_PATTERN.test(placeholder)+ ? placeholder+ : `${placeholder.slice(0, 1)}${ZERO_WIDTH_NON_JOINER}${ZERO_WIDTH_NON_JOINER}${placeholder.slice(1)}`;diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useGetRecordFilterDisplayValue.test.tsx b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useGetRecordFilterDisplayValue.test.tsxnew file mode 100644index 00000000000..145fdfe5ea2--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useGetRecordFilterDisplayValue.test.tsx@@ -0,0 +1,76 @@+import { i18n } from '@lingui/core';+import { I18nProvider } from '@lingui/react';+import { renderHook } from '@testing-library/react';+import { SOURCE_LOCALE } from 'twenty-shared/translations';+import { ViewFilterOperand } from 'twenty-shared/types';++import { useGetRecordFilterDisplayValue } from '@/object-record/record-filter/hooks/useGetRecordFilterDisplayValue';+import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter';+import { messages } from '~/locales/generated/en';+import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';++i18n.load({ [SOURCE_LOCALE]: messages });+i18n.activate(SOURCE_LOCALE);++const BaseWrapper = getJestMetadataAndApolloMocksWrapper({+ apolloMocks: [],+});++const Wrapper = ({ children }: { children: React.ReactNode }) => (+ <I18nProvider i18n={i18n}>+ <BaseWrapper>{children}</BaseWrapper>+ </I18nProvider>+);++const buildActorSourceFilter = (+ sourceIds: string[],+ displayValue: string,+): RecordFilter => ({+ id: 'actor-source-filter',+ fieldMetadataId: 'created-by-field',+ value: JSON.stringify(sourceIds),+ displayValue,+ type: 'ACTOR',+ operand: ViewFilterOperand.IS,+ label: 'Created by',+ subFieldName: 'source',+});++const renderGetRecordFilterDisplayValue = () =>+ renderHook(() => useGetRecordFilterDisplayValue(), { wrapper: Wrapper })+ .result.current.getRecordFilterDisplayValue;++describe('useGetRecordFilterDisplayValue', () => {+ describe('actor source filters', () => {+ it('displays the label of every known source', () => {+ const getRecordFilterDisplayValue = renderGetRecordFilterDisplayValue();++ expect(+ getRecordFilterDisplayValue(+ buildActorSourceFilter(['EMAIL', 'API'], 'stored label'),+ ),+ ).toBe('API, Email');+ });++ it('keeps the stored label for a source that has no filter option', () => {+ const getRecordFilterDisplayValue = renderGetRecordFilterDisplayValue();++ expect(+ getRecordFilterDisplayValue(buildActorSourceFilter(['AGENT'], 'Agent')),+ ).toBe('Agent');+ });++ it('keeps the stored label when known and unknown sources are mixed', () => {+ const getRecordFilterDisplayValue = renderGetRecordFilterDisplayValue();++ expect(+ getRecordFilterDisplayValue(+ buildActorSourceFilter(+ ['EMAIL', 'APPLICATION'],+ 'Email, Application',+ ),+ ),+ ).toBe('Email, Application');+ });+ });+});diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRecordFilterDisplayValue.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRecordFilterDisplayValue.tsindex 276cd63d246..7044bce4033 100644--- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRecordFilterDisplayValue.ts+++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRecordFilterDisplayValue.ts@@ -4,18 +4,24 @@ import { Temporal } from 'temporal-polyfill';import { useGetFieldMetadataItemByIdOrThrow } from '@/object-metadata/hooks/useGetFieldMetadataItemById';import { useGetDateFilterDisplayValue } from '@/object-record/object-filter-dropdown/hooks/useGetDateFilterDisplayValue';import { useGetDateTimeFilterDisplayValue } from '@/object-record/object-filter-dropdown/hooks/useGetDateTimeFilterDisplayValue';+import { getActorSourceFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getActorSourceFilterDisplayValue';+import { getActorSourceMultiSelectOptions } from '@/object-record/object-filter-dropdown/utils/getActorSourceMultiSelectOptions';+import { getCurrencyFilterDisplayValue } from '@/object-record/object-filter-dropdown/utils/getCurrencyFilterDisplayValue';import { getRelativeDateDisplayValue } from '@/object-record/object-filter-dropdown/utils/getRelativeDateDisplayValue';+import { isFilterOnActorSourceSubField } from '@/object-record/object-filter-dropdown/utils/isFilterOnActorSourceSubField';import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter';import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand';import { isRecordFilterConsideredEmpty } from '@/object-record/record-filter/utils/isRecordFilterConsideredEmpty';import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';import { getTimezoneAbbreviationForZonedDateTime } from '@/ui/input/components/internal/date/utils/getTimeZoneAbbreviationForZonedDateTime';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { isStandaloneVariableString } from 'twenty-shared/workflow';-import { type Nullable } from 'twenty-shared/types';+import { FieldMetadataType, type Nullable } from 'twenty-shared/types';import {isDefined,isEmptinessOperand,+ isExpectedSubFieldName,parseJson,relativeDateFilterStringifiedSchema,} from 'twenty-shared/utils';@@ -30,6 +36,8 @@ export const useGetRecordFilterDisplayValue = () => {const { getFieldMetadataItemByIdOrThrow } =useGetFieldMetadataItemByIdOrThrow();+ const currencies = useCurrencies();+const getRecordFilterDisplayValue = (recordFilter?: Nullable<RecordFilter>,) => {@@ -178,6 +186,48 @@ export const useGetRecordFilterDisplayValue = () => {return `${optionLabels.join(', ')}`;}+ if (+ !operandIsEmptiness &&+ !recordFilterIsEmpty &&+ filterType === 'ACTOR' &&+ isFilterOnActorSourceSubField(recordFilter.subFieldName)+ ) {+ const sourceIds = parseJson<string[]>(recordFilter.value);++ if (Array.isArray(sourceIds)) {+ const selectedSourceOptions = getActorSourceMultiSelectOptions(+ sourceIds,+ ).filter((sourceOption) => sourceOption.isSelected);++ if (selectedSourceOptions.length === sourceIds.length) {+ return getActorSourceFilterDisplayValue(+ selectedSourceOptions.map((sourceOption) => sourceOption.name),+ );+ }+ }+ }++ if (+ !operandIsEmptiness &&+ !recordFilterIsEmpty &&+ filterType === 'CURRENCY' &&+ isExpectedSubFieldName(+ FieldMetadataType.CURRENCY,+ 'currencyCode',+ recordFilter.subFieldName,+ )+ ) {+ const currencyCodes = parseJson<string[]>(recordFilter.value);++ if (Array.isArray(currencyCodes)) {+ return getCurrencyFilterDisplayValue(+ currencies+ .filter((currency) => currencyCodes.includes(currency.value))+ .map((currency) => currency.label),+ );+ }+ }+if (!operandIsEmptiness && !recordFilterIsEmpty) {return `${recordFilter.displayValue}`;}diff --git a/packages/twenty-front/src/modules/object-record/record-filter/utils/getRecordFilterTypeAndLabelFromFieldMetadata.ts b/packages/twenty-front/src/modules/object-record/record-filter/utils/getRecordFilterTypeAndLabelFromFieldMetadata.tsindex ec4846909eb..7138313f05d 100644--- a/packages/twenty-front/src/modules/object-record/record-filter/utils/getRecordFilterTypeAndLabelFromFieldMetadata.ts+++ b/packages/twenty-front/src/modules/object-record/record-filter/utils/getRecordFilterTypeAndLabelFromFieldMetadata.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter';import { isSystemSearchVectorField } from '@/object-record/utils/isSystemSearchVectorField';@@ -44,7 +45,7 @@ export const getRecordFilterTypeAndLabelFromFieldMetadata = ({);const label = isSystemSearchVectorField(sourceFieldMetadataItem.name)- ? 'Search'+ ? t`Search`: isDefined(relationTargetFieldMetadataItem)? `${sourceFieldMetadataItem.label} → ${relationTargetFieldMetadataItem.label}`: sourceFieldMetadataItem.label;diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsxindex f0940d6ecca..0cb3fe62200 100644--- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx@@ -1,3 +1,4 @@+import { RECORD_GROUP_SORT_LABELS } from '@/object-record/record-group/constants/RecordGroupSortLabels';import { getRecordGroupReorderConfirmationModalId } from '@/object-record/record-group/utils/getRecordGroupReorderConfirmationModalId';import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState';@@ -19,13 +20,17 @@ export const RecordGroupReorderConfirmationModal = ({recordIndexRecordGroupSortComponentState,);+ const recordGroupSortLabel = t(+ RECORD_GROUP_SORT_LABELS[recordIndexRecordGroupSort],+ );+return (<>{createPortal(<ConfirmationDialogdialogId={getRecordGroupReorderConfirmationModalId(recordIndexId)}title={t`Group sorting`}- subtitle={t`Would you like to remove ${recordIndexRecordGroupSort} group sorting?`}+ subtitle={t`Would you like to remove ${recordGroupSortLabel} group sorting?`}onConfirmClick={onConfirmClick}confirmButtonText={t`Remove`}/>,diff --git a/packages/twenty-front/src/modules/object-record/record-group/constants/RecordGroupSortLabels.ts b/packages/twenty-front/src/modules/object-record/record-group/constants/RecordGroupSortLabels.tsnew file mode 100644index 00000000000..60863294d36--- /dev/null+++ b/packages/twenty-front/src/modules/object-record/record-group/constants/RecordGroupSortLabels.ts@@ -0,0 +1,13 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';++import { RecordGroupSort } from '@/object-record/record-group/types/RecordGroupSort';++export const RECORD_GROUP_SORT_LABELS: Record<+ RecordGroupSort,+ MessageDescriptor+> = {+ [RecordGroupSort.Manual]: msg`Manual`,+ [RecordGroupSort.Alphabetical]: msg`Alphabetical`,+ [RecordGroupSort.ReverseAlphabetical]: msg`Reverse Alphabetical`,+};diff --git a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexExportRecords.ts b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexExportRecords.tsindex 952bd99e6d6..c0bba9d85cb 100644--- a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexExportRecords.ts+++ b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexExportRecords.ts@@ -11,9 +11,9 @@ import {} from '@/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords';import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';import { type ObjectRecord } from '@/object-record/types/ObjectRecord';+import { COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES } from '@/settings/data-model/constants/CompositeFieldSubFieldLabelMessages';import { t } from '@lingui/core/macro';import { saveAs } from 'file-saver';-import { COMPOSITE_FIELD_SUB_FIELD_LABELS } from 'twenty-shared/constants';import {formatValueForCSV,isDefined,@@ -74,7 +74,12 @@ export const generateCsv: GenerateExport = ({const nestedFieldsWithoutTypename = Object.keys(rows[0][column.field]).filter((key) => key !== '__typename').map((key) => {- const subFieldLabel = COMPOSITE_FIELD_SUB_FIELD_LABELS[columnType][key];+ const subFieldLabelMessage =+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[columnType][key];+ const subFieldLabel = isDefined(subFieldLabelMessage)+ ? t(subFieldLabelMessage)+ : key;+return {field: `${column.field}.${key}`,title: formatValueForCSV(diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsxindex 9662cc74949..5e0e50c687e 100644--- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx+++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleFullNameFieldInput.tsx@@ -1,10 +1,10 @@import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext';import { useFullNameField } from '@/object-record/record-field/ui/meta-types/hooks/useFullNameField';-import { FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/FirstNamePlaceholder';-import { LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS } from '@/object-record/record-field/ui/meta-types/input/constants/LastNamePlaceholder';+import { addCharactersToAvoidPasswordManagers } from '@/object-record/record-field/ui/meta-types/input/utils/addCharactersToAvoidPasswordManagers';import { isDoubleTextFieldEmpty } from '@/object-record/record-field/ui/meta-types/input/utils/isDoubleTextFieldEmpty';import { type FieldDoubleText } from '@/object-record/record-field/ui/types/FieldDoubleText';+import { useLingui } from '@lingui/react/macro';import { useContext } from 'react';import { RecordTitleDoubleTextInput } from './RecordTitleDoubleTextInput';@@ -15,6 +15,7 @@ type RecordTitleFullNameFieldInputProps = {export const RecordTitleFullNameFieldInput = ({sizeVariant,}: RecordTitleFullNameFieldInputProps) => {+ const { t } = useLingui();const { draftValue, setDraftValue } = useFullNameField();const { onEnter, onEscape, onClickOutside, onTab, onShiftTab } = useContext(@@ -71,12 +72,12 @@ export const RecordTitleFullNameFieldInput = ({<RecordTitleDoubleTextInputfirstValue={draftValue?.firstName ?? ''}secondValue={draftValue?.lastName ?? ''}- firstValuePlaceholder={- FIRST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }- secondValuePlaceholder={- LAST_NAME_PLACEHOLDER_WITH_SPECIAL_CHARACTER_TO_AVOID_PASSWORD_MANAGERS- }+ firstValuePlaceholder={addCharactersToAvoidPasswordManagers(+ t`First name`,+ )}+ secondValuePlaceholder={addCharactersToAvoidPasswordManagers(+ t`Last name`,+ )}onClickOutside={handleClickOutside}onEnter={handleEnter}onEscape={handleEscape}diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useBuildSpreadSheetImportFields.test.tsx b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useBuildSpreadSheetImportFields.test.tsxindex 5883adea62a..22d513b3232 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useBuildSpreadSheetImportFields.test.tsx+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/__tests__/useBuildSpreadSheetImportFields.test.tsx@@ -1,3 +1,4 @@+import { i18n } from '@lingui/core';import { renderHook } from '@testing-library/react';import { Provider as JotaiProvider } from 'jotai';import { type ReactNode } from 'react';@@ -10,6 +11,8 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataIteimport { type IndexMetadataItem } from '@/object-metadata/types/IndexMetadataItem';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { useBuildSpreadsheetImportFields } from '@/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields';+import { COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES } from '@/settings/data-model/constants/CompositeFieldSubFieldLabelMessages';+import { SOURCE_LOCALE } from 'twenty-shared/translations';import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';const Wrapper = ({ children }: { children: ReactNode }) => {@@ -246,6 +249,63 @@ describe('useBuildSpreadSheetImportFields', () => {expect(lastNameField?.isCompositeSubField).toBe(true);});+ it('should keep the English label of a translated sub-field as an alternate match', () => {+ i18n.load('fr-FR', {+ [COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.FULL_NAME]+ .firstName.id]: 'Prénom',+ });+ i18n.activate('fr-FR');++ try {+ const { result } = renderHook(() => useBuildSpreadsheetImportFields(), {+ wrapper: Wrapper,+ });++ const spreadsheetImportFields =+ result.current.buildSpreadsheetImportFields([+ createMockFieldMetadataItem({+ type: FieldMetadataType.FULL_NAME,+ name: 'fullName',+ label: 'Full Name',+ }),+ ]);++ const firstNameField = spreadsheetImportFields.find(+ (field) => field.compositeSubFieldKey === 'firstName',+ );++ expect(firstNameField).toMatchObject({+ label: 'Full Name / Prénom',+ alternateMatches: ['Full Name / First Name'],+ key: 'First Name (fullName)',+ });+ } finally {+ i18n.activate(SOURCE_LOCALE);+ }+ });++ it('should not add alternate matches when the label is already English', () => {+ const { result } = renderHook(() => useBuildSpreadsheetImportFields(), {+ wrapper: Wrapper,+ });++ const spreadsheetImportFields = result.current.buildSpreadsheetImportFields(+ [+ createMockFieldMetadataItem({+ type: FieldMetadataType.FULL_NAME,+ name: 'fullName',+ label: 'Full Name',+ }),+ ],+ );++ expect(+ spreadsheetImportFields.every(+ (field) => field.alternateMatches === undefined,+ ),+ ).toBe(true);+ });+it('should filter out ACTOR fields', () => {const { result } = renderHook(() => useBuildSpreadsheetImportFields(), {wrapper: Wrapper,diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.tsindex e80ffd089f6..1b460012bc1 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts@@ -1,4 +1,5 @@import { getLinksVariant } from '@/object-record/spreadsheet-import/utils/getLinksVariant';+import { t } from '@lingui/core/macro';import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';@@ -16,6 +17,7 @@ import {type SpreadsheetImportFields,} from '@/spreadsheet-import/types';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';+import { COMPOSITE_FIELD_SUB_FIELD_LABELS } from 'twenty-shared/constants';import {assertUnreachable,getUniqueConstraintsFields,@@ -24,6 +26,15 @@ import {import { useIcons } from 'twenty-ui/icon';import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';+const getSourceLocaleAlternateMatches = ({+ label,+ sourceLocaleLabel,+}: {+ label: string;+ sourceLocaleLabel: string;+}): Partial<SpreadsheetImportField> =>+ label === sourceLocaleLabel ? {} : { alternateMatches: [sourceLocaleLabel] };+export const useBuildSpreadsheetImportFields = () => {const { getIcon } = useIcons();const objectMetadataItems = useAtomStateValue(objectMetadataItemsSelector);@@ -135,12 +146,19 @@ export const useBuildSpreadsheetImportFields = () => {if (!isImportable) return;const label = getCompositeSubFieldLabelWithFieldLabel(fieldMetadataItem,- subFieldLabel,+ t(subFieldLabel),);spreadsheetImportFields.push(createBaseField(fieldMetadataItem, {label,+ ...getSourceLocaleAlternateMatches({+ label,+ sourceLocaleLabel: getCompositeSubFieldLabelWithFieldLabel(+ fieldMetadataItem,+ COMPOSITE_FIELD_SUB_FIELD_LABELS[fieldType][subFieldName],+ ),+ }),key: getCompositeSubFieldKey(fieldMetadataItem, subFieldName),fieldValidationDefinitions:getSpreadSheetFieldValidationDefinitions(@@ -174,16 +192,33 @@ export const useBuildSpreadsheetImportFields = () => {SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS[uniqueConstraintType].subFields.forEach(- ({ subFieldName, isImportable, isIncludedInUniqueConstraint }) => {+ ({+ subFieldName,+ subFieldLabel,+ isImportable,+ isIncludedInUniqueConstraint,+ }) => {if (!isImportable || !isIncludedInUniqueConstraint) return;+ const label = getRelationConnectSubFieldLabel(+ fieldMetadataItem,+ uniqueConstraintField,+ t(subFieldLabel),+ );+spreadsheetImportFields.push(createBaseField(fieldMetadataItem, {- label: getRelationConnectSubFieldLabel(- fieldMetadataItem,- uniqueConstraintField,- subFieldName,- ),+ label,+ ...getSourceLocaleAlternateMatches({+ label,+ sourceLocaleLabel: getRelationConnectSubFieldLabel(+ fieldMetadataItem,+ uniqueConstraintField,+ COMPOSITE_FIELD_SUB_FIELD_LABELS[uniqueConstraintType][+ subFieldName+ ],+ ),+ }),key: getRelationConnectSubFieldKey(fieldMetadataItem,uniqueConstraintField,diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetRelationConnectSubFieldLabel.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetRelationConnectSubFieldLabel.tsindex 11318c81bcc..6168fc0260e 100644--- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetRelationConnectSubFieldLabel.ts+++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportGetRelationConnectSubFieldLabel.ts@@ -1,20 +1,9 @@import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';-import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType';-import { COMPOSITE_FIELD_SUB_FIELD_LABELS } from 'twenty-shared/constants';-import { isDefined } from 'twenty-shared/utils';export const getRelationConnectSubFieldLabel = (fieldMetadataItem: FieldMetadataItem,uniqueFieldMetadataItem: FieldMetadataItem,- compositeSubFieldKey?: string,+ compositeSubFieldLabel?: string,) => {- const compositeSubFieldLabel =- isCompositeFieldType(uniqueFieldMetadataItem.type) &&- isDefined(compositeSubFieldKey)- ? COMPOSITE_FIELD_SUB_FIELD_LABELS[uniqueFieldMetadataItem.type][- compositeSubFieldKey- ]- : undefined;-return `${fieldMetadataItem.label} / ${uniqueFieldMetadataItem.label}${compositeSubFieldLabel ? ` / ${compositeSubFieldLabel}` : ''}`;};diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetEditorGroupsData.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetEditorGroupsData.tsindex 056d4f4d836..0fd56c84414 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetEditorGroupsData.ts+++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetEditorGroupsData.ts@@ -9,6 +9,7 @@ import {import { buildDefaultFieldsWidgetGroups } from '@/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useViewById } from '@/views/hooks/useViewById';+import { useLingui } from '@lingui/react/macro';import { useMemo } from 'react';import {isDefined,@@ -44,6 +45,7 @@ export const useFieldsWidgetEditorGroupsData = ({const currentWorkspace = useAtomStateValue(currentWorkspaceState);const workspaceCustomApplicationId =currentWorkspace?.workspaceCustomApplication?.id;+ const { i18n } = useLingui();const result = useMemo<Pick<@@ -225,6 +227,8 @@ export const useFieldsWidgetEditorGroupsData = ({view,labelIdentifierFieldMetadataItem,workspaceCustomApplicationId,+ // oxlint-disable-next-line react-hooks/exhaustive-deps+ i18n.locale,]);return {diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroups.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroups.tsindex 3d9e311eb96..d1b1dd1c170 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroups.ts+++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroups.ts@@ -11,6 +11,7 @@ import { useFieldsWidgetFields } from '@/page-layout/widgets/fields/hooks/useFieimport { buildDefaultFieldsWidgetGroups } from '@/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups';import { filterDraftGroupsForDisplay } from '@/page-layout/widgets/fields/utils/filterDraftGroupsForDisplay';import { useViewById } from '@/views/hooks/useViewById';+import { useLingui } from '@lingui/react/macro';import { useMemo } from 'react';import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';@@ -37,6 +38,7 @@ export const useFieldsWidgetGroups = ({currentWorkspace?.workspaceCustomApplication?.id;const visibleFields = useFieldsWidgetFields(objectMetadataItem);+ const { i18n } = useLingui();const { groups, displayMode } = useMemo<{groups: FieldsWidgetGroup[];@@ -156,6 +158,8 @@ export const useFieldsWidgetGroups = ({view,viewId,workspaceCustomApplicationId,+ // oxlint-disable-next-line react-hooks/exhaustive-deps+ i18n.locale,]);return {diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups.tsindex 5a46d0840b4..c6b2edf2d8a 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups.ts+++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/utils/buildDefaultFieldsWidgetGroups.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';import { getIsMetadataItemCustom } from '@/object-metadata/utils/getIsMetadataItemCustom';import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup';@@ -41,7 +42,7 @@ export const buildDefaultFieldsWidgetGroups = ({if (nonCustomFields.length > 0) {groups.push({id: uuidv4(),- name: 'General',+ name: t`General`,position: 0,isVisible: true,fields: nonCustomFields.map((field, index) => ({@@ -56,7 +57,7 @@ export const buildDefaultFieldsWidgetGroups = ({if (customFields.length > 0) {groups.push({id: uuidv4(),- name: 'Other',+ name: t`Other`,position: 1,isVisible: true,fields: customFields.map((field, index) => ({diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsxindex d9a04d8a1fc..101b6444f5b 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx@@ -27,12 +27,12 @@ export const DashboardColorSelectionMenu = ({{BLOCKNOTE_COLORS.map((colorName) => (<Dropdown.OptionItemkey={colorName}- aria-label={BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName]}+ aria-label={t(BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName])}selected={currentTextColor === colorName}startIcon={<DashboardColorIcon textColor={colorName} />}onSelect={() => onTextColorSelect(colorName)}>- {BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName]}+ {t(BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName])}</Dropdown.OptionItem>))}</Dropdown.Section>@@ -41,12 +41,12 @@ export const DashboardColorSelectionMenu = ({{BLOCKNOTE_COLORS.map((colorName) => (<Dropdown.OptionItemkey={colorName}- aria-label={BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName]}+ aria-label={t(BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName])}selected={currentBackgroundColor === colorName}startIcon={<DashboardColorIcon backgroundColor={colorName} />}onSelect={() => onBackgroundColorSelect(colorName)}>- {BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName]}+ {t(BLOCKNOTE_COLOR_DISPLAY_NAMES[colorName])}</Dropdown.OptionItem>))}</Dropdown.Section>diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/constants/BlockNoteColorDisplayNames.ts b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/constants/BlockNoteColorDisplayNames.tsindex 590da9cea47..1c2fb96e124 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/constants/BlockNoteColorDisplayNames.ts+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/constants/BlockNoteColorDisplayNames.ts@@ -1,14 +1,20 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { type BlockNoteColor } from '@/page-layout/widgets/standalone-rich-text/types/BlockNoteColor';-export const BLOCKNOTE_COLOR_DISPLAY_NAMES: Record<BlockNoteColor, string> = {- default: 'Default',- gray: 'Gray',- brown: 'Brown',- red: 'Red',- orange: 'Orange',- yellow: 'Yellow',- green: 'Green',- blue: 'Blue',- purple: 'Purple',- pink: 'Pink',+export const BLOCKNOTE_COLOR_DISPLAY_NAMES: Record<+ BlockNoteColor,+ MessageDescriptor+> = {+ default: msg`Default`,+ gray: msg`Gray`,+ brown: msg`Brown`,+ red: msg`Red`,+ orange: msg`Orange`,+ yellow: msg`Yellow`,+ green: msg`Green`,+ blue: msg`Blue`,+ purple: msg`Purple`,+ pink: msg`Pink`,};diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsConnectionForm.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsConnectionForm.tsxindex 0220b517419..9c2622a6939 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsConnectionForm.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsConnectionForm.tsx@@ -207,7 +207,7 @@ export const SettingsAccountsConnectionForm = ({<Selectlabel={t`IMAP Connection security`}options={[- { label: 'None', value: 'NONE' },+ { label: t`None`, value: 'NONE' },{ label: 'STARTTLS', value: 'STARTTLS' },{ label: 'SSL/TLS', value: 'SSL_TLS' },]}@@ -304,7 +304,7 @@ export const SettingsAccountsConnectionForm = ({<Selectlabel={t`SMTP Connection security`}options={[- { label: 'None', value: 'NONE' },+ { label: t`None`, value: 'NONE' },{ label: 'STARTTLS', value: 'STARTTLS' },{ label: 'SSL/TLS', value: 'SSL_TLS' },]}diff --git a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.tsindex 3d55b34fb62..ee41aff29a8 100644--- a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts+++ b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts@@ -7,6 +7,7 @@ import { useToast } from 'twenty-ui/components/feedback';import { useMutation } from '@apollo/client/react';import { t } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';import { SettingsPath } from 'twenty-shared/types';import {type ConnectionParametersInput,@@ -21,8 +22,8 @@ import {isProtocolConfiguredForUpdate,} from '@/settings/accounts/utils/isProtocolConfigured';import {- connectionImapSmtpCalDav,- connectionImapSmtpCalDavUpdate,+ getConnectionImapSmtpCalDavSchema,+ getConnectionImapSmtpCalDavUpdateSchema,} from '@/settings/accounts/validation-schemas/connectionImapSmtpCalDav';import { isNonEmptyString } from '@sniptt/guards';import { ACCOUNT_TYPES } from 'twenty-shared/constants';@@ -66,12 +67,23 @@ export const useImapSmtpCaldavConnectionForm = ({connectedAccountId,}: UseConnectionFormProps = {}) => {const navigate = useNavigateSettings();+ const { i18n } = useLingui();++ const connectionSchema = useMemo(+ () =>+ isEditing+ ? getConnectionImapSmtpCalDavUpdateSchema()+ : getConnectionImapSmtpCalDavSchema(),+ [+ isEditing,+ // oxlint-disable-next-line react-hooks/exhaustive-deps+ i18n.locale,+ ],+ );const formMethods = useForm<ConnectionFormData>({mode: 'onSubmit',- resolver: zodResolver(- isEditing ? connectionImapSmtpCalDavUpdate : connectionImapSmtpCalDav,- ),+ resolver: zodResolver(connectionSchema),defaultValues: {name: '',handle: '',diff --git a/packages/twenty-front/src/modules/settings/accounts/validation-schemas/connectionImapSmtpCalDav.ts b/packages/twenty-front/src/modules/settings/accounts/validation-schemas/connectionImapSmtpCalDav.tsindex 685656a820a..f1909195dbf 100644--- a/packages/twenty-front/src/modules/settings/accounts/validation-schemas/connectionImapSmtpCalDav.ts+++ b/packages/twenty-front/src/modules/settings/accounts/validation-schemas/connectionImapSmtpCalDav.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { ACCOUNT_TYPES } from 'twenty-shared/constants';import { z } from 'zod';import { type ConnectionParametersInput } from '~/generated-metadata/graphql';@@ -7,69 +8,70 @@ import {isProtocolConfiguredForUpdate,} from '@/settings/accounts/utils/isProtocolConfigured';-const connectionParameters = z- .object({- host: z.string().default(''),- port: z.int().nullable().default(null),- username: z.string().optional(),- password: z.string().default(''),- connectionSecurity: z- .enum(['NONE', 'STARTTLS', 'SSL_TLS'])- .default('SSL_TLS'),- })- .refine(- (data) => {- if (Boolean(data.host?.trim())) {- return data.port && data.port > 0;- }- return true;- },- {- path: ['port'],- error: 'Port must be a positive number when configuring this protocol',- },- );+const getConnectionParametersSchema = () =>+ z+ .object({+ host: z.string().default(''),+ port: z.int().nullable().default(null),+ username: z.string().optional(),+ password: z.string().default(''),+ connectionSecurity: z+ .enum(['NONE', 'STARTTLS', 'SSL_TLS'])+ .default('SSL_TLS'),+ })+ .refine(+ (data) => {+ if (Boolean(data.host?.trim())) {+ return data.port && data.port > 0;+ }+ return true;+ },+ {+ path: ['port'],+ error: t`Port must be a positive number when configuring this protocol`,+ },+ );-export const connectionImapSmtpCalDav = z- .object({- name: z.string().trim(),- handle: z.email('Invalid email address'),- IMAP: connectionParameters.optional(),- SMTP: connectionParameters.optional(),- CALDAV: connectionParameters.optional(),- })- .refine(- (data) => {- return ACCOUNT_TYPES.some((protocol) =>- isProtocolConfigured(data[protocol] as ConnectionParametersInput),- );- },- {- path: ['handle'],- error:- 'At least one account type (IMAP, SMTP, or CalDAV) must be completely configured',- },- );+export const getConnectionImapSmtpCalDavSchema = () =>+ z+ .object({+ name: z.string().trim(),+ handle: z.email(t`Invalid email address`),+ IMAP: getConnectionParametersSchema().optional(),+ SMTP: getConnectionParametersSchema().optional(),+ CALDAV: getConnectionParametersSchema().optional(),+ })+ .refine(+ (data) => {+ return ACCOUNT_TYPES.some((protocol) =>+ isProtocolConfigured(data[protocol] as ConnectionParametersInput),+ );+ },+ {+ path: ['handle'],+ error: t`At least one account type (IMAP, SMTP, or CalDAV) must be completely configured`,+ },+ );-export const connectionImapSmtpCalDavUpdate = z- .object({- name: z.string().trim(),- handle: z.email('Invalid email address'),- IMAP: connectionParameters.optional(),- SMTP: connectionParameters.optional(),- CALDAV: connectionParameters.optional(),- })- .refine(- (data) => {- return ACCOUNT_TYPES.some((protocol) =>- isProtocolConfiguredForUpdate(- data[protocol] as ConnectionParametersInput,- ),- );- },- {- path: ['handle'],- error:- 'At least one account type (IMAP, SMTP, or CalDAV) must be completely configured',- },- );+export const getConnectionImapSmtpCalDavUpdateSchema = () =>+ z+ .object({+ name: z.string().trim(),+ handle: z.email(t`Invalid email address`),+ IMAP: getConnectionParametersSchema().optional(),+ SMTP: getConnectionParametersSchema().optional(),+ CALDAV: getConnectionParametersSchema().optional(),+ })+ .refine(+ (data) => {+ return ACCOUNT_TYPES.some((protocol) =>+ isProtocolConfiguredForUpdate(+ data[protocol] as ConnectionParametersInput,+ ),+ );+ },+ {+ path: ['handle'],+ error: t`At least one account type (IMAP, SMTP, or CalDAV) must be completely configured`,+ },+ );diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsxindex 4d2278da414..7d647141a36 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx@@ -1,5 +1,7 @@import { useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components/layout';@@ -90,15 +92,15 @@ const STATUS_COLORS: Record<SubscriptionStatus, ThemeColor> = {[SubscriptionStatus.IncompleteExpired]: 'gray',};-const STATUS_LABELS: Record<SubscriptionStatus, string> = {- [SubscriptionStatus.Active]: 'Active',- [SubscriptionStatus.Trialing]: 'Trialing',- [SubscriptionStatus.PastDue]: 'Past Due',- [SubscriptionStatus.Canceled]: 'Canceled',- [SubscriptionStatus.Unpaid]: 'Unpaid',- [SubscriptionStatus.Paused]: 'Paused',- [SubscriptionStatus.Incomplete]: 'Incomplete',- [SubscriptionStatus.IncompleteExpired]: 'Incomplete Expired',+const STATUS_LABELS: Record<SubscriptionStatus, MessageDescriptor> = {+ [SubscriptionStatus.Active]: msg`Active`,+ [SubscriptionStatus.Trialing]: msg`Trialing`,+ [SubscriptionStatus.PastDue]: msg`Past Due`,+ [SubscriptionStatus.Canceled]: msg`Canceled`,+ [SubscriptionStatus.Unpaid]: msg`Unpaid`,+ [SubscriptionStatus.Paused]: msg`Paused`,+ [SubscriptionStatus.Incomplete]: msg`Incomplete`,+ [SubscriptionStatus.IncompleteExpired]: msg`Incomplete Expired`,};const toBillingPlanKey = (planKey: string): BillingPlanKey | null =>@@ -265,7 +267,7 @@ export const SettingsAdminWorkspaceBillingContent = ({label: t`Status`,value: (<Tag color={STATUS_COLORS[subscription.status]}>- {STATUS_LABELS[subscription.status]}+ {t(STATUS_LABELS[subscription.status])}</Tag>),},diff --git a/packages/twenty-front/src/modules/settings/data-model/constants/CompositeFieldSubFieldLabelMessages.ts b/packages/twenty-front/src/modules/settings/data-model/constants/CompositeFieldSubFieldLabelMessages.tsnew file mode 100644index 00000000000..c21f86b51d1--- /dev/null+++ b/packages/twenty-front/src/modules/settings/data-model/constants/CompositeFieldSubFieldLabelMessages.ts@@ -0,0 +1,55 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { type COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES } from 'twenty-shared/constants';+import { FieldMetadataType } from 'twenty-shared/types';++export const COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES: {+ [key in keyof typeof COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES]: Record<+ string,+ MessageDescriptor+ >;+} = {+ [FieldMetadataType.CURRENCY]: {+ amountMicros: msg`Amount`,+ currencyCode: msg`Currency`,+ },+ [FieldMetadataType.EMAILS]: {+ primaryEmail: msg`Primary Email`,+ additionalEmails: msg`Additional Emails`,+ },+ [FieldMetadataType.LINKS]: {+ primaryLinkLabel: msg`Link Label`,+ primaryLinkUrl: msg`Link URL`,+ secondaryLinks: msg`Secondary Links`,+ },+ [FieldMetadataType.PHONES]: {+ primaryPhoneNumber: msg`Primary Phone Number`,+ primaryPhoneCountryCode: msg`Primary Phone Country Code`,+ primaryPhoneCallingCode: msg`Primary Phone Calling Code`,+ additionalPhones: msg`Additional Phones`,+ },+ [FieldMetadataType.FULL_NAME]: {+ firstName: msg`First Name`,+ lastName: msg`Last Name`,+ },+ [FieldMetadataType.ADDRESS]: {+ addressStreet1: msg`Address 1`,+ addressStreet2: msg`Address 2`,+ addressCity: msg`City`,+ addressState: msg`State`,+ addressCountry: msg`Country`,+ addressPostcode: msg`Post Code`,+ addressLat: msg`Latitude`,+ addressLng: msg`Longitude`,+ },+ [FieldMetadataType.ACTOR]: {+ source: msg`Source`,+ name: msg`Name`,+ workspaceMemberId: msg`Workspace Member`,+ context: msg`Context`,+ },+ [FieldMetadataType.RICH_TEXT]: {+ blocknote: msg`BlockNote`,+ markdown: msg`Markdown`,+ },+};diff --git a/packages/twenty-front/src/modules/settings/data-model/constants/RelationTypes.ts b/packages/twenty-front/src/modules/settings/data-model/constants/RelationTypes.tsindex b6a292f7ad2..35158cdefa3 100644--- a/packages/twenty-front/src/modules/settings/data-model/constants/RelationTypes.ts+++ b/packages/twenty-front/src/modules/settings/data-model/constants/RelationTypes.ts@@ -1,3 +1,5 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { type IconComponent, IllustrationIconOneToMany } from 'twenty-ui/icon';import { RelationType } from '~/generated-metadata/graphql';import OneToManySvg from '@/settings/data-model/assets/OneToMany.svg';@@ -5,19 +7,19 @@ import OneToManySvg from '@/settings/data-model/assets/OneToMany.svg';export const RELATION_TYPES: Record<RelationType,{- label: string;+ label: MessageDescriptor;Icon: IconComponent;imageSrc: string;isImageFlipped?: boolean;}> = {[RelationType.ONE_TO_MANY]: {- label: 'Has many',+ label: msg`Has many`,Icon: IllustrationIconOneToMany,imageSrc: OneToManySvg,},[RelationType.MANY_TO_ONE]: {- label: 'Belongs to one',+ label: msg`Belongs to one`,Icon: IllustrationIconOneToMany,imageSrc: OneToManySvg,isImageFlipped: true,diff --git a/packages/twenty-front/src/modules/settings/data-model/constants/SettingsCompositeFieldTypeConfigs.ts b/packages/twenty-front/src/modules/settings/data-model/constants/SettingsCompositeFieldTypeConfigs.tsindex 8d8654bb292..44e69dc8779 100644--- a/packages/twenty-front/src/modules/settings/data-model/constants/SettingsCompositeFieldTypeConfigs.ts+++ b/packages/twenty-front/src/modules/settings/data-model/constants/SettingsCompositeFieldTypeConfigs.ts@@ -1,4 +1,6 @@+import { type MessageDescriptor } from '@lingui/core';import { msg } from '@lingui/core/macro';+import { COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES } from '@/settings/data-model/constants/CompositeFieldSubFieldLabelMessages';import {type FieldActorValue,type FieldAddressValue,@@ -12,7 +14,6 @@ import {import { type SettingsFieldTypeConfig } from '@/settings/data-model/constants/SettingsNonCompositeFieldTypeConfigs';import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType';import {- COMPOSITE_FIELD_SUB_FIELD_LABELS,COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES,CurrencyCode,} from 'twenty-shared/constants';@@ -33,7 +34,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';export type CompositeSubFieldConfig<T> = {subFieldName: keyof T;- subFieldLabel: string;+ subFieldLabel: MessageDescriptor;isImportable: boolean;isFilterable: boolean;isIncludedInUniqueConstraint: boolean;@@ -59,7 +60,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.CURRENCY].amountMicros,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.CURRENCY]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.CURRENCY].amountMicros,isImportable: true,isFilterable: true,@@ -70,7 +71,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.CURRENCY].currencyCode,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.CURRENCY]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.CURRENCY].currencyCode,isImportable: true,isFilterable: true,@@ -102,7 +103,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.EMAILS].primaryEmail,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.EMAILS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.EMAILS].primaryEmail,isImportable: true,isFilterable: true,@@ -113,7 +114,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.EMAILS].additionalEmails,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.EMAILS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.EMAILS].additionalEmails,isImportable: true,isFilterable: true,@@ -149,7 +150,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.LINKS].primaryLinkUrl,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.LINKS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.LINKS].primaryLinkUrl,isImportable: true,isFilterable: true,@@ -160,7 +161,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.LINKS].primaryLinkLabel,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.LINKS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.LINKS].primaryLinkLabel,isImportable: true,isFilterable: true,@@ -171,7 +172,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.LINKS].secondaryLinks,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.LINKS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.LINKS].secondaryLinks,isImportable: true,isFilterable: true,@@ -206,7 +207,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.PHONES].primaryPhoneCallingCode,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.PHONES]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.PHONES].primaryPhoneCallingCode,isImportable: true,isFilterable: true,@@ -217,7 +218,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.PHONES].primaryPhoneCountryCode,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.PHONES]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.PHONES].primaryPhoneCountryCode,isImportable: true,isFilterable: false,@@ -228,7 +229,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.PHONES].primaryPhoneNumber,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.PHONES]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.PHONES].primaryPhoneNumber,isImportable: true,isFilterable: true,@@ -239,7 +240,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.PHONES].additionalPhones,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.PHONES]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.PHONES].additionalPhones,isImportable: true,isFilterable: true,@@ -282,7 +283,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.FULL_NAME].firstName,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.FULL_NAME]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.FULL_NAME].firstName,isImportable: true,isFilterable: true,@@ -293,7 +294,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.FULL_NAME].lastName,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.FULL_NAME]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.FULL_NAME].lastName,isImportable: true,isFilterable: true,@@ -316,7 +317,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressStreet1,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressStreet1,isImportable: true,isFilterable: true,@@ -327,7 +328,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressStreet2,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressStreet2,isImportable: true,isFilterable: true,@@ -338,7 +339,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressCity,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressCity,isImportable: true,isFilterable: true,@@ -349,7 +350,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressState,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressState,isImportable: true,isFilterable: true,@@ -360,7 +361,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressCountry,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressCountry,isImportable: true,isFilterable: true,@@ -371,7 +372,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressPostcode,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressPostcode,isImportable: true,isFilterable: true,@@ -382,7 +383,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressLat,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressLat,isImportable: false,isFilterable: false,@@ -393,7 +394,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ADDRESS].addressLng,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ADDRESS]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ADDRESS].addressLng,isImportable: false,isFilterable: false,@@ -443,7 +444,8 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {subFieldName:COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ACTOR].source,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ACTOR].source,+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ACTOR]+ .source,isImportable: true,isFilterable: true,isIncludedInUniqueConstraint: false,@@ -452,7 +454,8 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {subFieldName:COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ACTOR].name,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ACTOR].name,+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ACTOR]+ .name,isImportable: true,isFilterable: true,isIncludedInUniqueConstraint: false,@@ -462,7 +465,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ACTOR].workspaceMemberId,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ACTOR]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ACTOR].workspaceMemberId,isImportable: true,isFilterable: true,@@ -473,7 +476,8 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.ACTOR].context,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.ACTOR].context,+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.ACTOR]+ .context,isImportable: true,isFilterable: false,isIncludedInUniqueConstraint: false,@@ -510,7 +514,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT].blocknote,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.RICH_TEXT].blocknote,isImportable: false,isFilterable: false,@@ -521,7 +525,7 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT].markdown,subFieldLabel:- COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT]+ COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES[FieldMetadataType.RICH_TEXT].markdown,isImportable: true,isFilterable: false,diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsxindex ec0e78defe1..5faf5a3cd72 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx@@ -10,9 +10,9 @@ import { currencyFieldSettingsSchema } from '@/object-record/record-field/ui/valimport { SettingsCardSeparator } from '@/settings/components/SettingsCardSeparator';import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';-import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';import { useCurrencySettingsFormInitialValues } from '@/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues';import { Select } from '@/ui/input/components/Select';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { plural } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';import { IconCheckbox, IconCurrencyDollar, IconDecimal } from 'twenty-ui/icon';@@ -38,6 +38,7 @@ export const SettingsDataModelFieldCurrencyForm = ({existingFieldMetadataId,}: SettingsDataModelFieldCurrencyFormProps) => {const { t } = useLingui();+ const currencies = useCurrencies();const {initialAmountMicrosValue,initialCurrencyCodeValue,@@ -72,7 +73,7 @@ export const SettingsDataModelFieldCurrencyForm = ({onChange={onChange}disabled={disabled}dropdownId="object-field-default-value-select-currency"- options={CURRENCIES.map(({ value, ...rest }) => ({+ options={currencies.map(({ value, ...rest }) => ({...rest,value: applySimpleQuotesToString(value),}))}@@ -114,8 +115,8 @@ export const SettingsDataModelFieldCurrencyForm = ({disabled={disabled}dropdownId="object-field-format-select"options={[- { label: 'Short', value: fieldMetadataCurrencyFormat[0] },- { label: 'Full', value: fieldMetadataCurrencyFormat[1] },+ { label: t`Short`, value: fieldMetadataCurrencyFormat[0] },+ { label: t`Full`, value: fieldMetadataCurrencyFormat[1] },]}selectSizeVariant="small"withSearchInput={false}diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationForm.tsxindex a9527574878..d9821ca1d4a 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationForm.tsx@@ -48,14 +48,6 @@ const StyledInputsContainer = styled.div`width: 100%;`;-const RELATION_TYPE_OPTIONS = Object.entries(RELATION_TYPES).map(- ([value, { label, Icon }]) => ({- label,- value: value as RelationType,- Icon,- }),-);-export const settingsDataModelFieldMorphRelationFormSchema = z.object({morphRelationObjectMetadataIds: z.array(z.uuid()).min(1),relationType: z.enum(@@ -128,6 +120,14 @@ export const SettingsDataModelFieldRelationForm = ({);const isMobile = useIsMobile();+ const relationTypeOptions = Object.entries(RELATION_TYPES).map(+ ([value, { label, Icon }]) => ({+ label: t(label),+ value: value as RelationType,+ Icon,+ }),+ );+return (<StyledContainer><StyledSelectsContainer isMobile={isMobile}>@@ -142,7 +142,7 @@ export const SettingsDataModelFieldRelationForm = ({fullWidthdisabled={disabled || disableRelationEdition}value={value}- options={RELATION_TYPE_OPTIONS}+ options={relationTypeOptions}onChange={onChange}/>)}diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsxindex 55b6c8bae6b..162c56e4b5e 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationFormCard.tsx@@ -11,6 +11,7 @@ import { SettingsDataModelFieldRelationJunctionForm } from '@/settings/data-modeimport { SettingsDataModelFieldRelationPreviewContent } from '@/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationPreviewContent';import { SettingsDataModelRelationPreviewImage } from '@/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationPreviewImageCard';import { SettingsDataModelRelationFieldPreviewSubWidget } from '@/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreviewSubWidget';+import { useLingui } from '@lingui/react/macro';import { useIsMobile } from 'twenty-ui/utilities';import { isDefined } from 'twenty-shared/utils';import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';@@ -27,6 +28,7 @@ export const SettingsDataModelFieldRelationFormCard = ({objectNameSingular,disabled = false,}: SettingsDataModelFieldRelationFormCardProps) => {+ const { t } = useLingui();const { watch } = useFormContext<SettingsDataModelFieldMorphRelationFormValues &SettingsDataModelFieldEditFormValues@@ -93,7 +95,7 @@ export const SettingsDataModelFieldRelationFormCard = ({<SettingsDataModelRelationPreviewImagesrc={relationTypeConfig.imageSrc}flip={relationTypeConfig.isImageFlipped}- alt={relationTypeConfig.label}+ alt={t(relationTypeConfig.label)}isMobile={isMobile}/><SettingsDataModelRelationFieldPreviewSubWidgetdiff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsxindex fb2899a8b36..2c50eddae70 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx@@ -122,7 +122,7 @@ export const SettingsObjectRelationItemTableRow = ({const relationTypeLabel = (() => {if (isDefined(displayRelationType) === true) {- return RELATION_TYPES[displayRelationType].label;+ return t(RELATION_TYPES[displayRelationType].label);}return '';})();diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectIdentifiersForm.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectIdentifiersForm.tsxindex c881acff71b..48e452ca799 100644--- a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectIdentifiersForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectIdentifiersForm.tsx@@ -163,7 +163,7 @@ export const SettingsDataModelObjectIdentifiersForm = ({callToActionButton={label === t`Record label`? {- text: 'Create Text Field',+ text: t`Create Text Field`,Icon: IconPlus,onClick: () => {navigate('./new-field/select');diff --git a/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts b/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.tsindex 741d64141f9..4a9858c56c4 100644--- a/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts+++ b/packages/twenty-front/src/modules/settings/developers/hooks/useWebhookForm.ts@@ -11,7 +11,7 @@ import {} from '@/settings/developers/utils/createWebhookInput';import { parseOperationsFromStrings } from '@/settings/developers/utils/parseOperationsFromStrings';import {- webhookFormSchema,+ getWebhookFormSchema,type WebhookFormValues,} from '@/settings/developers/validation-schemas/webhookFormSchema';import { useMutation, useQuery } from '@apollo/client/react';@@ -51,7 +51,7 @@ export const useWebhookForm = ({ webhookId, mode }: UseWebhookFormProps) => {const formConfig = useForm<WebhookFormValues>({mode: isCreationMode ? 'onSubmit' : 'onTouched',- resolver: zodResolver(webhookFormSchema),+ resolver: zodResolver(getWebhookFormSchema()),defaultValues: DEFAULT_FORM_VALUES,});diff --git a/packages/twenty-front/src/modules/settings/developers/validation-schemas/webhookFormSchema.ts b/packages/twenty-front/src/modules/settings/developers/validation-schemas/webhookFormSchema.tsindex 9dd9684c815..9b0b725b0fe 100644--- a/packages/twenty-front/src/modules/settings/developers/validation-schemas/webhookFormSchema.ts+++ b/packages/twenty-front/src/modules/settings/developers/validation-schemas/webhookFormSchema.ts@@ -1,31 +1,35 @@+import { t } from '@lingui/core/macro';import { isValidUrl } from 'twenty-shared/utils';import { z } from 'zod';-export const webhookFormSchema = z.object({- targetUrl: z- .string()- .trim()- .min(1, 'URL is required')- .refine((url) => isValidUrl(url), {- error: 'Please enter a valid URL',- }),- description: z.string().optional(),- operations: z- .array(- z.object({- object: z.string().nullable(),- action: z.string(),+export const getWebhookFormSchema = () =>+ z.object({+ targetUrl: z+ .string()+ .trim()+ .min(1, t`URL is required`)+ .refine((url) => isValidUrl(url), {+ error: t`Please enter a valid URL`,}),- )- .min(1, 'At least one operation is required')- .refine(- (operations) =>- operations.some((op) => op.object !== null && op.action !== null),- {- error: 'At least one complete operation is required',- },- ),- secret: z.string().optional(),-});+ description: z.string().optional(),+ operations: z+ .array(+ z.object({+ object: z.string().nullable(),+ action: z.string(),+ }),+ )+ .min(1, t`At least one operation is required`)+ .refine(+ (operations) =>+ operations.some((op) => op.object !== null && op.action !== null),+ {+ error: t`At least one complete operation is required`,+ },+ ),+ secret: z.string().optional(),+ });-export type WebhookFormValues = z.infer<typeof webhookFormSchema>;+export type WebhookFormValues = z.infer<+ ReturnType<typeof getWebhookFormSchema>+>;diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperatorCell.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperatorCell.tsxindex 64b4787b92b..8ab56c41abc 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperatorCell.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperatorCell.tsx@@ -3,7 +3,6 @@import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useContext } from 'react';-import { capitalize } from 'twenty-shared/utils';import { AdvancedFilterLogicalOperatorDropdown } from '@/object-record/advanced-filter/components/AdvancedFilterLogicalOperatorDropdown';import { ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS } from '@/object-record/advanced-filter/constants/AdvancedFilterLogicalOperatorOptions';@@ -42,6 +41,17 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOpera}: SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperatorCellProps) => {const { readonly } = useContext(AdvancedFilterContext);+ const logicalOperatorOptions = ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS.map(+ (option) => ({+ ...option,+ label: t(option.label),+ }),+ );++ const logicalOperatorLabel = logicalOperatorOptions.find(+ (option) => option.value === recordFilterGroup.logicalOperator,+ )?.label;+return (<StyledContainer>{index === 0 ? (@@ -52,7 +62,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOperadropdownWidth={GenericDropdownContentWidth.Narrow}dropdownId={`advanced-filter-logical-operator-${recordFilterGroup.id}`}value={recordFilterGroup.logicalOperator}- options={ADVANCED_FILTER_LOGICAL_OPERATOR_OPTIONS}+ options={logicalOperatorOptions}dropdownSideOffset={DEFAULT_ADVANCED_FILTER_DROPDOWN_SIDE_OFFSET}disabled/>@@ -62,9 +72,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionLogicalOpera/>)) : (- <StyledText>- {capitalize(recordFilterGroup.logicalOperator.toLowerCase())}- </StyledText>+ <StyledText>{logicalOperatorLabel}</StyledText>)}</StyledContainer>);diff --git a/packages/twenty-front/src/modules/settings/security/utils/parseSamlMetadataFromXmlFile.ts b/packages/twenty-front/src/modules/settings/security/utils/parseSamlMetadataFromXmlFile.tsindex f5c43716151..65dabd46269 100644--- a/packages/twenty-front/src/modules/settings/security/utils/parseSamlMetadataFromXmlFile.ts+++ b/packages/twenty-front/src/modules/settings/security/utils/parseSamlMetadataFromXmlFile.ts@@ -1,16 +1,18 @@/* @license Enterprise */+import { t } from '@lingui/core/macro';import { z } from 'zod';const HTTP_REDIRECT_BINDING ='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect';const HTTP_POST_BINDING = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST';-const validator = z.object({- entityID: z.url('entityID is not a valid URL'),- ssoUrl: z.url('SingleSignOnService Location is not a valid URL'),- certificate: z.string().min(1),-});+const getValidator = () =>+ z.object({+ entityID: z.url(t`entityID is not a valid URL`),+ ssoUrl: z.url(t`SingleSignOnService Location is not a valid URL`),+ certificate: z.string().min(1),+ });const allPrefix = ['md', 'ns0', 'ns2', 'dsig', 'ds'];@@ -55,44 +57,44 @@ const formatErrorReason = (error: unknown): string => {.join('; ');}if (error instanceof Error) return error.message;- return 'Unknown parsing error';+ return t`Unknown parsing error`;};export const parseSamlMetadataFromXmlFile = (xmlString: string,):- | { success: true; data: z.infer<typeof validator> }+ | { success: true; data: z.infer<ReturnType<typeof getValidator>> }| { success: false; reason: string } => {try {const parser = new DOMParser();const xmlDoc = parser.parseFromString(xmlString, 'application/xml');if (xmlDoc.getElementsByTagName('parsererror').length > 0) {- throw new Error('File is not valid XML');+ throw new Error(t`File is not valid XML`);}const entityDescriptor = getByPrefixAndKey(xmlDoc, 'EntityDescriptor');if (!entityDescriptor)- throw new Error('EntityDescriptor element is missing');+ throw new Error(t`EntityDescriptor element is missing`);const idpSsoDescriptor = getByPrefixAndKey(xmlDoc, 'IDPSSODescriptor');if (!idpSsoDescriptor)- throw new Error('IDPSSODescriptor element is missing');+ throw new Error(t`IDPSSODescriptor element is missing`);const keyDescriptors = getByPrefixAndKey(idpSsoDescriptor, 'KeyDescriptor');- if (!keyDescriptors) throw new Error('KeyDescriptor element is missing');+ if (!keyDescriptors) throw new Error(t`KeyDescriptor element is missing`);const keyInfo = getByPrefixAndKey(keyDescriptors, 'KeyInfo');- if (!keyInfo) throw new Error('KeyInfo element is missing');+ if (!keyInfo) throw new Error(t`KeyInfo element is missing`);const x509Data = getByPrefixAndKey(keyInfo, 'X509Data');- if (!x509Data) throw new Error('X509Data element is missing');+ if (!x509Data) throw new Error(t`X509Data element is missing`);const x509Certificate = getByPrefixAndKey(x509Data,'X509Certificate',)?.textContent?.trim();if (!x509Certificate)- throw new Error('X509Certificate is missing or empty');+ throw new Error(t`X509Certificate is missing or empty`);const singleSignOnServices = getAllByPrefixAndKey(idpSsoDescriptor,@@ -111,7 +113,7 @@ export const parseSamlMetadataFromXmlFile = (if (!ssoUrl) {throw new Error(- 'No SingleSignOnService with HTTP-Redirect or HTTP-POST binding was found',+ t`No SingleSignOnService with HTTP-Redirect or HTTP-POST binding was found`,);}@@ -121,7 +123,7 @@ export const parseSamlMetadataFromXmlFile = (entityID: entityDescriptor?.getAttribute('entityID'),};- return { success: true, data: validator.parse(result) };+ return { success: true, data: getValidator().parse(result) };} catch (error) {return { success: false, reason: formatErrorReason(error) };}diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsxindex 58d36f7ed06..672e501c1ab 100644--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx@@ -12,6 +12,7 @@ import { flowComponentState } from '@/workflow/states/flowComponentState';import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';import { getAgentIdFromStep } from '@/workflow/utils/getAgentIdFromStep';import { getStepDefinitionOrThrow } from '@/workflow/utils/getStepDefinitionOrThrow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId';import { useUpdateAgentLabel } from '@/workflow/workflow-steps/hooks/useUpdateAgentLabel';import { useUpdateWorkflowVersionStep } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowVersionStep';@@ -110,10 +111,24 @@ export const SidePanelWorkflowStepInfo = ({: (stepDefinition.definition.name ?? t`Action`): '';+ const displayedStepName =+ isReadonly &&+ isDefined(stepDefinition) &&+ isDefined(stepDefinition.definition) &&+ isDefined(stepDefinition.definition.name)+ ? getWorkflowStepDisplayName({+ name: stepDefinition.definition.name,+ type: stepDefinition.definition.type,+ })+ : stepName;+const [editedTitle, setEditedTitle] = useState<string | null>(null);const title =- editedTitle ?? (isDefined(stepName) && stepName !== '' ? stepName : '');+ editedTitle ??+ (isDefined(displayedStepName) && displayedStepName !== ''+ ? displayedStepName+ : '');const handleTitleChange = (newTitle: string) => {setEditedTitle(newTitle);diff --git a/packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsx b/packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsxindex 61c923da336..187f3b7a4cb 100644--- a/packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsx@@ -1,4 +1,5 @@import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';import { IconChevronLeft } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components/input';import { themeCssVariables } from 'twenty-ui/theme';@@ -27,13 +28,15 @@ export const SidePanelSubPageNavigationHeader = ({onBackClick,title,}: SidePanelSubPageNavigationHeaderProps) => {+ const { t } = useLingui();+return (<StyledContainer><IconButtononClick={onBackClick}variant="ghost"size="sm"- aria-label="Go back"+ aria-label={t`Go back`}><IconChevronLeft /></IconButton>diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutDashboardWidgetTypeSelect.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutDashboardWidgetTypeSelect.tsxindex 9c57a767f68..66baa8e2feb 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutDashboardWidgetTypeSelect.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutDashboardWidgetTypeSelect.tsx@@ -179,7 +179,7 @@ export const SidePanelPageLayoutDashboardWidgetTypeSelect = () => {const newWidget = createPageLayoutWidget({type: WidgetType.STANDALONE_RICH_TEXT,- title: 'Untitled Rich Text',+ title: t`Untitled Rich Text`,configuration: {configurationType: WidgetConfigurationType.STANDALONE_RICH_TEXT,body: { blocknote: '', markdown: null },@@ -204,7 +204,7 @@ export const SidePanelPageLayoutDashboardWidgetTypeSelect = () => {const newRecordTableWidget = createPageLayoutWidget({type: WidgetType.RECORD_TABLE,- title: firstAvailableObjectMetadataItem?.labelPlural ?? 'Record Table',+ title: firstAvailableObjectMetadataItem?.labelPlural ?? t`Record Table`,configuration: {configurationType: WidgetConfigurationType.RECORD_TABLE,isUIEditable: pageLayoutDraft.type === PageLayoutType.RECORD_PAGE,diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsxindex 0c02c075d7b..a9e8b8aefa3 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsx@@ -1,10 +1,12 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';import { getActionIconColorOrThrow } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIconColorOrThrow';+import { type MessageDescriptor } from '@lingui/core';+import { useLingui } from '@lingui/react/macro';import { MenuItem } from 'twenty-ui/components/navigation';import { useIcons } from 'twenty-ui/icon';type Action = {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: WorkflowActionType;icon: string;disabled?: boolean;@@ -18,6 +20,7 @@ export const WorkflowActionMenuItems = ({actions: Action[];onClick: (actionType: WorkflowActionType) => void;}) => {+ const { t } = useLingui();const { getIcon } = useIcons();return (@@ -33,7 +36,7 @@ export const WorkflowActionMenuItems = ({<Icon color={getActionIconColorOrThrow(action.type)} size={16} />)}disabled={action.disabled}- text={action.defaultLabel}+ text={t(action.defaultLabel)}contextualText={action.contextualText}onClick={() => onClick(action.type)}/>diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__stories__/WorkflowActionMenuItems.stories.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__stories__/WorkflowActionMenuItems.stories.tsxindex 9770e7dea81..9a77389b13d 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__stories__/WorkflowActionMenuItems.stories.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__stories__/WorkflowActionMenuItems.stories.tsx@@ -1,4 +1,5 @@import { WorkflowActionMenuItems } from '@/side-panel/pages/workflow/action/components/WorkflowActionMenuItems';+import { CLASSIFY_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction';import { type Meta, type StoryObj } from '@storybook/react-vite';import { expect, fn, userEvent, within } from 'storybook/test';import { ComponentDecorator } from 'twenty-ui/testing';@@ -11,7 +12,7 @@ const meta = {actions: [{type: 'CLASSIFY',- defaultLabel: 'Classify (Jev)',+ defaultLabel: CLASSIFY_ACTION.defaultLabel,icon: 'IconCategory',},],@@ -35,7 +36,7 @@ export const Unavailable: Story = {actions: [{type: 'CLASSIFY',- defaultLabel: 'Classify (Jev)',+ defaultLabel: CLASSIFY_ACTION.defaultLabel,icon: 'IconCategory',disabled: true,contextualText: 'TypeSafe AI API key missing',diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__tests__/SidePanelWorkflowSelectAction.test.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__tests__/SidePanelWorkflowSelectAction.test.tsxindex 33fde49624e..87a9c7c9286 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__tests__/SidePanelWorkflowSelectAction.test.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/__tests__/SidePanelWorkflowSelectAction.test.tsx@@ -1,4 +1,4 @@-import { i18n } from '@lingui/core';+import { i18n, type MessageDescriptor } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { render, screen } from '@testing-library/react';import { Provider as JotaiProvider } from 'jotai';@@ -27,14 +27,21 @@ jest.mock(WorkflowActionMenuItems: ({actions,}: {- actions: { defaultLabel: string }[];- }) => (- <>- {actions.map((action) => (- <div key={action.defaultLabel}>{action.defaultLabel}</div>- ))}- </>- ),+ actions: {+ defaultLabel: MessageDescriptor;+ type: string;+ }[];+ }) => {+ const { i18n: mockI18n } = jest.requireActual('@lingui/core');++ return (+ <>+ {actions.map((action) => (+ <div key={action.type}>{mockI18n._(action.defaultLabel)}</div>+ ))}+ </>+ );+ },}),);diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsxindex 2e30ad08819..d0b53f02d1b 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx@@ -8,6 +8,7 @@ import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomCimport { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { flowComponentState } from '@/workflow/states/flowComponentState';import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import {type WorkflowActionType,type WorkflowIfElseAction,@@ -107,7 +108,10 @@ export const SidePanelWorkflowCreateStepContent = () => {openWorkflowEditStepInSidePanel({workflowId: workflowVisualizerWorkflowId,- title: createdStep.name,+ title: getWorkflowStepDisplayName({+ name: createdStep.name,+ type: createdStep.type as WorkflowActionType,+ }),icon: getIcon(getActionIcon(createdStep.type as WorkflowActionType)),stepId: createdStep.id,});diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsxindex cea3a9a62eb..c3d59484fab 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx@@ -7,6 +7,7 @@ import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNaviimport { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow';import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import {type WorkflowAction,type WorkflowActionType,@@ -70,7 +71,10 @@ export const SidePanelWorkflowEditStepTypeContent = () => {openWorkflowEditStepInSidePanel({workflowId: workflowVisualizerWorkflowId,- title: updatedStep.name,+ title: getWorkflowStepDisplayName({+ name: updatedStep.name,+ type: updatedStep.type as WorkflowActionType,+ }),icon: getIcon(getActionIcon(updatedStep.type as WorkflowActionType)),stepId: updatedStep.id,});diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsxindex 398eb825f67..cf7d43f8061 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx@@ -7,6 +7,7 @@ import {type WorkflowTrigger,type WorkflowTriggerType,} from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState';import { SidePanelStepListContainer } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer';import { SidePanelWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle';@@ -66,7 +67,7 @@ export const SidePanelWorkflowSelectTriggerTypeContent = () => {openWorkflowEditStepInSidePanel({workflowId,- title: defaultLabel,+ title: getWorkflowStepDisplayName({ name: defaultLabel, type }),icon: getIcon(icon),stepId: TRIGGER_STEP_ID,});@@ -85,7 +86,10 @@ export const SidePanelWorkflowSelectTriggerTypeContent = () => {withIconContainer={true}key={action.defaultLabel}LeftIcon={() => <Icon color={theme.color.blue} size={16} />}- text={action.defaultLabel}+ text={getWorkflowStepDisplayName({+ name: action.defaultLabel,+ type: action.type,+ })}onClick={handleTriggerTypeClick(action)}/>);@@ -101,7 +105,10 @@ export const SidePanelWorkflowSelectTriggerTypeContent = () => {withIconContainer={true}key={action.defaultLabel}LeftIcon={() => <Icon color={theme.color.purple} size={16} />}- text={action.defaultLabel}+ text={getWorkflowStepDisplayName({+ name: action.defaultLabel,+ type: action.type,+ })}onClick={handleTriggerTypeClick(action)}/>);diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTable.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTable.tsxindex 324e97c7276..5ee794a9d96 100644--- a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTable.tsx+++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTable.tsx@@ -1,4 +1,5 @@import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';import { BackgroundMockTableRow } from '@/sign-in-background-mock/components/BackgroundMockTableRow';import { BACKGROUND_MOCK_COLUMNS } from '@/sign-in-background-mock/constants/BackgroundMockColumns';@@ -161,14 +162,14 @@ export const BackgroundMockTable = () => {{BACKGROUND_MOCK_COLUMNS.map((column) => {const Icon = getIcon(column.iconName);return (- <StyledHeaderCell key={column.label} width={column.width}>+ <StyledHeaderCell key={column.label.id} width={column.width}>{Icon !== undefined && (<Iconsize={theme.icon.size.md}stroke={theme.icon.stroke.sm}/>)}- <StyledHeaderLabel>{column.label}</StyledHeaderLabel>+ <StyledHeaderLabel>{t(column.label)}</StyledHeaderLabel></StyledHeaderCell>);})}@@ -191,7 +192,7 @@ export const BackgroundMockTable = () => {<StyledFooterCheckboxColumn /><StyledFooterCell width={BACKGROUND_MOCK_COLUMNS[0].width}><StyledFooterLabel>- <OverflowingTextWithTooltip text="Calculate" />+ <OverflowingTextWithTooltip text={t`Calculate`} /></StyledFooterLabel><IconChevronDownsize={theme.icon.size.sm}@@ -200,7 +201,7 @@ export const BackgroundMockTable = () => {</StyledFooterCell><StyledFooterCell width={BACKGROUND_MOCK_COLUMNS[1].width}><StyledFooterLabel>- <OverflowingTextWithTooltip text="Count all" />+ <OverflowingTextWithTooltip text={t`Count all`} /></StyledFooterLabel><StyledFooterValue>599</StyledFooterValue></StyledFooterCell>@@ -209,13 +210,13 @@ export const BackgroundMockTable = () => {<StyledFooterCell width={BACKGROUND_MOCK_COLUMNS[4].width} /><StyledFooterCell width={BACKGROUND_MOCK_COLUMNS[5].width}><StyledFooterLabel>- <OverflowingTextWithTooltip text="Max of Employees" />+ <OverflowingTextWithTooltip text={t`Max of Employees`} /></StyledFooterLabel><StyledFooterValue>284,571</StyledFooterValue></StyledFooterCell><StyledFooterCell width={BACKGROUND_MOCK_COLUMNS[6].width}><StyledFooterLabel>- <OverflowingTextWithTooltip text="Not empty of Address" />+ <OverflowingTextWithTooltip text={t`Not empty of Address`} /></StyledFooterLabel><StyledFooterValue>599</StyledFooterValue></StyledFooterCell>diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockViewBar.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockViewBar.tsxindex f6f5caa8ed9..5283181053e 100644--- a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockViewBar.tsx+++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockViewBar.tsx@@ -1,4 +1,5 @@import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';import { TopBar } from '@/ui/layout/top-bar/components/TopBar';import { TintedIconTile } from 'twenty-ui/components/data-display';@@ -40,7 +41,7 @@ export const BackgroundMockViewBar = () => {icon={<IconBuildingSkyscraper size={theme.icon.size.md} />}color="blue"/>- <span>All Companies</span>+ <span>{t`All Companies`}</span><StyledViewPickerCount>· 599</StyledViewPickerCount><IconChevronDownsize={theme.icon.size.sm}@@ -50,9 +51,9 @@ export const BackgroundMockViewBar = () => {}rightComponent={<>- <StyledRightAction>Filter</StyledRightAction>- <StyledRightAction>Sort</StyledRightAction>- <StyledRightAction>Options</StyledRightAction>+ <StyledRightAction>{t`Filter`}</StyledRightAction>+ <StyledRightAction>{t`Sort`}</StyledRightAction>+ <StyledRightAction>{t`Options`}</StyledRightAction></>}/>diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/constants/BackgroundMockColumns.ts b/packages/twenty-front/src/modules/sign-in-background-mock/constants/BackgroundMockColumns.tsindex b6add8f1f64..c1e461e2eb8 100644--- a/packages/twenty-front/src/modules/sign-in-background-mock/constants/BackgroundMockColumns.ts+++ b/packages/twenty-front/src/modules/sign-in-background-mock/constants/BackgroundMockColumns.ts@@ -1,44 +1,46 @@import { BACKGROUND_MOCK_COLUMN_WIDTHS } from '@/sign-in-background-mock/constants/BackgroundMockColumnWidths';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export type BackgroundMockColumn = {- label: keyof typeof BACKGROUND_MOCK_COLUMN_WIDTHS;+ label: MessageDescriptor;iconName: string;width: number;};export const BACKGROUND_MOCK_COLUMNS = [{- label: 'Name',+ label: msg`Name`,iconName: 'IconBuildingSkyscraper',width: BACKGROUND_MOCK_COLUMN_WIDTHS.Name,},{- label: 'Domain',+ label: msg`Domain`,iconName: 'IconLink',width: BACKGROUND_MOCK_COLUMN_WIDTHS.Domain,},{- label: 'Created by',+ label: msg`Created by`,iconName: 'IconUserCircle',width: BACKGROUND_MOCK_COLUMN_WIDTHS['Created by'],},{- label: 'Account Owner',+ label: msg`Account Owner`,iconName: 'IconUserCircle',width: BACKGROUND_MOCK_COLUMN_WIDTHS['Account Owner'],},{- label: 'Creation date',+ label: msg`Creation date`,iconName: 'IconCalendar',width: BACKGROUND_MOCK_COLUMN_WIDTHS['Creation date'],},{- label: 'Employees',+ label: msg`Employees`,iconName: 'IconUsers',width: BACKGROUND_MOCK_COLUMN_WIDTHS.Employees,},{- label: 'Address',+ label: msg`Address`,iconName: 'IconMap',width: BACKGROUND_MOCK_COLUMN_WIDTHS.Address,},diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/hooks/useDownloadFakeRecords.ts b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/hooks/useDownloadFakeRecords.tsindex bdb15c8e483..9e780256db2 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/hooks/useDownloadFakeRecords.ts+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/hooks/useDownloadFakeRecords.ts@@ -7,6 +7,7 @@ import {formatValueForCSV,sanitizeValueForCSVExport,} from 'twenty-shared/utils';+import { t } from '@lingui/core/macro';import { saveAs } from 'file-saver';import { FieldMetadataType } from 'twenty-shared/types';@@ -63,7 +64,7 @@ export const useDownloadFakeRecords = () => {headerRow.push(...subFields.map(({ subFieldLabel }) =>- getCompositeSubFieldLabelWithFieldLabel(field, subFieldLabel),+ getCompositeSubFieldLabelWithFieldLabel(field, t(subFieldLabel)),),);diff --git a/packages/twenty-front/src/modules/spreadsheet-import/types/SpreadsheetImportField.ts b/packages/twenty-front/src/modules/spreadsheet-import/types/SpreadsheetImportField.tsindex 9bb59e5ba43..0b0a5f2bc3b 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/types/SpreadsheetImportField.ts+++ b/packages/twenty-front/src/modules/spreadsheet-import/types/SpreadsheetImportField.ts@@ -7,6 +7,7 @@ import { type IconComponent } from 'twenty-ui/icon';export type SpreadsheetImportField = {Icon: IconComponent | null | undefined;label: string;+ alternateMatches?: string[];key: string;// Field's metadata item id - same for all associated nested fieldsfieldMetadataItemId: string;diff --git a/packages/twenty-front/src/modules/spreadsheet-import/utils/__tests__/getMatchedColumnsWithFuse.test.ts b/packages/twenty-front/src/modules/spreadsheet-import/utils/__tests__/getMatchedColumnsWithFuse.test.tsnew file mode 100644index 00000000000..8a78e65e572--- /dev/null+++ b/packages/twenty-front/src/modules/spreadsheet-import/utils/__tests__/getMatchedColumnsWithFuse.test.ts@@ -0,0 +1,64 @@+import { type SpreadsheetImportField } from '@/spreadsheet-import/types';+import { type SpreadsheetColumns } from '@/spreadsheet-import/types/SpreadsheetColumns';+import { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType';+import { getMatchedColumnsWithFuse } from '@/spreadsheet-import/utils/getMatchedColumnsWithFuse';+import { FieldMetadataType } from 'twenty-shared/types';++const buildField = (+ overrides: Partial<SpreadsheetImportField>,+): SpreadsheetImportField => ({+ Icon: null,+ label: 'label',+ key: 'key',+ fieldMetadataItemId: 'field-metadata-item-id',+ fieldType: { type: 'input' },+ fieldMetadataType: FieldMetadataType.TEXT,+ isNestedField: false,+ ...overrides,+});++const COLUMNS: SpreadsheetColumns = [+ {+ type: SpreadsheetColumnType.empty,+ index: 0,+ header: 'Full Name / First Name',+ },+];++describe('getMatchedColumnsWithFuse', () => {+ it('should match an English column header through an alternate match', () => {+ const { matchedColumns } = getMatchedColumnsWithFuse({+ columns: COLUMNS,+ fields: [+ buildField({+ label: 'Nom complet / Prénom',+ alternateMatches: ['Full Name / First Name'],+ key: 'First Name (fullName)',+ }),+ ],+ data: [],+ });++ expect(matchedColumns[0]).toMatchObject({+ type: SpreadsheetColumnType.matched,+ value: 'First Name (fullName)',+ });+ });++ it('should leave the column unmatched without the alternate match', () => {+ const { matchedColumns } = getMatchedColumnsWithFuse({+ columns: COLUMNS,+ fields: [+ buildField({+ label: 'Nom complet / Prénom',+ key: 'First Name (fullName)',+ }),+ ],+ data: [],+ });++ expect(matchedColumns[0]).toMatchObject({+ type: SpreadsheetColumnType.empty,+ });+ });+});diff --git a/packages/twenty-front/src/modules/spreadsheet-import/utils/getMatchedColumnsWithFuse.ts b/packages/twenty-front/src/modules/spreadsheet-import/utils/getMatchedColumnsWithFuse.tsindex e0ca4e8bc51..da7ef4e8029 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/utils/getMatchedColumnsWithFuse.ts+++ b/packages/twenty-front/src/modules/spreadsheet-import/utils/getMatchedColumnsWithFuse.ts@@ -9,7 +9,7 @@ import { type SpreadsheetColumns } from '@/spreadsheet-import/types/SpreadsheetCimport { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType';import { setColumn } from '@/spreadsheet-import/utils/setColumn';import Fuse from 'fuse.js';-import { isDefined } from 'twenty-shared/utils';+import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';export const getMatchedColumnsWithFuse = ({columns,@@ -23,7 +23,15 @@ export const getMatchedColumnsWithFuse = ({const matchedColumns: SpreadsheetColumn[] = [];const fieldsToSearch = new Fuse(fields, {- keys: ['label'],+ keys: [+ {+ name: 'label',+ getFn: (field) =>+ isNonEmptyArray(field.alternateMatches)+ ? [field.label, ...field.alternateMatches]+ : field.label,+ },+ ],includeScore: true,ignoreLocation: true,threshold: 0.3,diff --git a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsxindex ef159c0c923..8f354e9a319 100644--- a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx+++ b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx@@ -1,15 +1,16 @@import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';import { formatToShortNumber, isDefined } from 'twenty-shared/utils';import { Tooltip } from 'twenty-ui/primitives/surfaces';import { useTheme } from 'twenty-ui/theme';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';+import { getCurrencyLabel } from '@/localization/utils/getCurrencyLabel';import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition';import {type FieldCurrencyMetadata,type FieldCurrencyValue,} from '@/object-record/record-field/ui/types/FieldMetadata';-import { CURRENCY_CODE_LABELS } from 'twenty-shared/constants';import { CURRENCY_CODE_ICONS } from '@/ui/input/components/internal/currency/constants/CurrencyCodeIcons';import { EllipsisDisplay } from '@/ui/field/display/components/internal/EllipsisDisplay/EllipsisDisplay';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';@@ -30,15 +31,12 @@ export const CurrencyDisplay = ({fieldDefinition,}: CurrencyDisplayProps) => {const theme = useTheme();+ const { i18n } = useLingui();const currencyCode = currencyValue?.currencyCode;const CurrencyIcon = isDefined(currencyCode)? CURRENCY_CODE_ICONS[currencyCode]: null;- const currencyLabel = isDefined(currencyCode)- ? CURRENCY_CODE_LABELS[currencyCode]?.label- : undefined;-const amountToDisplay = !isDefined(currencyValue?.amountMicros)? null: currencyValue?.amountMicros / 1000000;@@ -48,6 +46,9 @@ export const CurrencyDisplay = ({const decimalsToUse = decimals ?? DEFAULT_DECIMAL_VALUE;const { formatNumber } = useNumberFormat();+ const currencyLabel = isDefined(currencyCode)+ ? getCurrencyLabel({ currencyCode, locale: i18n.locale })+ : undefined;const currencyTooltipContent = isDefined(currencyCode)? `${currencyCode}${isDefined(currencyLabel) ? ` - ${currencyLabel}` : ''}`: undefined;diff --git a/packages/twenty-front/src/modules/ui/input/components/BaseChip.tsx b/packages/twenty-front/src/modules/ui/input/components/BaseChip.tsxindex 7b376191012..74b3a7ffd7c 100644--- a/packages/twenty-front/src/modules/ui/input/components/BaseChip.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/BaseChip.tsx@@ -1,4 +1,5 @@import { styled } from '@linaria/react';+import { t } from '@lingui/core/macro';import { type MouseEvent, type ReactNode } from 'react';import { IconX } from 'twenty-ui/icon';import { useTheme, themeCssVariables } from 'twenty-ui/theme';@@ -117,7 +118,7 @@ export const BaseChip = ({label,title,onRemove,- removeAriaLabel = 'Remove',+ removeAriaLabel,danger = false,selected = false,isFlashing = false,@@ -147,7 +148,7 @@ export const BaseChip = ({<StyledDeletetype="button"onClick={onRemove}- aria-label={removeAriaLabel}+ aria-label={removeAriaLabel ?? t`Remove`}danger={danger}><IconX size={theme.icon.size.sm} stroke={theme.icon.stroke.sm} />diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsxindex 07e0615536d..85f3b699360 100644--- a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx@@ -3,7 +3,7 @@ import { type KeyboardEvent, useId } from 'react';import { CurrencyCode } from 'twenty-shared/constants';import { CurrencyPicker } from 'twenty-ui/components/input';-import { CURRENCY_PICKER_CURRENCIES } from '@/ui/input/components/internal/currency/constants/CurrencyPickerCurrencies';+import { useCurrencyPickerCurrencies } from '@/ui/input/components/internal/currency/hooks/useCurrencyPickerCurrencies';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownRoot } from '@/ui/layout/dropdown/components/DropdownRoot';@@ -27,7 +27,8 @@ export const CurrencyPickerDropdownButton = ({onChange,}: CurrencyPickerDropdownButtonProps) => {const dropdownId = useId();- const selectedCurrency = CURRENCY_PICKER_CURRENCIES.find(+ const currencyPickerCurrencies = useCurrencyPickerCurrencies();+ const selectedCurrency = currencyPickerCurrencies.find(({ code }) => code === selectedCurrencyCode,);const currencyCode = selectedCurrency?.code ?? CurrencyCode.USD;@@ -47,7 +48,7 @@ export const CurrencyPickerDropdownButton = ({aria-label={t`Currency`}><CurrencyPicker.Options- currencies={CURRENCY_PICKER_CURRENCIES}+ currencies={currencyPickerCurrencies}value={selectedCurrency?.code}onValueChange={onChange}searchLabel={t`Search`}diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/currency/hooks/useCurrencyPickerCurrencies.ts b/packages/twenty-front/src/modules/ui/input/components/internal/currency/hooks/useCurrencyPickerCurrencies.tsnew file mode 100644index 00000000000..8c7eae6dcc3--- /dev/null+++ b/packages/twenty-front/src/modules/ui/input/components/internal/currency/hooks/useCurrencyPickerCurrencies.ts@@ -0,0 +1,23 @@+import { useLingui } from '@lingui/react/macro';+import { useMemo } from 'react';+import { type CurrencyCode } from 'twenty-shared/constants';+import { type CurrencyPickerOption } from 'twenty-ui/components';++import { getCurrencyLabel } from '@/localization/utils/getCurrencyLabel';+import { CURRENCY_PICKER_CURRENCIES } from '@/ui/input/components/internal/currency/constants/CurrencyPickerCurrencies';++export const useCurrencyPickerCurrencies = (): CurrencyPickerOption[] => {+ const { i18n } = useLingui();++ return useMemo(+ () =>+ CURRENCY_PICKER_CURRENCIES.map((currency) => ({+ ...currency,+ name: getCurrencyLabel({+ currencyCode: currency.code as CurrencyCode,+ locale: i18n.locale,+ }),+ })),+ [i18n.locale],+ );+};diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/RelativeDatePickerHeader.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/RelativeDatePickerHeader.tsxindex d85f8196ae0..681ef13f3ca 100644--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/RelativeDatePickerHeader.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/RelativeDatePickerHeader.tsx@@ -108,6 +108,13 @@ export const RelativeDatePickerHeader = ({label: getUnitLabel(unitOption),}));+ const directionSelectOptions = RELATIVE_DATE_DIRECTION_SELECT_OPTIONS.map(+ (directionOption) => ({+ ...directionOption,+ label: t(directionOption.label),+ }),+ );+return (<StyledContainer noPadding={isFormField ?? false}><StyledControlsRow>@@ -133,7 +140,7 @@ export const RelativeDatePickerHeader = ({unit: unit,});}}- options={RELATIVE_DATE_DIRECTION_SELECT_OPTIONS}+ options={directionSelectOptions}fullWidthdisabled={readonly}/>diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/constants/RelativeDateDirectionSelectOptions.ts b/packages/twenty-front/src/modules/ui/input/components/internal/date/constants/RelativeDateDirectionSelectOptions.tsindex 97588f7d475..7dc6c536bcd 100644--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/constants/RelativeDateDirectionSelectOptions.ts+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/constants/RelativeDateDirectionSelectOptions.ts@@ -1,13 +1,15 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { type RelativeDateFilterDirection } from 'twenty-shared/utils';type RelativeDateDirectionOption = {value: RelativeDateFilterDirection;- label: string;+ label: MessageDescriptor;};export const RELATIVE_DATE_DIRECTION_SELECT_OPTIONS: RelativeDateDirectionOption[] =[- { value: 'PAST', label: 'Past' },- { value: 'THIS', label: 'This' },- { value: 'NEXT', label: 'Next' },+ { value: 'PAST', label: msg`Past` },+ { value: 'THIS', label: msg`This` },+ { value: 'NEXT', label: msg`Next` },];diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/hooks/useCurrencies.ts b/packages/twenty-front/src/modules/ui/input/components/internal/hooks/useCurrencies.tsnew file mode 100644index 00000000000..4ac1300a9e8--- /dev/null+++ b/packages/twenty-front/src/modules/ui/input/components/internal/hooks/useCurrencies.ts@@ -0,0 +1,27 @@+import { useLingui } from '@lingui/react/macro';+import { useMemo } from 'react';+import { type CurrencyCode } from 'twenty-shared/constants';++import { getCurrencyLabel } from '@/localization/utils/getCurrencyLabel';+import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';+import { type Currency } from '@/ui/input/components/internal/types/Currency';++export const useCurrencies = (): Currency[] => {+ const { i18n } = useLingui();++ return useMemo(+ () =>+ CURRENCIES.map((currency) => {+ const currencyLabel = getCurrencyLabel({+ currencyCode: currency.value as CurrencyCode,+ locale: i18n.locale,+ });++ return {+ ...currency,+ label: `${currencyLabel} (${currency.value})`,+ };+ }),+ [i18n.locale],+ );+};diff --git a/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRuleExpressionEditor.tsx b/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRuleExpressionEditor.tsxindex 098b2a34b41..f220eae3be1 100644--- a/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRuleExpressionEditor.tsx+++ b/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRuleExpressionEditor.tsx@@ -33,6 +33,7 @@ import { computeValidationRuleHelperContext } from '@/validation-rules/utils/comimport { computeValidationRuleHelperContextAtCursor } from '@/validation-rules/utils/computeValidationRuleHelperContextAtCursor';import { getValidationRuleEditorFieldChipLabel } from '@/validation-rules/utils/getValidationRuleEditorFieldChipLabel';import { getValidationRuleEditorText } from '@/validation-rules/utils/getValidationRuleEditorText';+import { getValidationRuleErrorMessage } from '@/validation-rules/utils/getValidationRuleErrorMessage';import { handleValidationRuleEditorPaste } from '@/validation-rules/utils/handleValidationRuleEditorPaste';import { insertValidationRuleHelperItem } from '@/validation-rules/utils/insertValidationRuleHelperItem';@@ -263,7 +264,7 @@ export const SettingsValidationRuleExpressionEditor = ({});const errorMessage =value.trim().length > 0 && !compilationResult.isValid- ? compilationResult.errorMessage+ ? getValidationRuleErrorMessage(compilationResult): null;return (diff --git a/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRulePreview.tsx b/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRulePreview.tsxindex c90a38f37d8..dd7ec0be7c5 100644--- a/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRulePreview.tsx+++ b/packages/twenty-front/src/modules/validation-rules/components/SettingsValidationRulePreview.tsx@@ -28,6 +28,7 @@ import { type ValidationRuleEditorField } from '@/validation-rules/types/Validatimport { buildValidationRulePreviewRelationGqlFields } from '@/validation-rules/utils/buildValidationRulePreviewRelationGqlFields';import { formatValidationRulePreviewValue } from '@/validation-rules/utils/formatValidationRulePreviewValue';import { getValidationRuleEditorFieldChipLabel } from '@/validation-rules/utils/getValidationRuleEditorFieldChipLabel';+import { getValidationRuleErrorMessage } from '@/validation-rules/utils/getValidationRuleErrorMessage';import { getValidationRulePreviewValue } from '@/validation-rules/utils/getValidationRulePreviewValue';const PREVIEW_RECORD_COUNT = 3;@@ -235,7 +236,7 @@ export const SettingsValidationRulePreview = ({return (<Tooltipdelay={TooltipDelay.mediumDelay}- content={evaluationResult.errorMessage}+ content={getValidationRuleErrorMessage(evaluationResult)}side="top"><StyledStatus tabIndex={0}>diff --git a/packages/twenty-front/src/modules/validation-rules/utils/__tests__/getValidationRuleErrorMessage.test.ts b/packages/twenty-front/src/modules/validation-rules/utils/__tests__/getValidationRuleErrorMessage.test.tsnew file mode 100644index 00000000000..eb4bd6eb06c--- /dev/null+++ b/packages/twenty-front/src/modules/validation-rules/utils/__tests__/getValidationRuleErrorMessage.test.ts@@ -0,0 +1,115 @@+import { getValidationRuleErrorMessage } from '@/validation-rules/utils/getValidationRuleErrorMessage';+import {+ FieldMetadataType,+ RelationType,+ type ValidationRuleFieldDescriptor,+} from 'twenty-shared/types';+import { compileValidationRuleExpression } from 'twenty-shared/utils';++const OPPORTUNITY_FIELDS: ValidationRuleFieldDescriptor[] = [+ {+ name: 'stage',+ type: FieldMetadataType.SELECT,+ universalIdentifier: 'opportunity-stage',+ },+ {+ name: 'amount',+ type: FieldMetadataType.CURRENCY,+ universalIdentifier: 'opportunity-amount',+ },+ {+ name: 'company',+ type: FieldMetadataType.RELATION,+ universalIdentifier: 'opportunity-company',+ relationType: RelationType.MANY_TO_ONE,+ relationTargetFields: [+ {+ name: 'people',+ type: FieldMetadataType.RELATION,+ universalIdentifier: 'company-people',+ relationType: RelationType.ONE_TO_MANY,+ },+ ],+ },+ {+ name: 'pointOfContacts',+ type: FieldMetadataType.RELATION,+ universalIdentifier: 'opportunity-point-of-contacts',+ relationType: RelationType.ONE_TO_MANY,+ },+];++describe('getValidationRuleErrorMessage', () => {+ it('should return the message for a known error code', () => {+ expect(+ getValidationRuleErrorMessage({+ errorCode: 'BRACKET_ACCESS',+ errorMessage: 'raw message',+ }),+ ).toBe('Bracket access is not supported, use dot access instead');++ expect(+ getValidationRuleErrorMessage({+ errorCode: 'NON_BOOLEAN_RESULT',+ errorMessage: 'raw message',+ }),+ ).toBe('Expression did not return true or false');+ });++ it('should put the error params back into the message', () => {+ expect(+ getValidationRuleErrorMessage({+ errorCode: 'UNKNOWN_RELATION_TARGET_FIELD',+ errorParams: { fieldName: 'size', relationFieldName: 'company' },+ errorMessage: 'raw message',+ }),+ ).toBe('Unknown field "size" on "company"');++ expect(+ getValidationRuleErrorMessage({+ errorCode: 'EXPRESSION_TOO_LONG',+ errorParams: { maxLength: 2000 },+ errorMessage: 'raw message',+ }),+ ).toBe('Expression is longer than 2000 characters');+ });++ it('should match the English message of every coded compiler error', () => {+ const expressions = [+ ' ',+ `stage == "${'x'.repeat(2000)}"`,+ 'stage["value"] == "WON"',+ 'amount . amountMicros > 0',+ 'now.date > 0',+ 'closeDate > now',+ 'amount.value > 0',+ 'amount.amountMicros.value > 0',+ 'isDefined(pointOfContacts)',+ 'isDefined(company.size)',+ 'isDefined(company.people)',+ 'stage',+ ];++ for (const expression of expressions) {+ const compilationResult = compileValidationRuleExpression({+ expression,+ fields: OPPORTUNITY_FIELDS,+ });++ if (compilationResult.isValid) {+ throw new Error(`Expected "${expression}" to be invalid`);+ }++ expect(compilationResult.errorCode).toBeDefined();+ expect(getValidationRuleErrorMessage(compilationResult)).toBe(+ compilationResult.errorMessage,+ );+ }+ });++ it('should return the raw message when there is no error code', () => {+ expect(+ getValidationRuleErrorMessage({ errorMessage: 'Unexpected token' }),+ ).toBe('Unexpected token');+ });+});diff --git a/packages/twenty-front/src/modules/validation-rules/utils/buildValidationRuleEditorFields.ts b/packages/twenty-front/src/modules/validation-rules/utils/buildValidationRuleEditorFields.tsindex c6eecf171a9..7bfe94bdd70 100644--- a/packages/twenty-front/src/modules/validation-rules/utils/buildValidationRuleEditorFields.ts+++ b/packages/twenty-front/src/modules/validation-rules/utils/buildValidationRuleEditorFields.ts@@ -1,5 +1,6 @@+import { type MessageDescriptor } from '@lingui/core';+import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';-import { COMPOSITE_FIELD_SUB_FIELD_LABELS } from 'twenty-shared/constants';import {compositeTypeDefinitions,FieldMetadataType,@@ -8,6 +9,7 @@ import { isDefined } from 'twenty-shared/utils';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';+import { COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES } from '@/settings/data-model/constants/CompositeFieldSubFieldLabelMessages';import { type ValidationRuleEditorField } from '@/validation-rules/types/ValidationRuleEditorField';import { RelationType } from '~/generated-metadata/graphql';@@ -24,14 +26,18 @@ const isRelationType = (type: FieldMetadataType) =>type === FieldMetadataType.MORPH_RELATION;const COMPOSITE_SUBFIELD_LABELS_BY_FIELD_TYPE: Partial<- Record<FieldMetadataType, Record<string, string>>-> = COMPOSITE_FIELD_SUB_FIELD_LABELS;+ Record<FieldMetadataType, Record<string, MessageDescriptor>>+> = COMPOSITE_FIELD_SUB_FIELD_LABEL_MESSAGES;const getCompositeSubfieldLabel = (type: FieldMetadataType,subfieldName: string,-): string =>- COMPOSITE_SUBFIELD_LABELS_BY_FIELD_TYPE[type]?.[subfieldName] ?? subfieldName;+): string => {+ const subfieldLabel =+ COMPOSITE_SUBFIELD_LABELS_BY_FIELD_TYPE[type]?.[subfieldName];++ return isDefined(subfieldLabel) ? t(subfieldLabel) : subfieldName;+};const buildScalarEditorFields = ({fieldMetadataItem,diff --git a/packages/twenty-front/src/modules/validation-rules/utils/getValidationRuleErrorMessage.ts b/packages/twenty-front/src/modules/validation-rules/utils/getValidationRuleErrorMessage.tsnew file mode 100644index 00000000000..8bd206e089f--- /dev/null+++ b/packages/twenty-front/src/modules/validation-rules/utils/getValidationRuleErrorMessage.ts@@ -0,0 +1,50 @@+import { t } from '@lingui/core/macro';+import {+ type ValidationRuleErrorCode,+ type ValidationRuleErrorParams,+} from 'twenty-shared/types';++export const getValidationRuleErrorMessage = ({+ errorCode,+ errorParams,+ errorMessage,+}: {+ errorCode?: ValidationRuleErrorCode;+ errorParams?: ValidationRuleErrorParams;+ errorMessage: string;+}): string => {+ const fieldName = errorParams?.fieldName ?? '';+ const maxLength = errorParams?.maxLength ?? 0;+ const path = errorParams?.path ?? '';+ const relationFieldName = errorParams?.relationFieldName ?? '';+ const subfieldName = errorParams?.subfieldName ?? '';++ switch (errorCode) {+ case 'EMPTY_EXPRESSION':+ return t`Expression is empty`;+ case 'EXPRESSION_TOO_LONG':+ return t`Expression is longer than ${maxLength} characters`;+ case 'BRACKET_ACCESS':+ return t`Bracket access is not supported, use dot access instead`;+ case 'SPACED_MEMBER_DOT':+ return t`Write ${path} without spaces around the dot`;+ case 'NOT_A_VALUE':+ return t`"${path}" is not a value`;+ case 'UNKNOWN_FIELD':+ return t`Unknown field "${fieldName}"`;+ case 'UNKNOWN_SUBFIELD':+ return t`"${subfieldName}" is not a subfield of "${fieldName}"`;+ case 'SUBFIELD_TOO_DEEP':+ return t`"${path}" goes deeper than the field "${fieldName}" allows`;+ case 'NOT_A_TO_ONE_RELATION':+ return t`"${fieldName}" is not a to-one relation`;+ case 'UNKNOWN_RELATION_TARGET_FIELD':+ return t`Unknown field "${fieldName}" on "${relationFieldName}"`;+ case 'RELATION_TOO_DEEP':+ return t`"${path}" goes more than one relation deep`;+ case 'NON_BOOLEAN_RESULT':+ return t`Expression did not return true or false`;+ default:+ return errorMessage;+ }+};diff --git a/packages/twenty-front/src/modules/workflow/constants/WorkflowStepDefaultNames.ts b/packages/twenty-front/src/modules/workflow/constants/WorkflowStepDefaultNames.tsnew file mode 100644index 00000000000..69b3a4eb5da--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/constants/WorkflowStepDefaultNames.ts@@ -0,0 +1,186 @@+import {+ type WorkflowActionType,+ type WorkflowTriggerType,+} from '@/workflow/types/Workflow';+import { AI_AGENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction';+import { CODE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction';+import { CREATE_CALENDAR_EVENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction';+import { CREATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction';+import { DELAY_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction';+import { DELETE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction';+import { DRAFT_EMAIL_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction';+import { FILTER_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction';+import { FIND_RECORDS_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction';+import { FORM_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FormAction';+import { HTTP_REQUEST_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/HttpRequestAction';+import { IF_ELSE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction';+import { ITERATOR_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/IteratorAction';+import { PICK_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/PickRecordAction';+import { SEND_CHAT_MESSAGE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction';+import { SEND_EMAIL_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction';+import { UPDATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction';+import { UPSERT_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction';+import { WAIT_FOR_EVENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction';+import { DatabaseTriggerDefaultLabel } from '@/workflow/workflow-trigger/constants/DatabaseTriggerDefaultLabel';+import { CRON_TRIGGER } from '@/workflow/workflow-trigger/constants/triggers/CronTrigger';+import { MANUAL_TRIGGER } from '@/workflow/workflow-trigger/constants/triggers/ManualTrigger';+import { WEBHOOK_TRIGGER } from '@/workflow/workflow-trigger/constants/triggers/WebhookTrigger';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';++export const WORKFLOW_STEP_DEFAULT_NAMES: Array<{+ type: WorkflowActionType | WorkflowTriggerType;+ name: string;+ label: MessageDescriptor;+}> = [+ {+ type: 'CODE',+ name: 'Code - Logic Function',+ label: CODE_ACTION.defaultLabel,+ },+ {+ type: 'SEND_EMAIL',+ name: 'Send Email',+ label: SEND_EMAIL_ACTION.defaultLabel,+ },+ {+ type: 'SEND_CHAT_MESSAGE',+ name: 'Send to Inbox',+ label: SEND_CHAT_MESSAGE_ACTION.defaultLabel,+ },+ {+ type: 'CREATE_CALENDAR_EVENT',+ name: 'Create Calendar Event',+ label: CREATE_CALENDAR_EVENT_ACTION.defaultLabel,+ },+ {+ type: 'DRAFT_EMAIL',+ name: 'Draft Email',+ label: DRAFT_EMAIL_ACTION.defaultLabel,+ },+ {+ type: 'CREATE_RECORD',+ name: 'Create Record',+ label: CREATE_RECORD_ACTION.defaultLabel,+ },+ {+ type: 'UPDATE_RECORD',+ name: 'Update Record',+ label: UPDATE_RECORD_ACTION.defaultLabel,+ },+ {+ type: 'DELETE_RECORD',+ name: 'Delete Record',+ label: DELETE_RECORD_ACTION.defaultLabel,+ },+ {+ type: 'UPSERT_RECORD',+ name: 'Create or Update Record',+ label: UPSERT_RECORD_ACTION.defaultLabel,+ },+ {+ type: 'FIND_RECORDS',+ name: 'Search Records',+ label: FIND_RECORDS_ACTION.defaultLabel,+ },+ {+ type: 'PICK_RECORD',+ name: 'Pick Record',+ label: PICK_RECORD_ACTION.defaultLabel,+ },+ {+ type: 'FORM',+ name: 'Form',+ label: FORM_ACTION.defaultLabel,+ },+ {+ type: 'FILTER',+ name: 'Filter',+ label: FILTER_ACTION.defaultLabel,+ },+ {+ type: 'HTTP_REQUEST',+ name: 'HTTP Request',+ label: HTTP_REQUEST_ACTION.defaultLabel,+ },+ {+ type: 'AI_AGENT',+ name: 'Agent',+ label: AI_AGENT_ACTION.defaultLabel,+ },+ {+ type: 'CLASSIFY',+ name: 'Classify',+ label: msg`Classify`,+ },+ {+ type: 'ITERATOR',+ name: 'Iterator',+ label: ITERATOR_ACTION.defaultLabel,+ },+ {+ type: 'IF_ELSE',+ name: 'If/Else',+ label: msg`If/Else`,+ },+ {+ type: 'IF_ELSE',+ name: 'If/else',+ label: IF_ELSE_ACTION.defaultLabel,+ },+ {+ type: 'DELAY',+ name: 'Delay',+ label: DELAY_ACTION.defaultLabel,+ },+ {+ type: 'WAIT_FOR_EVENT',+ name: 'Wait for Event',+ label: WAIT_FOR_EVENT_ACTION.defaultLabel,+ },+ {+ type: 'EMPTY',+ name: 'Add an Action',+ label: msg`Add an Action`,+ },+ {+ type: 'MANUAL',+ name: MANUAL_TRIGGER.defaultLabel,+ label: msg`Launch manually`,+ },+ {+ type: 'MANUAL',+ name: 'Manual trigger',+ label: msg`Manual trigger`,+ },+ {+ type: 'CRON',+ name: CRON_TRIGGER.defaultLabel,+ label: msg`On a schedule`,+ },+ {+ type: 'WEBHOOK',+ name: WEBHOOK_TRIGGER.defaultLabel,+ label: msg`Webhook`,+ },+ {+ type: 'DATABASE_EVENT',+ name: DatabaseTriggerDefaultLabel.RECORD_IS_CREATED,+ label: msg`Record is created`,+ },+ {+ type: 'DATABASE_EVENT',+ name: DatabaseTriggerDefaultLabel.RECORD_IS_UPDATED,+ label: msg`Record is updated`,+ },+ {+ type: 'DATABASE_EVENT',+ name: DatabaseTriggerDefaultLabel.RECORD_IS_DELETED,+ label: msg`Record is deleted`,+ },+ {+ type: 'DATABASE_EVENT',+ name: DatabaseTriggerDefaultLabel.RECORD_UPSERTED,+ label: msg`Record is created or updated`,+ },+];diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowStepDisplayName.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowStepDisplayName.test.tsnew file mode 100644index 00000000000..ba090df654b--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowStepDisplayName.test.ts@@ -0,0 +1,61 @@+import { WORKFLOW_STEP_DEFAULT_NAMES } from '@/workflow/constants/WorkflowStepDefaultNames';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';+import { i18n } from '@lingui/core';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++const SEND_EMAIL_DEFAULT_NAME = WORKFLOW_STEP_DEFAULT_NAMES.find(+ (stepDefaultName) => stepDefaultName.type === 'SEND_EMAIL',+);++const IF_ELSE_DEFAULT_NAMES = WORKFLOW_STEP_DEFAULT_NAMES.filter(+ (stepDefaultName) => stepDefaultName.type === 'IF_ELSE',+);++describe('getWorkflowStepDisplayName', () => {+ beforeEach(() => {+ i18n.load('fr-FR', {+ [SEND_EMAIL_DEFAULT_NAME?.label.id ?? '']: 'Envoyer un e-mail',+ ...Object.fromEntries(+ IF_ELSE_DEFAULT_NAMES.map((stepDefaultName) => [+ stepDefaultName.label.id,+ 'Si/sinon',+ ]),+ ),+ });+ i18n.activate('fr-FR');+ });++ afterEach(() => {+ i18n.activate(SOURCE_LOCALE);+ });++ it('should translate the stored default name of the step type', () => {+ expect(+ getWorkflowStepDisplayName({ name: 'Send Email', type: 'SEND_EMAIL' }),+ ).toBe('Envoyer un e-mail');+ });++ it('should translate both stored spellings of the If/else default name', () => {+ expect(+ getWorkflowStepDisplayName({ name: 'If/Else', type: 'IF_ELSE' }),+ ).toBe('Si/sinon');+ expect(+ getWorkflowStepDisplayName({ name: 'If/else', type: 'IF_ELSE' }),+ ).toBe('Si/sinon');+ });++ it('should keep a name the user chose', () => {+ expect(+ getWorkflowStepDisplayName({+ name: 'Send the invoice',+ type: 'SEND_EMAIL',+ }),+ ).toBe('Send the invoice');+ });++ it('should keep a default name stored for another step type', () => {+ expect(+ getWorkflowStepDisplayName({ name: 'Send Email', type: 'DRAFT_EMAIL' }),+ ).toBe('Send Email');+ });+});diff --git a/packages/twenty-front/src/modules/workflow/utils/getWorkflowStepDisplayName.ts b/packages/twenty-front/src/modules/workflow/utils/getWorkflowStepDisplayName.tsnew file mode 100644index 00000000000..405f6fa97e4--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/utils/getWorkflowStepDisplayName.ts@@ -0,0 +1,22 @@+import { WORKFLOW_STEP_DEFAULT_NAMES } from '@/workflow/constants/WorkflowStepDefaultNames';+import {+ type WorkflowActionType,+ type WorkflowTriggerType,+} from '@/workflow/types/Workflow';+import { t } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';++export const getWorkflowStepDisplayName = ({+ name,+ type,+}: {+ name: string;+ type: WorkflowActionType | WorkflowTriggerType;+}): string => {+ const defaultName = WORKFLOW_STEP_DEFAULT_NAMES.find(+ (stepDefaultName) =>+ stepDefaultName.type === type && stepDefaultName.name === name,+ );++ return isDefined(defaultName) ? t(defaultName.label) : name;+};diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsxindex dbcfc936a19..5eb41067b66 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx@@ -38,6 +38,7 @@ import { WORKFLOW_DIAGRAM_NODE_DEFAULT_SOURCE_HANDLE_ID } from '@/workflow/workfimport { WORKFLOW_DIAGRAM_NODE_DEFAULT_TARGET_HANDLE_ID } from '@/workflow/workflow-diagram/workflow-nodes/constants/WorkflowDiagramNodeDefaultTargetHandleId';import { workflowInsertStepIdsComponentState } from '@/workflow/workflow-steps/states/workflowInsertStepIdsComponentState';import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';import {Background,ReactFlow,@@ -175,6 +176,7 @@ export const WorkflowDiagramCanvasBase = ({event: MouseEvent | React.MouseEvent<Element, MouseEvent>;}) => void;}) => {+ const { t } = useLingui();const theme = useTheme();const colorScheme = useThemeColorScheme();const allowPageScroll = useContext(WorkflowDiagramAllowPageScrollContext);@@ -250,6 +252,7 @@ export const WorkflowDiagramCanvasBase = ({measured: emptyNodeMeasuredDimensions,data: {...WORKFLOW_DIAGRAM_EMPTY_NODE_DEFINITION.data,+ name: t`Add an Action`,position: workflowInsertStepIds.position,},};@@ -276,7 +279,7 @@ export const WorkflowDiagramCanvasBase = ({}return { nodes, edges };- }, [workflowDiagram, workflowInsertStepIds, emptyNodeMeasuredDimensions]);+ }, [workflowDiagram, workflowInsertStepIds, emptyNodeMeasuredDimensions, t]);const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState);const { commandMenuContextApi } = useContext(CommandMenuContext);diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForDefaultNode.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForDefaultNode.tsindex f87fbd06793..ffd2f6500f3 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForDefaultNode.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForDefaultNode.ts@@ -1,4 +1,5 @@import { type WorkflowStep } from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { type WorkflowContext } from '@/workflow/workflow-diagram/types/WorkflowContext';import {type WorkflowDiagramEdge,@@ -46,7 +47,7 @@ export const generateNodesAndEdgesForDefaultNode = ({data: {nodeType: 'action',actionType: step.type,- name: step.name,+ name: getWorkflowStepDisplayName({ name: step.name, type: step.type }),...(step.type === 'LOGIC_FUNCTION'? { logicFunctionId: step.settings.input.logicFunctionId }: {}),diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIfElseNode.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIfElseNode.tsindex af70843d49c..c34509b4303 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIfElseNode.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIfElseNode.ts@@ -2,6 +2,7 @@ import {type WorkflowIfElseAction,type WorkflowStep,} from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { type WorkflowContext } from '@/workflow/workflow-diagram/types/WorkflowContext';import {type WorkflowDiagramEdge,@@ -50,7 +51,7 @@ export const generateNodesAndEdgesForIfElseNode = ({data: {nodeType: 'action',actionType: step.type,- name: step.name,+ name: getWorkflowStepDisplayName({ name: step.name, type: step.type }),hasNextStepIds: true,stepId: step.id,position: step.position ?? {diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIteratorNode.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIteratorNode.tsindex d697a363c75..e7cbdeecef6 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIteratorNode.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateNodesAndEdgesForIteratorNode.ts@@ -2,6 +2,7 @@ import {type WorkflowIteratorAction,type WorkflowStep,} from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { type WorkflowContext } from '@/workflow/workflow-diagram/types/WorkflowContext';import {type WorkflowDiagramEdge,@@ -52,7 +53,7 @@ export const generateNodesAndEdgesForIteratorNode = ({data: {nodeType: 'action',actionType: step.type,- name: step.name,+ name: getWorkflowStepDisplayName({ name: step.name, type: step.type }),hasNextStepIds:isDefined(step.nextStepIds) && step.nextStepIds.length > 0,stepId: step.id,diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode.tsindex 422809e3088..a8db8f79459 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode.ts@@ -1,4 +1,5 @@import { type WorkflowTrigger } from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { splitWorkflowTriggerEventName } from '@/workflow/utils/splitWorkflowTriggerEventName';import { type WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/types/WorkflowDiagram';import { DATABASE_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/DatabaseTriggerTypes';@@ -60,7 +61,10 @@ export const getWorkflowDiagramTriggerNode = ({data: {nodeType: 'trigger',triggerType: trigger.type,- name: isDefined(trigger.name) ? trigger.name : triggerDefaultLabel,+ name: getWorkflowStepDisplayName({+ name: isDefined(trigger.name) ? trigger.name : triggerDefaultLabel,+ type: trigger.type,+ }),icon: triggerIcon,stepId: 'trigger',hasNextStepIds:diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowRunStatusTagProps.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowRunStatusTagProps.tsindex 9096d414f0d..86d03b8350b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowRunStatusTagProps.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowRunStatusTagProps.ts@@ -1,4 +1,5 @@import { type WorkflowRunStatus } from '@/workflow/types/Workflow';+import { t } from '@lingui/core/macro';import { type TagColor } from 'twenty-ui/primitives/data-display';export const getWorkflowRunStatusTagProps = ({@@ -9,47 +10,47 @@ export const getWorkflowRunStatusTagProps = ({if (workflowRunStatus === 'NOT_STARTED') {return {color: 'gray',- text: 'Not started',+ text: t`Not started`,};}if (workflowRunStatus === 'RUNNING') {return {color: 'yellow',- text: 'Running',+ text: t`Running`,};}if (workflowRunStatus === 'COMPLETED') {return {color: 'green',- text: 'Completed',+ text: t`Completed`,};}if (workflowRunStatus === 'ENQUEUED') {return {color: 'blue',- text: 'Enqueued',+ text: t`Enqueued`,};}if (workflowRunStatus === 'STOPPING') {return {color: 'orange',- text: 'Stopping',+ text: t`Stopping`,};}if (workflowRunStatus === 'STOPPED') {return {color: 'gray',- text: 'Stopped',+ text: t`Stopped`,};}return {color: 'red',- text: 'Failed',+ text: t`Failed`,};};diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowVersionStatusTagProps.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowVersionStatusTagProps.tsindex bd46b95eef5..0f0d5633f31 100644--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowVersionStatusTagProps.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/utils/getWorkflowVersionStatusTagProps.ts@@ -1,4 +1,5 @@import { type WorkflowVersionStatus } from '@/workflow/types/Workflow';+import { t } from '@lingui/core/macro';import { type TagColor } from 'twenty-ui/primitives/data-display';export const getWorkflowVersionStatusTagProps = ({@@ -9,26 +10,26 @@ export const getWorkflowVersionStatusTagProps = ({if (workflowVersionStatus === 'ARCHIVED') {return {color: 'gray',- text: 'Archived',+ text: t`Archived`,};}if (workflowVersionStatus === 'DRAFT') {return {color: 'yellow',- text: 'Draft',+ text: t`Draft`,};}if (workflowVersionStatus === 'ACTIVE') {return {color: 'green',- text: 'Active',+ text: t`Active`,};}return {color: 'gray',- text: 'Deactivated',+ text: t`Deactivated`,};};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterValueCompositeInput.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterValueCompositeInput.tsxindex 36c82aeaed6..e9cc3dc8350 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterValueCompositeInput.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterValueCompositeInput.tsx@@ -7,7 +7,7 @@ import {type FieldRelationToOneValue,type FieldRelationValue,} from '@/object-record/record-field/ui/types/FieldMetadata';-import { CURRENCIES } from '@/ui/input/components/internal/currency/constants/Currencies';+import { useCurrencies } from '@/ui/input/components/internal/hooks/useCurrencies';import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext';import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';import { useContext } from 'react';@@ -36,6 +36,7 @@ export const WorkflowStepFilterValueCompositeInput = ({onClear: () => void;}) => {const { readonly } = useContext(WorkflowStepFilterContext);+ const currencies = useCurrencies();const { type: filterType, compositeFieldSubFieldName: subFieldName } =stepFilter;@@ -63,7 +64,7 @@ export const WorkflowStepFilterValueCompositeInput = ({defaultValue={stepFilter.value}onChange={onChange}VariablePicker={WorkflowVariablePicker}- options={CURRENCIES}+ options={currencies}readonly={readonly}/>) : subFieldName === 'amountMicros' ? (diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/getWorkflowRunStepContext.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/getWorkflowRunStepContext.tsindex e70b8419fd4..d6e6097af64 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/utils/getWorkflowRunStepContext.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/utils/getWorkflowRunStepContext.ts@@ -1,4 +1,5 @@import { type WorkflowRunFlow } from '@/workflow/types/Workflow';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import {TRIGGER_STEP_ID,type WorkflowRunStepInfos,@@ -6,6 +7,7 @@ import {import { type WorkflowRunStepContext } from '@/workflow/workflow-steps/types/WorkflowRunStepContext';import { getPreviousSteps } from '@/workflow/workflow-steps/utils/getWorkflowPreviousSteps';import { getWorkflowRunAllStepInfoHistory } from '@/workflow/workflow-steps/utils/getWorkflowRunAllStepInfoHistory';+import { t } from '@lingui/core/macro';import { isDefined } from 'twenty-shared/utils';export const getWorkflowRunStepContext = ({@@ -52,7 +54,7 @@ export const getWorkflowRunStepContext = ({reversedPreviousStepsContext.push({id: step.id,- name: step.name,+ name: getWorkflowStepDisplayName({ name: step.name, type: step.type }),context: stepInfoHistory[historyItemIndex].result,});@@ -64,7 +66,12 @@ export const getWorkflowRunStepContext = ({return [{id: TRIGGER_STEP_ID,- name: flow.trigger.name ?? 'Trigger',+ name: isDefined(flow.trigger.name)+ ? getWorkflowStepDisplayName({+ name: flow.trigger.name,+ type: flow.trigger.type,+ })+ : t`Trigger`,context: stepInfos[TRIGGER_STEP_ID].result,},...reversedPreviousStepsContext.toReversed(),diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsxindex 3a015f3e0ce..b405ef84449 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx@@ -35,6 +35,7 @@ import { CodeEditor } from 'twenty-ui/components/code-editor';import { LogicFunctionTestInputInitEffect } from '@/logic-functions/components/LogicFunctionTestInputInitEffect';import { useExecuteLogicFunction } from '@/logic-functions/hooks/useExecuteLogicFunction';import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { CODE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction';import { type Monaco } from '@monaco-editor/react';import { type editor } from 'monaco-editor';@@ -321,7 +322,9 @@ export const WorkflowEditActionCode = ({href: '#',},{- children: isDefined(action.name) ? action.name : CODE_ACTION.defaultLabel,+ children: isDefined(action.name)+ ? getWorkflowStepDisplayName({ name: action.name, type: action.type })+ : t(CODE_ACTION.defaultLabel),href: '#',},{diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsxindex d38c0ec3eab..abf54598578 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx@@ -18,6 +18,7 @@ import { WORKFLOW_STEP_CONNECTED_ACCOUNT_HANDLE } from '@/workflow/graphql/queriimport { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState';import { type WorkflowEmailAction } from '@/workflow/types/WorkflowEmailAction';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';import { WorkflowSendEmailAttachments } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowSendEmailAttachments';@@ -397,7 +398,12 @@ export const WorkflowEditActionEmailBase = ({href: '#',},{- children: isDefined(action.name) ? action.name : t`Email`,+ children: isDefined(action.name)+ ? getWorkflowStepDisplayName({+ name: action.name,+ type: action.type,+ })+ : t`Email`,href: '#',},{diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/AiActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/AiActions.tsindex acbbfbb5946..8aa753d09c3 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/AiActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/AiActions.ts@@ -1,9 +1,10 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';import { AI_AGENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction';import { CLASSIFY_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction';export const AI_ACTIONS: Array<{- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'AI_AGENT' | 'CLASSIFY'>;icon: string;}> = [AI_AGENT_ACTION, CLASSIFY_ACTION];diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/CoreActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/CoreActions.tsindex 153aed3a391..9e9314590fe 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/CoreActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/CoreActions.ts@@ -1,4 +1,5 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';import { CODE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction';import { CREATE_CALENDAR_EVENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction';import { DRAFT_EMAIL_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction';@@ -6,7 +7,7 @@ import { HTTP_REQUEST_ACTION } from '@/workflow/workflow-steps/workflow-actions/import { SEND_EMAIL_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction';export const CORE_ACTIONS: Array<{- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType,| 'CODE'diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/FlowActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/FlowActions.tsindex 78a88293a33..11bc4b5ae53 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/FlowActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/FlowActions.ts@@ -1,4 +1,5 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';import { DELAY_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction';import { FILTER_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction';import { IF_ELSE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction';@@ -6,7 +7,7 @@ import { ITERATOR_ACTION } from '@/workflow/workflow-steps/workflow-actions/consimport { WAIT_FOR_EVENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction';export const FLOW_ACTIONS: Array<{- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType,'ITERATOR' | 'FILTER' | 'IF_ELSE' | 'DELAY' | 'WAIT_FOR_EVENT'diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/HumanInputActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/HumanInputActions.tsindex 9a6375a2feb..451f5505d9f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/HumanInputActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/HumanInputActions.ts@@ -1,9 +1,10 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';import { FORM_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FormAction';import { SEND_CHAT_MESSAGE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction';export const HUMAN_INPUT_ACTIONS: Array<{- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'FORM' | 'SEND_CHAT_MESSAGE'>;icon: string;}> = [FORM_ACTION, SEND_CHAT_MESSAGE_ACTION];diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/RecordActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/RecordActions.tsindex b40fbf5be56..6a525d4c98f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/RecordActions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/RecordActions.ts@@ -1,4 +1,5 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';import { CREATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction';import { DELETE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction';import { FIND_RECORDS_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction';@@ -7,7 +8,7 @@ import { UPDATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actionsimport { UPSERT_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction';export const RECORD_ACTIONS: Array<{- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType,| 'CREATE_RECORD'diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction.tsindex 816c2b58831..f5c6784b1e5 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const AI_AGENT_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'AI_AGENT'>;icon: string;} = {- defaultLabel: 'Agent',+ defaultLabel: msg`Agent`,type: 'AI_AGENT',icon: 'IconLego',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction.tsindex b5ea92d290c..73bc5f9a60f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/ClassifyAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const CLASSIFY_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'CLASSIFY'>;icon: string;} = {- defaultLabel: 'Classify (Jev)',+ defaultLabel: msg`Classify (Jev)`,type: 'CLASSIFY',icon: 'IconCategory',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction.tsindex b3ba3db694e..0936182c21b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const CODE_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'CODE'>;icon: string;} = {- defaultLabel: 'Code - Logic Function',+ defaultLabel: msg`Code - Logic Function`,type: 'CODE',icon: 'IconCode',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction.tsindex aaabc37f5d7..bc154314280 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateCalendarEventAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const CREATE_CALENDAR_EVENT_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'CREATE_CALENDAR_EVENT'>;icon: string;} = {- defaultLabel: 'Create Calendar Event',+ defaultLabel: msg`Create Calendar Event`,type: 'CREATE_CALENDAR_EVENT',icon: 'IconCalendarEvent',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction.tsindex c15178ab848..d82489ba847 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const CREATE_RECORD_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'CREATE_RECORD'>;icon: string;} = {- defaultLabel: 'Create Record',+ defaultLabel: msg`Create Record`,type: 'CREATE_RECORD',icon: 'IconPlus',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction.tsindex c0af6983893..ec0a923e034 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DelayAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const DELAY_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'DELAY'>;icon: string;} = {- defaultLabel: 'Delay',+ defaultLabel: msg`Delay`,type: 'DELAY',icon: 'IconPlayerPause',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction.tsindex c916d2011c1..41086ce612f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const DELETE_RECORD_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'DELETE_RECORD'>;icon: string;} = {- defaultLabel: 'Delete Record',+ defaultLabel: msg`Delete Record`,type: 'DELETE_RECORD',icon: 'IconTrash',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction.tsindex 54dc1ebc622..a2107a17513 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/DraftEmailAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const DRAFT_EMAIL_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'DRAFT_EMAIL'>;icon: string;} = {- defaultLabel: 'Draft Email',+ defaultLabel: msg`Draft Email`,type: 'DRAFT_EMAIL',icon: 'IconMailPlus',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction.tsindex b85bb4e7ae6..ccfd87f9fb6 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FilterAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const FILTER_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'FILTER'>;icon: string;} = {- defaultLabel: 'Filter',+ defaultLabel: msg`Filter`,type: 'FILTER',icon: 'IconFilter',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction.tsindex 69ece3f9f05..8b7ad414f58 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FindRecordsAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const FIND_RECORDS_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'FIND_RECORDS'>;icon: string;} = {- defaultLabel: 'Search Records',+ defaultLabel: msg`Search Records`,type: 'FIND_RECORDS',icon: 'IconSearch',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FormAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FormAction.tsindex 94ee7774209..53742b72d8b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FormAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/FormAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const FORM_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'FORM'>;icon: string;} = {- defaultLabel: 'Form',+ defaultLabel: msg`Form`,type: 'FORM',icon: 'IconForms',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/HttpRequestAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/HttpRequestAction.tsindex 15fd8df7618..1509a2aa105 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/HttpRequestAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/HttpRequestAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const HTTP_REQUEST_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'HTTP_REQUEST'>;icon: string;} = {- defaultLabel: 'HTTP Request',+ defaultLabel: msg`HTTP Request`,type: 'HTTP_REQUEST',icon: 'IconWorld',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction.tsindex d930d5d6da4..c8187e1fc54 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IfElseAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const IF_ELSE_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'IF_ELSE'>;icon: string;} = {- defaultLabel: 'If/else',+ defaultLabel: msg`If/else`,type: 'IF_ELSE',icon: 'IconArrowsSplit',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IteratorAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IteratorAction.tsindex abd1b1cface..7e833dbc177 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IteratorAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/IteratorAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const ITERATOR_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'ITERATOR'>;icon: string;} = {- defaultLabel: 'Iterator',+ defaultLabel: msg`Iterator`,type: 'ITERATOR',icon: 'IconRepeat',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/PickRecordAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/PickRecordAction.tsindex a085287de55..3cd8f88b997 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/PickRecordAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/PickRecordAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const PICK_RECORD_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'PICK_RECORD'>;icon: string;} = {- defaultLabel: 'Pick Record',+ defaultLabel: msg`Pick Record`,type: 'PICK_RECORD',icon: 'IconArrowsShuffle',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction.tsindex efe98a0774c..185e8c4ba02 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendChatMessageAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const SEND_CHAT_MESSAGE_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'SEND_CHAT_MESSAGE'>;icon: string;} = {- defaultLabel: 'Send to Inbox',+ defaultLabel: msg`Send to Inbox`,type: 'SEND_CHAT_MESSAGE',icon: 'IconMessage',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction.tsindex 89bbe50cec8..ed80b9dae30 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const SEND_EMAIL_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'SEND_EMAIL'>;icon: string;} = {- defaultLabel: 'Send Email',+ defaultLabel: msg`Send Email`,type: 'SEND_EMAIL',icon: 'IconSend',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction.tsindex 070aef465fb..6038ec7cb0f 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const UPDATE_RECORD_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'UPDATE_RECORD'>;icon: string;} = {- defaultLabel: 'Update Record',+ defaultLabel: msg`Update Record`,type: 'UPDATE_RECORD',icon: 'IconReload',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction.tsindex 1c0b1f33a39..181d6b80d25 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const UPSERT_RECORD_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'UPSERT_RECORD'>;icon: string;} = {- defaultLabel: 'Create or Update Record',+ defaultLabel: msg`Create or Update Record`,type: 'UPSERT_RECORD',icon: 'IconPencilPlus',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction.tsindex b9480a5de0a..0f2cda10960 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/constants/actions/WaitForEventAction.ts@@ -1,11 +1,13 @@import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';export const WAIT_FOR_EVENT_ACTION: {- defaultLabel: string;+ defaultLabel: MessageDescriptor;type: Extract<WorkflowActionType, 'WAIT_FOR_EVENT'>;icon: string;} = {- defaultLabel: 'Wait for Event',+ defaultLabel: msg`Wait for Event`,type: 'WAIT_FOR_EVENT',icon: 'IconHourglass',};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsxindex 473c28b152f..0a56503a710 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx@@ -17,6 +17,7 @@ import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/Workfloimport { WorkflowEditActionFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { styled } from '@linaria/react';@@ -356,7 +357,12 @@ export const WorkflowEditActionFormBuilder = ({)}<StyledFormFieldInputContainerWrapper>- <InputLabel>{field.label || ''}</InputLabel>+ <InputLabel>+ {getFormFieldDisplayText({+ type: field.type,+ text: field.label || '',+ })}+ </InputLabel><FormFieldInputRowContainer><FormFieldInputInnerContainer@@ -371,11 +377,16 @@ export const WorkflowEditActionFormBuilder = ({><StyledPlaceholderContainer><FormFieldPlaceholder>- {isDefined(field.placeholder) &&- isNonEmptyString(field.placeholder)- ? field.placeholder- : getDefaultFormFieldSettings(field.type)- .placeholder}+ {getFormFieldDisplayText({+ type: field.type,+ text:+ isDefined(field.placeholder) &&+ isNonEmptyString(field.placeholder)+ ? field.placeholder+ : getDefaultFormFieldSettings(+ field.type,+ ).placeholder,+ })}</FormFieldPlaceholder></StyledPlaceholderContainer>{(field.type === 'RECORD' ||diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsxindex 4b1a86527f8..5fae9c8a4b7 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx@@ -89,7 +89,10 @@ export const WorkflowEditActionFormFieldSettings = ({<FormFieldInputContainer><InputLabel>{t`Type`}</InputLabel><FormSelectFieldInput- options={FORM_SELECT_FIELD_TYPE_OPTIONS}+ options={FORM_SELECT_FIELD_TYPE_OPTIONS.map((option) => ({+ ...option,+ label: t(option.label),+ }))}onChange={(newType: string | null) => {if (newType === null) {return;diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsDate.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsDate.tsxindex 7ff55e46888..aa88338bd9e 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsDate.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsDate.tsx@@ -3,6 +3,7 @@ import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputConimport { InputLabel } from '@/ui/input/components/internal/InputLabel/InputLabel';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { t } from '@lingui/core/macro';import camelCase from 'lodash.camelcase';import { FieldMetadataType } from 'twenty-shared/types';@@ -28,7 +29,10 @@ export const WorkflowFormFieldSettingsDate = ({});}}defaultValue={field.label}- placeholder={getDefaultFormFieldSettings(FieldMetadataType.DATE).label}+ placeholder={getFormFieldDisplayText({+ type: FieldMetadataType.DATE,+ text: getDefaultFormFieldSettings(FieldMetadataType.DATE).label,+ })}/></FormFieldInputContainer>);diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsxindex f954708beeb..3146af1b230 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx@@ -3,6 +3,7 @@ import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputConimport { InputLabel } from '@/ui/input/components/internal/InputLabel/InputLabel';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import camelCase from 'lodash.camelcase';@@ -37,9 +38,10 @@ export const WorkflowFormFieldSettingsNumber = ({});}}defaultValue={field.label}- placeholder={- getDefaultFormFieldSettings(FieldMetadataType.NUMBER).label- }+ placeholder={getFormFieldDisplayText({+ type: FieldMetadataType.NUMBER,+ text: getDefaultFormFieldSettings(FieldMetadataType.NUMBER).label,+ })}/></FormFieldInputContainer><FormFieldInputContainer>@@ -52,9 +54,11 @@ export const WorkflowFormFieldSettingsNumber = ({});}}defaultValue={field.placeholder}- placeholder={- getDefaultFormFieldSettings(FieldMetadataType.NUMBER).placeholder- }+ placeholder={getFormFieldDisplayText({+ type: FieldMetadataType.NUMBER,+ text: getDefaultFormFieldSettings(FieldMetadataType.NUMBER)+ .placeholder,+ })}/></FormFieldInputContainer></StyledContainer>diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsRecordPicker.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsRecordPicker.tsxindex a579332e537..a583b7dd0cc 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsRecordPicker.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsRecordPicker.tsx@@ -7,6 +7,7 @@ import { InputLabel } from '@/ui/input/components/internal/InputLabel/InputLabelimport { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import camelCase from 'lodash.camelcase';@@ -80,7 +81,10 @@ export const WorkflowFormFieldSettingsRecordPicker = ({});}}defaultValue={field.label}- placeholder={getDefaultFormFieldSettings('RECORD').label}+ placeholder={getFormFieldDisplayText({+ type: 'RECORD',+ text: getDefaultFormFieldSettings('RECORD').label,+ })}/></FormFieldInputContainer></StyledContainer>diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsxindex 9b0b6d78fb6..16763fe3b3b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx@@ -6,6 +6,7 @@ import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputConimport { InputLabel } from '@/ui/input/components/internal/InputLabel/InputLabel';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import camelCase from 'lodash.camelcase';@@ -77,7 +78,10 @@ export const WorkflowFormFieldSettingsSelect = ({});}}defaultValue={field.label}- placeholder={getDefaultFormFieldSettings(field.type).label}+ placeholder={getFormFieldDisplayText({+ type: field.type,+ text: getDefaultFormFieldSettings(field.type).label,+ })}/></FormFieldInputContainer><FormFieldInputContainer>diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsxindex 5f87c4fb031..4ff8264a141 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx@@ -3,6 +3,7 @@ import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputConimport { InputLabel } from '@/ui/input/components/internal/InputLabel/InputLabel';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import camelCase from 'lodash.camelcase';@@ -37,9 +38,10 @@ export const WorkflowFormFieldSettingsText = ({});}}defaultValue={field.label}- placeholder={- getDefaultFormFieldSettings(FieldMetadataType.TEXT).label- }+ placeholder={getFormFieldDisplayText({+ type: FieldMetadataType.TEXT,+ text: getDefaultFormFieldSettings(FieldMetadataType.TEXT).label,+ })}/></FormFieldInputContainer><FormFieldInputContainer>@@ -52,9 +54,11 @@ export const WorkflowFormFieldSettingsText = ({});}}defaultValue={field.placeholder}- placeholder={- getDefaultFormFieldSettings(FieldMetadataType.TEXT).placeholder- }+ placeholder={getFormFieldDisplayText({+ type: FieldMetadataType.TEXT,+ text: getDefaultFormFieldSettings(FieldMetadataType.TEXT)+ .placeholder,+ })}/></FormFieldInputContainer></StyledContainer>diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFields.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFields.tsxindex 82978a98e31..ecc82f3872b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFields.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFields.tsx@@ -4,6 +4,7 @@ import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMimport { WorkflowFormFieldInput } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowFormFieldInput';import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';import { isDefined } from 'twenty-shared/utils';type WorkflowFormFieldsProps = {@@ -31,7 +32,10 @@ export const WorkflowFormFields = ({return (<FormSingleRecordPickerkey={field.name}- label={field.label}+ label={getFormFieldDisplayText({+ type: field.type,+ text: field.label,+ })}defaultValue={field.value?.id}onChange={(recordId) => {onChange(field.name, { id: recordId });@@ -66,7 +70,10 @@ export const WorkflowFormFields = ({<FormFieldInputkey={field.name}field={{- label: field.label,+ label: getFormFieldDisplayText({+ type: field.type,+ text: field.label,+ }),type: field.type,metadata: {} as FieldMetadata,}}@@ -75,10 +82,12 @@ export const WorkflowFormFields = ({}}defaultValue={field.value}readonly={readonly}- placeholder={- field.placeholder ??- getDefaultFormFieldSettings(field.type).placeholder- }+ placeholder={getFormFieldDisplayText({+ type: field.type,+ text:+ field.placeholder ??+ getDefaultFormFieldSettings(field.type).placeholder,+ })}onError={onError}/>);diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormFieldDefaultTexts.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormFieldDefaultTexts.tsnew file mode 100644index 00000000000..9d10d24ae71--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormFieldDefaultTexts.ts@@ -0,0 +1,41 @@+import { type WorkflowFormFieldType } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormFieldType';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { FieldMetadataType } from 'twenty-shared/types';++export const FORM_FIELD_DEFAULT_TEXTS: Array<{+ type: WorkflowFormFieldType;+ text: string;+ message: MessageDescriptor;+}> = [+ { type: FieldMetadataType.TEXT, text: 'Text', message: msg`Text` },+ {+ type: FieldMetadataType.TEXT,+ text: 'Enter your text',+ message: msg`Enter your text`,+ },+ { type: FieldMetadataType.NUMBER, text: 'Number', message: msg`Number` },+ { type: FieldMetadataType.DATE, text: 'Date', message: msg`Date` },+ { type: 'RECORD', text: 'Record', message: msg`Record` },+ {+ type: 'RECORD',+ text: 'Select a Company',+ message: msg`Select a Company`,+ },+ { type: FieldMetadataType.SELECT, text: 'Select', message: msg`Select` },+ {+ type: FieldMetadataType.SELECT,+ text: 'Choose a value',+ message: msg`Choose a value`,+ },+ {+ type: FieldMetadataType.MULTI_SELECT,+ text: 'Multi-Select',+ message: msg`Multi-Select`,+ },+ {+ type: FieldMetadataType.MULTI_SELECT,+ text: 'Choose values',+ message: msg`Choose values`,+ },+];diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormSelectFieldTypeOptions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormSelectFieldTypeOptions.tsindex 2dd2daec1bc..6053c1486c8 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormSelectFieldTypeOptions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/constants/FormSelectFieldTypeOptions.ts@@ -1,7 +1,9 @@import { type WorkflowFormFieldType } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormFieldType';-import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { FieldMetadataType } from 'twenty-shared/types';import {+ type IconComponent,IllustrationIconCalendarEvent,IllustrationIconNumbers,IllustrationIconOneToMany,@@ -9,38 +11,42 @@ import {IllustrationIconTags,IllustrationIconText,} from 'twenty-ui/icon';-import { type SelectOption } from 'twenty-ui/primitives/input';-export const FORM_SELECT_FIELD_TYPE_OPTIONS: SelectOption<WorkflowFormFieldType>[] =- [- {- label: getDefaultFormFieldSettings(FieldMetadataType.TEXT).label,- value: FieldMetadataType.TEXT,- Icon: IllustrationIconText,- },- {- label: getDefaultFormFieldSettings(FieldMetadataType.NUMBER).label,- value: FieldMetadataType.NUMBER,- Icon: IllustrationIconNumbers,- },- {- label: getDefaultFormFieldSettings(FieldMetadataType.DATE).label,- value: FieldMetadataType.DATE,- Icon: IllustrationIconCalendarEvent,- },- {- label: getDefaultFormFieldSettings('RECORD').label,- value: 'RECORD',- Icon: IllustrationIconOneToMany,- },- {- label: 'Select',- value: FieldMetadataType.SELECT,- Icon: IllustrationIconTag,- },- {- label: 'Multi-Select',- value: FieldMetadataType.MULTI_SELECT,- Icon: IllustrationIconTags,- },- ];+type FormSelectFieldTypeOption = {+ label: MessageDescriptor;+ value: WorkflowFormFieldType;+ Icon: IconComponent;+};++export const FORM_SELECT_FIELD_TYPE_OPTIONS: FormSelectFieldTypeOption[] = [+ {+ label: msg`Text`,+ value: FieldMetadataType.TEXT,+ Icon: IllustrationIconText,+ },+ {+ label: msg`Number`,+ value: FieldMetadataType.NUMBER,+ Icon: IllustrationIconNumbers,+ },+ {+ label: msg`Date`,+ value: FieldMetadataType.DATE,+ Icon: IllustrationIconCalendarEvent,+ },+ {+ label: msg`Record`,+ value: 'RECORD',+ Icon: IllustrationIconOneToMany,+ },+ {+ label: msg`Select`,+ value: FieldMetadataType.SELECT,+ Icon: IllustrationIconTag,+ },+ {+ label: msg`Multi-Select`,+ value: FieldMetadataType.MULTI_SELECT,+ Icon: IllustrationIconTags,+ },+];diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/__tests__/getFormFieldDisplayText.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/__tests__/getFormFieldDisplayText.test.tsnew file mode 100644index 00000000000..19c2626dd0d--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/__tests__/getFormFieldDisplayText.test.ts@@ -0,0 +1,79 @@+import { FORM_FIELD_DEFAULT_TEXTS } from '@/workflow/workflow-steps/workflow-actions/form-action/constants/FormFieldDefaultTexts';+import { type WorkflowFormFieldType } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormFieldType';+import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';+import { getFormFieldDisplayText } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText';+import { i18n } from '@lingui/core';+import { FieldMetadataType } from 'twenty-shared/types';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++const getDefaultTextMessageId = (type: WorkflowFormFieldType, text: string) =>+ FORM_FIELD_DEFAULT_TEXTS.find(+ (formFieldDefaultText) =>+ formFieldDefaultText.type === type && formFieldDefaultText.text === text,+ )?.message.id ?? '';++describe('getFormFieldDisplayText', () => {+ beforeEach(() => {+ i18n.load('fr-FR', {+ [getDefaultTextMessageId(FieldMetadataType.TEXT, 'Text')]: 'Texte',+ [getDefaultTextMessageId(FieldMetadataType.TEXT, 'Enter your text')]:+ 'Saisissez votre texte',+ });+ i18n.activate('fr-FR');+ });++ afterEach(() => {+ i18n.activate(SOURCE_LOCALE);+ });++ it('should translate the English default saved for the field type', () => {+ expect(+ getFormFieldDisplayText({ type: FieldMetadataType.TEXT, text: 'Text' }),+ ).toBe('Texte');+ expect(+ getFormFieldDisplayText({+ type: FieldMetadataType.TEXT,+ text: 'Enter your text',+ }),+ ).toBe('Saisissez votre texte');+ });++ it('should keep a text the user typed', () => {+ expect(+ getFormFieldDisplayText({+ type: FieldMetadataType.TEXT,+ text: 'Your company name',+ }),+ ).toBe('Your company name');+ });++ it('should keep a default saved for another field type', () => {+ expect(+ getFormFieldDisplayText({ type: FieldMetadataType.NUMBER, text: 'Text' }),+ ).toBe('Text');+ });++ it('should know every translatable default that getDefaultFormFieldSettings saves', () => {+ const formFieldTypes: WorkflowFormFieldType[] = [+ FieldMetadataType.TEXT,+ FieldMetadataType.NUMBER,+ FieldMetadataType.DATE,+ 'RECORD',+ FieldMetadataType.SELECT,+ FieldMetadataType.MULTI_SELECT,+ ];+ const untranslatedDefaults = ['1000', 'mm/dd/yyyy'];++ for (const formFieldType of formFieldTypes) {+ const { label, placeholder } = getDefaultFormFieldSettings(formFieldType);++ for (const text of [label, placeholder]) {+ if (untranslatedDefaults.includes(text)) {+ continue;+ }++ expect(getDefaultTextMessageId(formFieldType, text)).not.toBe('');+ }+ }+ });+});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText.tsnew file mode 100644index 00000000000..3b6cbf14014--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/utils/getFormFieldDisplayText.ts@@ -0,0 +1,19 @@+import { FORM_FIELD_DEFAULT_TEXTS } from '@/workflow/workflow-steps/workflow-actions/form-action/constants/FormFieldDefaultTexts';+import { type WorkflowFormFieldType } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormFieldType';+import { t } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';++export const getFormFieldDisplayText = ({+ type,+ text,+}: {+ type: WorkflowFormFieldType;+ text: string;+}): string => {+ const defaultText = FORM_FIELD_DEFAULT_TEXTS.find(+ (formFieldDefaultText) =>+ formFieldDefaultText.type === type && formFieldDefaultText.text === text,+ );++ return isDefined(defaultText) ? t(defaultText.message) : text;+};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestExecutionResult.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestExecutionResult.tsxindex 77fe7f14461..e7597670a84 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestExecutionResult.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestExecutionResult.tsx@@ -3,7 +3,8 @@ import {WorkflowStepExecutionResult,} from '@/workflow/components/WorkflowStepExecutionResult';import type { HttpRequestTestData } from '@/workflow/workflow-steps/workflow-actions/http-request-action/types/HttpRequestTestData';-import { t } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { isDefined } from 'twenty-shared/utils';export const HttpRequestExecutionResult = ({httpRequestTestData,@@ -12,8 +13,15 @@ export const HttpRequestExecutionResult = ({httpRequestTestData: HttpRequestTestData;isTesting?: boolean;}) => {- const result =- httpRequestTestData.output.data || httpRequestTestData.output.error || '';+ const { t } = useLingui();++ const hasTestOutput =+ isDefined(httpRequestTestData.output.data) ||+ isDefined(httpRequestTestData.output.error);++ const result = hasTestOutput+ ? httpRequestTestData.output.data || httpRequestTestData.output.error || ''+ : t`Configure your request above, then press "Test"`;const isSuccess =httpRequestTestData.output.status !== undefined &&diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsxindex cd5cea6202e..ef69acc55f1 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx@@ -19,10 +19,7 @@ import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { useEffect } from 'react';import { IconPlayerPlay, IconSettings } from 'twenty-ui/icon';-import {- HTTP_METHODS,- JSON_RESPONSE_PLACEHOLDER,-} from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';+import { HTTP_METHODS } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';import { WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/WorkflowHttpRequestTabListComponentId';import { useHttpRequestForm } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useHttpRequestForm';import { useHttpRequestOutputSchema } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useHttpRequestOutputSchema';@@ -68,6 +65,9 @@ export const WorkflowEditActionHttpRequest = ({actionOptions,}: WorkflowEditActionHttpRequestProps) => {const { t } = useLingui();++ const jsonResponsePlaceholder = `{\n ${t`Paste expected call response here to use its keys later in the workflow`} \n}`;+const theme = useTheme();const activeTabId = useAtomComponentStateValue(activeTabIdComponentState,@@ -164,7 +164,7 @@ export const WorkflowEditActionHttpRequest = ({<FormRawJsonFieldInputlabel={t`Expected Response Body`}- placeholder={JSON_RESPONSE_PLACEHOLDER}+ placeholder={jsonResponsePlaceholder}defaultValue={outputSchema}onChange={handleOutputSchemaChange}readonly={actionOptions.readonly}diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest.tsindex b5fec4e0650..3029f343ad9 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest.ts@@ -2,7 +2,6 @@ const {HTTP_METHODS,METHODS_WITH_BODY,DEFAULT_JSON_BODY_PLACEHOLDER,- JSON_RESPONSE_PLACEHOLDER,DEFAULT_HTTP_REQUEST_OUTPUT_VALUE,BODY_TYPES,} = {@@ -16,10 +15,8 @@ const {METHODS_WITH_BODY: ['POST', 'PUT', 'PATCH'] as const,DEFAULT_JSON_BODY_PLACEHOLDER:'{\n "key": "value"\n "another_key": "{{workflow.variable}}" \n}',- JSON_RESPONSE_PLACEHOLDER:- '{\n Paste expected call response here to use its keys later in the workflow \n}',DEFAULT_HTTP_REQUEST_OUTPUT_VALUE: {- data: 'Configure your request above, then press "Test"',+ data: undefined,status: undefined,statusText: undefined,headers: {},@@ -53,6 +50,5 @@ export {DEFAULT_HTTP_REQUEST_OUTPUT_VALUE,DEFAULT_JSON_BODY_PLACEHOLDER,HTTP_METHODS,- JSON_RESPONSE_PLACEHOLDER,METHODS_WITH_BODY,};diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsxindex 571ac06a5b0..f3957fd31bd 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx@@ -66,7 +66,10 @@ export const WorkflowEditTriggerCronForm = ({label={t`Trigger interval`}hint={t`Cron will be triggered at UTC time`}defaultValue={trigger.settings.type}- options={CRON_TRIGGER_INTERVAL_OPTIONS}+ options={CRON_TRIGGER_INTERVAL_OPTIONS.map((option) => ({+ ...option,+ label: t(option.label),+ }))}readonly={triggerOptions.readonly}onChange={(newTriggerType) => {if (triggerOptions.readonly === true) {diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerManual.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerManual.tsxindex 7cd53ac00c0..e48a87db5ca 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerManual.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerManual.tsx@@ -95,7 +95,10 @@ export const WorkflowEditTriggerManual = ({fullWidthdisabled={triggerOptions.readonly}value={availability?.type}- options={MANUAL_TRIGGER_AVAILABILITY_TYPE_OPTIONS}+ options={MANUAL_TRIGGER_AVAILABILITY_TYPE_OPTIONS.map((option) => ({+ ...option,+ label: t(option.label),+ }))}onChange={(availabilityType) => {if (triggerOptions.readonly === true) {return;@@ -202,7 +205,10 @@ export const WorkflowEditTriggerManual = ({description={t`Display a button in the top navbar to trigger this workflow`}fullWidthvalue={trigger.settings.isPinned}- options={MANUAL_TRIGGER_IS_PINNED_OPTIONS}+ options={MANUAL_TRIGGER_IS_PINNED_OPTIONS.map((option) => ({+ ...option,+ label: t(option.label),+ }))}disabled={triggerOptions.readonly}onChange={(updatedValue) => {if (triggerOptions.readonly === true) {diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsxindex c0dae882877..c05a36011a2 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx@@ -18,7 +18,7 @@ import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';import { getOutputSchemaFromValue } from 'twenty-shared/logic-function';import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';-import { t } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';import { IconCopy } from 'twenty-ui/icon';import { useDebouncedCallback } from 'use-debounce';@@ -50,6 +50,7 @@ export const WorkflowEditTriggerWebhookForm = ({trigger,triggerOptions,}: WorkflowEditTriggerWebhookFormProps) => {+ const { t } = useLingui();const theme = useTheme();const { copyToClipboard } = useCopyToClipboard();const [errorMessages, setErrorMessages] = useState<FormErrorMessages>({});@@ -175,7 +176,12 @@ export const WorkflowEditTriggerWebhookForm = ({fullWidthdisabledvalue={trigger.settings.authentication}- options={WEBHOOK_TRIGGER_AUTHENTICATION_OPTIONS}+ options={WEBHOOK_TRIGGER_AUTHENTICATION_OPTIONS.map(+ (authenticationOption) => ({+ ...authenticationOption,+ label: t(authenticationOption.label),+ }),+ )}onChange={(newAuthenticationType) => {if (triggerOptions.readonly === true) {return;diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/CronTriggerIntervalOptions.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/CronTriggerIntervalOptions.tsindex efd1dd64038..5f60237f314 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/CronTriggerIntervalOptions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/CronTriggerIntervalOptions.ts@@ -1,3 +1,5 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import {IconClockPlay,type IconComponent,@@ -8,27 +10,27 @@ import {export type CronTriggerInterval = 'DAYS' | 'HOURS' | 'MINUTES' | 'CUSTOM';export const CRON_TRIGGER_INTERVAL_OPTIONS: Array<{- label: string;+ label: MessageDescriptor;value: CronTriggerInterval;Icon: IconComponent;}> = [{- label: 'Days',+ label: msg`Days`,value: 'DAYS',Icon: IconBrandDaysCounter,},{- label: 'Hours',+ label: msg`Hours`,value: 'HOURS',Icon: IconHours24,},{- label: 'Minutes',+ label: msg`Minutes`,value: 'MINUTES',Icon: IconTimeDuration60,},{- label: 'Cron (Custom)',+ label: msg`Cron (Custom)`,value: 'CUSTOM',Icon: IconClockPlay,},diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerAvailabilityTypeOptions.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerAvailabilityTypeOptions.tsindex d3ff2b85db2..942449df201 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerAvailabilityTypeOptions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerAvailabilityTypeOptions.ts@@ -1,3 +1,5 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import {IconCheckbox,type IconComponent,@@ -6,22 +8,22 @@ import {} from 'twenty-ui/icon';export const MANUAL_TRIGGER_AVAILABILITY_TYPE_OPTIONS: Array<{- label: string;+ label: MessageDescriptor;value: 'GLOBAL' | 'SINGLE_RECORD' | 'BULK_RECORDS';Icon: IconComponent;}> = [{- label: 'Global',+ label: msg`Global`,value: 'GLOBAL',Icon: IconCheckbox,},{- label: 'Single',+ label: msg`Single`,value: 'SINGLE_RECORD',Icon: IconId,},{- label: 'Bulk',+ label: msg`Bulk`,value: 'BULK_RECORDS',Icon: IconListDetails,},diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerIsPinnedOptions.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerIsPinnedOptions.tsindex 34e09887629..0ae9abb93a8 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerIsPinnedOptions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/ManualTriggerIsPinnedOptions.ts@@ -1,17 +1,19 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { type IconComponent, IconPinned, IconPinnedOff } from 'twenty-ui/icon';export const MANUAL_TRIGGER_IS_PINNED_OPTIONS: Array<{- label: string;+ label: MessageDescriptor;value: boolean;Icon: IconComponent;}> = [{- label: 'Not Pinned',+ label: msg`Not Pinned`,value: false,Icon: IconPinnedOff,},{- label: 'Pinned',+ label: msg`Pinned`,value: true,Icon: IconPinned,},diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/WebhookTriggerAuthenticationOptions.ts b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/WebhookTriggerAuthenticationOptions.tsindex c501235f56c..ec72ca8a085 100644--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/WebhookTriggerAuthenticationOptions.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/constants/WebhookTriggerAuthenticationOptions.ts@@ -1,18 +1,20 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';import { type IconComponent, IconKey, IconLockOpen } from 'twenty-ui/icon';export type AuthenticationMethods = 'API_KEY' | null;export const WEBHOOK_TRIGGER_AUTHENTICATION_OPTIONS: Array<{- label: string;+ label: MessageDescriptor;value: AuthenticationMethods;Icon: IconComponent;}> = [{- label: 'None',+ label: msg`None`,value: null,Icon: IconLockOpen,},{- label: 'API key',+ label: msg`API key`,value: 'API_KEY',Icon: IconKey,},diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/constants/WorkflowPersistedOutputSchemaLabels.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/constants/WorkflowPersistedOutputSchemaLabels.tsnew file mode 100644index 00000000000..a952c7b7798--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/constants/WorkflowPersistedOutputSchemaLabels.ts@@ -0,0 +1,35 @@+import { type WorkflowActionType } from '@/workflow/types/Workflow';+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';++export const WORKFLOW_PERSISTED_OUTPUT_SCHEMA_LABELS: Array<{+ stepType: WorkflowActionType;+ key: string;+ label: string;+ message: MessageDescriptor;+}> = [+ {+ stepType: 'ITERATOR',+ key: 'currentItem',+ label: 'Current Item',+ message: msg`Current Item`,+ },+ {+ stepType: 'ITERATOR',+ key: 'currentItemIndex',+ label: 'Current Item Index',+ message: msg`Current Item Index`,+ },+ {+ stepType: 'ITERATOR',+ key: 'hasProcessedAllItems',+ label: 'Has Processed All Items',+ message: msg`Has Processed All Items`,+ },+ {+ stepType: 'AI_AGENT',+ key: 'response',+ label: 'Response',+ message: msg`Response`,+ },+];diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/__tests__/useStepsOutputSchema.test.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/__tests__/useStepsOutputSchema.test.tsxindex d34fd071b0f..5003880ac08 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/__tests__/useStepsOutputSchema.test.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/__tests__/useStepsOutputSchema.test.tsx@@ -1,6 +1,9 @@+import { i18n } from '@lingui/core';+import { I18nProvider } from '@lingui/react';import { act, renderHook, waitFor } from '@testing-library/react';import { createStore, Provider } from 'jotai';import { type ReactNode } from 'react';+import { SOURCE_LOCALE } from 'twenty-shared/translations';import { type WorkflowVersion } from '@/workflow/types/Workflow';import { getStepOutputSchemaFamilyStateKey } from '@/workflow/utils/getStepOutputSchemaFamilyStateKey';import { useStepsOutputSchema } from '@/workflow/workflow-variables/hooks/useStepsOutputSchema';@@ -50,7 +53,9 @@ const outputSchema = {const renderSchemas = () => {const store = createStore();const wrapper = ({ children }: { children: ReactNode }) => (- <Provider store={store}>{children}</Provider>+ <I18nProvider i18n={i18n}>+ <Provider store={store}>{children}</Provider>+ </I18nProvider>);const hook = renderHook(() => useStepsOutputSchema(), { wrapper });const schemaState = stepsOutputSchemaFamilyState.atomFamily(@@ -62,6 +67,10 @@ const renderSchemas = () => {describe('core iterator output schema', () => {beforeEach(() => jest.clearAllMocks());+ afterEach(() => {+ act(() => i18n.activate(SOURCE_LOCALE));+ });+it('computes the iterator schema with the core version context', async () => {mockMutate.mockResolvedValue({data: { computeStepOutputSchema: outputSchema },@@ -103,4 +112,25 @@ describe('core iterator output schema', () => {});expect(store.get(schemaState)).toBeNull();});++ it('recomputes a cached schema after the locale changes', async () => {+ mockMutate.mockResolvedValue({+ data: { computeStepOutputSchema: outputSchema },+ });+ const { result, store, schemaState } = renderSchemas();+ act(() => result.current.populateStepsOutputSchema(version));+ await waitFor(() => expect(mockMutate).toHaveBeenCalledTimes(1));++ act(() => result.current.populateStepsOutputSchema(version));+ expect(mockMutate).toHaveBeenCalledTimes(1);++ i18n.load('fr-FR', {});+ act(() => i18n.activate('fr-FR'));+ act(() => result.current.populateStepsOutputSchema(version));++ await waitFor(() => expect(mockMutate).toHaveBeenCalledTimes(2));+ await waitFor(() =>+ expect(store.get(schemaState)?.outputSchema).toEqual(outputSchema),+ );+ });});diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useStepsOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useStepsOutputSchema.tsindex 0ed6c6786b0..d3068eeba8e 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useStepsOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useStepsOutputSchema.ts@@ -3,11 +3,13 @@ import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClientimport { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';import { type WorkflowVersion } from '@/workflow/types/Workflow';import { getStepOutputSchemaFamilyStateKey } from '@/workflow/utils/getStepOutputSchemaFamilyStateKey';+import { getWorkflowStepDisplayName } from '@/workflow/utils/getWorkflowStepDisplayName';import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon';import { getTriggerDefaultLabel } from '@/workflow/workflow-trigger/utils/getTriggerDefaultLabel';import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon';import { shouldRecomputeOutputSchemaFamilyState } from '@/workflow/workflow-variables/states/shouldRecomputeOutputSchemaFamilyState';import { stepsOutputSchemaFamilyState } from '@/workflow/workflow-variables/states/stepsOutputSchemaFamilyState';+import { stepsOutputSchemaLocaleFamilyState } from '@/workflow/workflow-variables/states/stepsOutputSchemaLocaleFamilyState';import {type OutputSchemaV2,type StepOutputSchemaV2,@@ -17,6 +19,8 @@ import {shouldComputeOutputSchemaOnFrontend,} from '@/workflow/workflow-variables/utils/generate/computeStepOutputSchema';import { resolvePersistedStepOutputSchema } from '@/workflow/workflow-variables/utils/resolvePersistedStepOutputSchema';+import { translatePersistedOutputSchemaLabels } from '@/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels';+import { useLingui } from '@lingui/react/macro';import { useStore } from 'jotai';import { useCallback } from 'react';import { isDefined } from 'twenty-shared/utils';@@ -28,10 +32,16 @@ export const useStepsOutputSchema = () => {const store = useStore();const client = useApolloCoreClient();const { enqueueToast } = useToast();+ const { i18n } = useLingui();const populateStepsOutputSchema = useCallback((workflowVersion: WorkflowVersion) => {const objectMetadataItems = store.get(objectMetadataItemsSelector.atom);+ const locale = i18n.locale;++ const isComputedInLocale = (stepKey: string) =>+ store.get(stepsOutputSchemaLocaleFamilyState.atomFamily(stepKey)) ===+ locale;workflowVersion.steps?.forEach((step) => {const stepKey = getStepOutputSchemaFamilyStateKey(@@ -47,7 +57,7 @@ export const useStepsOutputSchema = () => {step.type,);- if (!shouldRecompute) {+ if (!shouldRecompute && isComputedInLocale(stepKey)) {return;}@@ -63,7 +73,10 @@ export const useStepsOutputSchema = () => {const stepOutputSchema: StepOutputSchemaV2 = {id: step.id,- name: step.name,+ name: getWorkflowStepDisplayName({+ name: step.name,+ type: step.type,+ }),type: step.type,icon: getActionIcon(step.type),outputSchema: (outputSchema ?? {}) as OutputSchemaV2,@@ -75,6 +88,10 @@ export const useStepsOutputSchema = () => {stepsOutputSchemaFamilyState.atomFamily(stepKey),stepOutputSchema,);+ store.set(+ stepsOutputSchemaLocaleFamilyState.atomFamily(stepKey),+ locale,+ );store.set(shouldRecomputeOutputSchemaFamilyState.atomFamily(stepKey),false,@@ -96,7 +113,13 @@ export const useStepsOutputSchema = () => {store.get(schemaState) === stepOutputSchema &&isBaseOutputSchemaV2(outputSchema)) {- store.set(schemaState, { ...stepOutputSchema, outputSchema });+ store.set(schemaState, {+ ...stepOutputSchema,+ outputSchema: translatePersistedOutputSchemaLabels({+ stepType: step.type,+ outputSchema,+ }),+ });}}).catch((error: Error) => {@@ -121,7 +144,7 @@ export const useStepsOutputSchema = () => {trigger.type,);- if (!shouldRecompute) {+ if (!shouldRecompute && isComputedInLocale(triggerKey)) {return;}@@ -139,9 +162,12 @@ export const useStepsOutputSchema = () => {const triggerOutputSchema: StepOutputSchemaV2 = {id: TRIGGER_STEP_ID,- name: isDefined(trigger.name)- ? trigger.name- : getTriggerDefaultLabel(trigger),+ name: getWorkflowStepDisplayName({+ name: isDefined(trigger.name)+ ? trigger.name+ : getTriggerDefaultLabel(trigger),+ type: trigger.type,+ }),type: trigger.type,icon: triggerIconKey,outputSchema: (outputSchema ?? {}) as OutputSchemaV2,@@ -151,13 +177,17 @@ export const useStepsOutputSchema = () => {stepsOutputSchemaFamilyState.atomFamily(triggerKey),triggerOutputSchema,);+ store.set(+ stepsOutputSchemaLocaleFamilyState.atomFamily(triggerKey),+ locale,+ );store.set(shouldRecomputeOutputSchemaFamilyState.atomFamily(triggerKey),false,);}},- [store, client, enqueueToast],+ [store, client, enqueueToast, i18n.locale],);const markStepForRecomputation = useCallback(diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaLocaleFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaLocaleFamilyState.tsnew file mode 100644index 00000000000..9ad49a0c81b--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaLocaleFamilyState.ts@@ -0,0 +1,9 @@+import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState';++export const stepsOutputSchemaLocaleFamilyState = createAtomFamilyState<+ string | null,+ string | undefined+>({+ key: 'stepsOutputSchemaLocaleFamilyState',+ defaultValue: null,+});diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/translatePersistedOutputSchemaLabels.test.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/translatePersistedOutputSchemaLabels.test.tsnew file mode 100644index 00000000000..5ff7675386c--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/__tests__/translatePersistedOutputSchemaLabels.test.ts@@ -0,0 +1,124 @@+import { WORKFLOW_PERSISTED_OUTPUT_SCHEMA_LABELS } from '@/workflow/workflow-variables/constants/WorkflowPersistedOutputSchemaLabels';+import { translatePersistedOutputSchemaLabels } from '@/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels';+import { i18n } from '@lingui/core';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++const getPersistedLabelMessageId = (key: string) =>+ WORKFLOW_PERSISTED_OUTPUT_SCHEMA_LABELS.find(+ (persistedLabel) => persistedLabel.key === key,+ )?.message.id ?? '';++describe('translatePersistedOutputSchemaLabels', () => {+ beforeEach(() => {+ i18n.load('fr-FR', {+ [getPersistedLabelMessageId('currentItemIndex')]:+ "Index de l'élément courant",+ [getPersistedLabelMessageId('response')]: 'Réponse',+ });+ i18n.activate('fr-FR');+ });++ afterEach(() => {+ i18n.activate(SOURCE_LOCALE);+ });++ it('should translate the labels Twenty writes in English', () => {+ expect(+ translatePersistedOutputSchemaLabels({+ stepType: 'ITERATOR',+ outputSchema: {+ currentItemIndex: {+ isLeaf: true,+ type: 'number',+ label: 'Current Item Index',+ value: 0,+ },+ },+ }),+ ).toEqual({+ currentItemIndex: {+ isLeaf: true,+ type: 'number',+ label: "Index de l'élément courant",+ value: 0,+ },+ });+ });++ it('should keep a user-defined key that carries a label Twenty writes', () => {+ const outputSchema = {+ Response: {+ isLeaf: true as const,+ type: 'string' as const,+ label: 'Response',+ value: '',+ },+ };++ expect(+ translatePersistedOutputSchemaLabels({+ stepType: 'AI_AGENT',+ outputSchema,+ }),+ ).toEqual(outputSchema);+ });++ it('should keep a label Twenty writes for another step type', () => {+ const outputSchema = {+ response: {+ isLeaf: true as const,+ type: 'string' as const,+ label: 'Response',+ value: '',+ },+ };++ expect(+ translatePersistedOutputSchemaLabels({+ stepType: 'CODE',+ outputSchema,+ }),+ ).toEqual(outputSchema);+ });++ it('should keep labels it does not know', () => {+ const outputSchema = {+ constructor: {+ isLeaf: true as const,+ type: 'string' as const,+ label: 'constructor',+ value: '',+ },+ total: {+ isLeaf: true as const,+ type: 'number' as const,+ label: 'Total',+ value: 0,+ },+ };++ expect(+ translatePersistedOutputSchemaLabels({+ stepType: 'ITERATOR',+ outputSchema,+ }),+ ).toEqual(outputSchema);+ });++ it('should keep a __proto__ key as an own key', () => {+ const outputSchema = JSON.parse(+ '{"__proto__":{"isLeaf":true,"type":"string","label":"Proto","value":""}}',+ );++ const translatedOutputSchema = translatePersistedOutputSchemaLabels({+ stepType: 'CODE',+ outputSchema,+ });++ expect(Object.keys(translatedOutputSchema)).toEqual(['__proto__']);+ expect(+ Object.getOwnPropertyDescriptor(translatedOutputSchema, '__proto__')+ ?.value,+ ).toEqual({ isLeaf: true, type: 'string', label: 'Proto', value: '' });+ });+});diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.tsindex 70a03ab262e..f18f4a094fa 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts@@ -220,7 +220,7 @@ describe('computeStepOutputSchema', () => {workspaceMemberId: {isLeaf: true,type: 'string',- label: 'Workspace Member Id',+ label: 'Workspace Member ID',},},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.tsindex 1c97b820207..de026c08c10 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts@@ -11,14 +11,15 @@ import { generateFormOutputSchema } from '@/workflow/workflow-variables/utils/geimport { generateRecordEventOutputSchema } from '@/workflow/workflow-variables/utils/generate/generateRecordEventOutputSchema';import { generateRecordOutputSchema } from '@/workflow/workflow-variables/utils/generate/generateRecordOutputSchema';import { generateWaitForEventOutputSchema } from '@/workflow/workflow-variables/utils/generate/generateWaitForEventOutputSchema';+import { t } from '@lingui/core/macro';import { FieldMetadataType } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';import {buildManualTriggerMetadataNode,+ type Node,WORKFLOW_TRIGGER_METADATA_KEY,+ WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_KEY,WORKFLOW_TRIGGER_PAYLOAD_KEY,- WORKFLOW_TRIGGER_RECORD_LABEL,- WORKFLOW_TRIGGER_RECORDS_LABEL,} from 'twenty-shared/workflow';import { DatabaseEventAction } from '~/generated-metadata/graphql';@@ -63,6 +64,24 @@ const parseEventName = (return { objectName, action };};+const buildTranslatedMetadataNode = (): Node => {+ const metadataNode = buildManualTriggerMetadataNode();++ return {+ ...metadataNode,+ label: t`Metadata`,+ value: {+ ...metadataNode.value,+ [WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_KEY]: {+ ...metadataNode.value[+ WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_KEY+ ],+ label: t`Workspace Member ID`,+ },+ },+ };+};+export const computeStepOutputSchema = ({step,objectMetadataItems,@@ -111,7 +130,7 @@ export const computeStepOutputSchema = ({if (availability.type === 'GLOBAL') {return {- [WORKFLOW_TRIGGER_METADATA_KEY]: buildManualTriggerMetadataNode(),+ [WORKFLOW_TRIGGER_METADATA_KEY]: buildTranslatedMetadataNode(),};}@@ -133,28 +152,30 @@ export const computeStepOutputSchema = ({[WORKFLOW_TRIGGER_PAYLOAD_KEY]: {isLeaf: false,icon: objectMetadataItem.icon ?? undefined,- label: WORKFLOW_TRIGGER_RECORD_LABEL,+ label: t`Record`,value: generateRecordOutputSchema(objectMetadataItem),},- [WORKFLOW_TRIGGER_METADATA_KEY]: buildManualTriggerMetadataNode(),+ [WORKFLOW_TRIGGER_METADATA_KEY]: buildTranslatedMetadataNode(),};}+ const objectLabelPlural = objectMetadataItem.labelPlural;+return {[WORKFLOW_TRIGGER_PAYLOAD_KEY]: {isLeaf: false,type: 'object',- label: WORKFLOW_TRIGGER_RECORDS_LABEL,+ label: t`Records`,value: {[objectMetadataItem.namePlural]: {isLeaf: true,- label: objectMetadataItem.labelPlural,+ label: objectLabelPlural,type: 'array',- value: `Array of ${objectMetadataItem.labelPlural}`,+ value: t`Array of ${objectLabelPlural}`,},},},- [WORKFLOW_TRIGGER_METADATA_KEY]: buildManualTriggerMetadataNode(),+ [WORKFLOW_TRIGGER_METADATA_KEY]: buildTranslatedMetadataNode(),};}@@ -224,7 +245,7 @@ export const computeStepOutputSchema = ({threadId: {isLeaf: true,type: FieldMetadataType.UUID,- label: 'Conversation ID',+ label: t`Conversation ID`,value: '',},};@@ -238,37 +259,37 @@ export const computeStepOutputSchema = ({outcome: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Outcome',+ label: t`Outcome`,value: 'executed',},toolName: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Action',+ label: t`Action`,value: '',},feedback: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Feedback',+ label: t`Feedback`,value: '',},error: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Error',+ label: t`Error`,value: '',},arguments: {isLeaf: true,type: FieldMetadataType.RAW_JSON,- label: 'Arguments',+ label: t`Arguments`,value: null,},output: {isLeaf: true,type: FieldMetadataType.RAW_JSON,- label: 'Output',+ label: t`Output`,value: null,},};@@ -279,25 +300,25 @@ export const computeStepOutputSchema = ({success: {isLeaf: true,type: FieldMetadataType.BOOLEAN,- label: 'Success',+ label: t`Success`,value: true,},headerMessageId: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Message-ID header',+ label: t`Message-ID header`,value: '',},messageId: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Message record ID',+ label: t`Message record ID`,value: '',},messageThreadId: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Message thread ID',+ label: t`Message thread ID`,value: '',},};@@ -308,7 +329,7 @@ export const computeStepOutputSchema = ({success: {isLeaf: true,type: FieldMetadataType.BOOLEAN,- label: 'Success',+ label: t`Success`,value: true,},};@@ -319,25 +340,25 @@ export const computeStepOutputSchema = ({success: {isLeaf: true,type: FieldMetadataType.BOOLEAN,- label: 'Success',+ label: t`Success`,value: true,},iCalUid: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'iCal UID',+ label: t`iCal UID`,value: '',},externalEventId: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'External Event ID',+ label: t`External Event ID`,value: '',},conferenceLink: {isLeaf: true,type: FieldMetadataType.TEXT,- label: 'Conference Link',+ label: t`Conference Link`,value: '',},};diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateClassifyOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateClassifyOutputSchema.tsindex 90ecba57096..b8563fd7f86 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateClassifyOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateClassifyOutputSchema.ts@@ -1,3 +1,4 @@+import { t } from '@lingui/core/macro';import { isNonEmptyString } from '@sniptt/guards';import {@@ -9,7 +10,7 @@ import {const buildProbabilitiesNode = (keys: string[]): Node => ({isLeaf: false,type: 'object',- label: 'Probabilities',+ label: t`Probabilities`,value: Object.fromEntries(keys.map((key) => [key,@@ -30,7 +31,7 @@ const buildAnswerSchema = (type: {isLeaf: true,type: 'string',- label: 'Type',+ label: t`Type`,value: question.type,},};@@ -42,7 +43,7 @@ const buildAnswerSchema = (choice: {isLeaf: true,type: 'string',- label: 'Choice',+ label: t`Choice`,value: question.criteria[0]?.name ?? '',},probabilities: buildProbabilitiesNode(@@ -57,7 +58,7 @@ const buildAnswerSchema = (score: {isLeaf: true,type: 'number',- label: 'Score',+ label: t`Score`,value: 0,},// Native scores carry a distribution over level indices, advertised like a choice's@@ -71,7 +72,7 @@ const buildAnswerSchema = (probability: {isLeaf: true,type: 'number',- label: 'Probability of true',+ label: t`Probability of true`,value: 0,},};@@ -85,7 +86,7 @@ export const generateClassifyOutputSchema = (answers: {isLeaf: false,type: 'object',- label: 'Answers',+ label: t`Answers`,value: Object.fromEntries(questions.filter((question) => isNonEmptyString(question.name))@@ -103,7 +104,7 @@ export const generateClassifyOutputSchema = (modelId: {isLeaf: true,type: 'string',- label: 'Model',+ label: t`Model`,value: '',},});diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateFindRecordsOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateFindRecordsOutputSchema.tsindex 07f2b312a39..cbe67893ad1 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateFindRecordsOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateFindRecordsOutputSchema.ts@@ -1,32 +1,35 @@import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { type FindRecordsOutputSchema } from '@/workflow/workflow-variables/types/FindRecordsOutputSchema';import { generateRecordOutputSchema } from '@/workflow/workflow-variables/utils/generate/generateRecordOutputSchema';+import { t } from '@lingui/core/macro';export const generateFindRecordsOutputSchema = (objectMetadataItem: EnrichedObjectMetadataItem,): FindRecordsOutputSchema => {const recordOutputSchema = generateRecordOutputSchema(objectMetadataItem);+ const objectLabelSingular = objectMetadataItem.labelSingular ?? t`Record`;+ const objectLabelPlural = objectMetadataItem.labelPlural ?? t`Records`;return {first: {isLeaf: false,icon: 'IconAlpha',- label: `First ${objectMetadataItem.labelSingular ?? 'Record'}`,+ label: t`First ${objectLabelSingular}`,value: recordOutputSchema,},all: {isLeaf: true,icon: 'IconListDetails',- label: `All ${objectMetadataItem.labelPlural ?? 'Records'}`,+ label: t`All ${objectLabelPlural}`,type: 'array',- value: 'Returns an array of records',+ value: t`Returns an array of records`,},totalCount: {isLeaf: true,icon: 'IconSum',- label: 'Total Count',+ label: t`Total Count`,type: 'number',- value: 'Count of matching records',+ value: t`Count of matching records`,},};};diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateWaitForEventOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateWaitForEventOutputSchema.tsindex df80eb32aef..14422042020 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateWaitForEventOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/generateWaitForEventOutputSchema.ts@@ -1,6 +1,7 @@import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { type WaitForEventOutputSchema } from '@/workflow/workflow-variables/types/WaitForEventOutputSchema';import { generateRecordOutputSchema } from '@/workflow/workflow-variables/utils/generate/generateRecordOutputSchema';+import { t } from '@lingui/core/macro';import { DatabaseEventAction } from '~/generated-metadata/graphql';export const generateWaitForEventOutputSchema = (@@ -18,14 +19,14 @@ export const generateWaitForEventOutputSchema = (isLeaf: true,icon: 'IconId',type: 'string',- label: 'Record ID',+ label: t`Record ID`,value: '',},hasTimedOut: {isLeaf: true,icon: 'IconClockX',type: 'boolean',- label: 'Has Timed Out',+ label: t`Has Timed Out`,value: false,},};@@ -37,19 +38,21 @@ export const generateWaitForEventOutputSchema = (return outputSchema;}+ const objectLabelSingular = objectMetadataItem.labelSingular;+return {...outputSchema,before: {isLeaf: false,icon: 'IconHistory',- label: `${objectMetadataItem.labelSingular} Before Update`,+ label: t`${objectLabelSingular} Before Update`,value: generateRecordOutputSchema(objectMetadataItem),},updatedFields: {isLeaf: true,icon: 'IconListDetails',type: 'array',- label: 'Updated Fields',+ label: t`Updated Fields`,value: [],},};diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/resolvePersistedStepOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/resolvePersistedStepOutputSchema.tsindex 9e230d44ffb..52e76214e7b 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/resolvePersistedStepOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/resolvePersistedStepOutputSchema.ts@@ -1,9 +1,13 @@import { type OutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2';+import { translatePersistedOutputSchemaLabels } from '@/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels';import { getOutputSchemaFromValue } from 'twenty-shared/logic-function';import { isEmptyObject, isPlainObject } from 'twenty-shared/utils';-import { isBaseOutputSchemaV2 } from 'twenty-shared/workflow';+import {+ type BaseOutputSchemaV2,+ isBaseOutputSchemaV2,+} from 'twenty-shared/workflow';-const AI_AGENT_DEFAULT_OUTPUT_SCHEMA: OutputSchemaV2 = {+const AI_AGENT_DEFAULT_OUTPUT_SCHEMA: BaseOutputSchemaV2 = {response: {isLeaf: true,type: 'string',@@ -25,7 +29,7 @@ export const resolvePersistedStepOutputSchema = ({const outputSchema = settings?.outputSchema;if (isBaseOutputSchemaV2(outputSchema)) {- return outputSchema;+ return translatePersistedOutputSchemaLabels({ stepType, outputSchema });}const expectedOutputSchema = settings?.expectedOutputSchema;@@ -38,7 +42,10 @@ export const resolvePersistedStepOutputSchema = ({}if (stepType === 'AI_AGENT') {- return AI_AGENT_DEFAULT_OUTPUT_SCHEMA;+ return translatePersistedOutputSchemaLabels({+ stepType,+ outputSchema: AI_AGENT_DEFAULT_OUTPUT_SCHEMA,+ });}return {};diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels.tsnew file mode 100644index 00000000000..cb8ab4ad4a4--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/translatePersistedOutputSchemaLabels.ts@@ -0,0 +1,52 @@+import { WORKFLOW_PERSISTED_OUTPUT_SCHEMA_LABELS } from '@/workflow/workflow-variables/constants/WorkflowPersistedOutputSchemaLabels';+import { t } from '@lingui/core/macro';+import { isDefined } from 'twenty-shared/utils';+import { type BaseOutputSchemaV2 } from 'twenty-shared/workflow';++const CURRENT_ITEM_OF_OBJECT_LABEL_PATTERN = /^Current Item \((.+)\)$/;++const translatePersistedLabel = ({+ stepType,+ key,+ label,+}: {+ stepType: string;+ key: string;+ label: string;+}): string => {+ const persistedLabel = WORKFLOW_PERSISTED_OUTPUT_SCHEMA_LABELS.find(+ (persistedLabel) =>+ persistedLabel.stepType === stepType &&+ persistedLabel.key === key &&+ persistedLabel.label === label,+ );++ if (isDefined(persistedLabel)) {+ return t(persistedLabel.message);+ }++ if (stepType !== 'ITERATOR' || key !== 'currentItem') {+ return label;+ }++ const objectLabel = CURRENT_ITEM_OF_OBJECT_LABEL_PATTERN.exec(label)?.[1];++ return isDefined(objectLabel) ? t`Current Item (${objectLabel})` : label;+};++export const translatePersistedOutputSchemaLabels = ({+ stepType,+ outputSchema,+}: {+ stepType: string;+ outputSchema: BaseOutputSchemaV2;+}): BaseOutputSchemaV2 =>+ Object.fromEntries(+ Object.entries(outputSchema).map(([key, node]) => [+ key,+ {+ ...node,+ label: translatePersistedLabel({ stepType, key, label: node.label }),+ },+ ]),+ );diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsxindex ede3adc6930..ac02c85ec85 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx@@ -59,6 +59,7 @@ import { hasApplicationUpdate } from '~/pages/settings/applications/utils/hasAppimport { isUuidFormat } from '~/pages/settings/applications/utils/isUuidFormat';import { getDisplayedApplicationVariables } from '~/pages/settings/applications/utils/getDisplayedApplicationVariables';import { getMissingRequiredApplicationVariables } from '~/pages/settings/applications/utils/getMissingRequiredApplicationVariables';+import { getSettingsMenuItemDisplayTitle } from '~/pages/settings/applications/utils/getSettingsMenuItemDisplayTitle';import { getWorkspaceSettingsMenuItems } from '~/pages/settings/applications/utils/getWorkspaceSettingsMenuItems';const APPLICATION_DETAIL_ID = 'application-detail-id';@@ -221,7 +222,11 @@ export const SettingsApplicationDetails = () => {: []),...workspaceSettingsMenuItems.map((settingsMenuItem) => ({id: settingsMenuItem.universalIdentifier,- title: settingsMenuItem.title,+ title: getSettingsMenuItemDisplayTitle({+ applicationUniversalIdentifier: application?.universalIdentifier ?? '',+ frontComponents: application?.frontComponents ?? [],+ settingsMenuItem,+ }),Icon: getIcon(settingsMenuItem.icon, 'IconAdjustments'),})),];diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsxindex 5772f96f1fc..3ba7c031a87 100644--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx@@ -141,7 +141,7 @@ export const SettingsApplicationRegistrationGeneralInfo = ({tarballUrlData?.applicationRegistrationTarballUrl,) ? (<StyledSourceRow>- <span>Tarball</span>+ <span>{t`Tarball`}</span><StyledDownloadLinkhref={tarballUrlData.applicationRegistrationTarballUrl}download@@ -150,7 +150,7 @@ export const SettingsApplicationRegistrationGeneralInfo = ({</StyledDownloadLink></StyledSourceRow>) : (- 'Tarball'+ t`Tarball`),});break;@@ -158,7 +158,7 @@ export const SettingsApplicationRegistrationGeneralInfo = ({items.push({Icon: IconBox,label: t`Source`,- value: 'Local',+ value: t`Local`,});break;case ApplicationRegistrationSourceType.OAUTH_ONLY:diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsInput.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsInput.tsxindex 379974fc56f..84c0ec3ff02 100644--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsInput.tsx+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationRedirectURIsInput.tsx@@ -40,7 +40,7 @@ export const SettingsApplicationRegistrationRedirectURIsInput = ({redirectUri: z.string().trim()- .min(1, 'URI is required')+ .min(1, t`URI is required`).url(t`Please enter a valid URL`).refine((value) => !redirectUris.includes(value),diff --git a/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getSettingsMenuItemDisplayTitle.test.ts b/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getSettingsMenuItemDisplayTitle.test.tsnew file mode 100644index 00000000000..40cc4b22ac2--- /dev/null+++ b/packages/twenty-front/src/pages/settings/applications/utils/__tests__/getSettingsMenuItemDisplayTitle.test.ts@@ -0,0 +1,75 @@+import { i18n } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import { getLegacySettingsMenuItemUniversalIdentifier } from 'twenty-shared/application';+import { SOURCE_LOCALE } from 'twenty-shared/translations';+import { getSettingsMenuItemDisplayTitle } from '~/pages/settings/applications/utils/getSettingsMenuItemDisplayTitle';++const APPLICATION_UNIVERSAL_IDENTIFIER = '0f5b4d0e-4c6a-4d55-9f1e-2a8f7a3b6c11';+const FRONT_COMPONENT_UNIVERSAL_IDENTIFIER =+ '7c2e9b54-1d3f-4a8e-b6c0-5e9d2f4a7b38';++const LEGACY_SETTINGS_MENU_ITEM_UNIVERSAL_IDENTIFIER =+ getLegacySettingsMenuItemUniversalIdentifier({+ applicationUniversalIdentifier: APPLICATION_UNIVERSAL_IDENTIFIER,+ frontComponentUniversalIdentifier: FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,+ });++const getDisplayTitle = ({+ universalIdentifier,+ title,+}: {+ universalIdentifier: string;+ title: string;+}) =>+ getSettingsMenuItemDisplayTitle({+ applicationUniversalIdentifier: APPLICATION_UNIVERSAL_IDENTIFIER,+ frontComponents: [+ {+ id: 'front-component-id',+ universalIdentifier: FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,+ },+ ],+ settingsMenuItem: {+ universalIdentifier,+ frontComponentId: 'front-component-id',+ title,+ },+ });++describe('getSettingsMenuItemDisplayTitle', () => {+ beforeEach(() => {+ i18n.load('fr-FR', { [msg`Settings`.id]: 'Paramètres' });+ i18n.activate('fr-FR');+ });++ afterEach(() => {+ i18n.activate(SOURCE_LOCALE);+ });++ it('should translate the title of the synthesized legacy item', () => {+ expect(+ getDisplayTitle({+ universalIdentifier: LEGACY_SETTINGS_MENU_ITEM_UNIVERSAL_IDENTIFIER,+ title: 'Settings',+ }),+ ).toBe('Paramètres');+ });++ it('should keep the title of an item a developer named Settings', () => {+ expect(+ getDisplayTitle({+ universalIdentifier: 'a4b1c2d3-e5f6-4a7b-8c9d-0e1f2a3b4c5d',+ title: 'Settings',+ }),+ ).toBe('Settings');+ });++ it('should keep a title other than the legacy one', () => {+ expect(+ getDisplayTitle({+ universalIdentifier: LEGACY_SETTINGS_MENU_ITEM_UNIVERSAL_IDENTIFIER,+ title: 'Billing',+ }),+ ).toBe('Billing');+ });+});diff --git a/packages/twenty-front/src/pages/settings/applications/utils/getSettingsMenuItemDisplayTitle.ts b/packages/twenty-front/src/pages/settings/applications/utils/getSettingsMenuItemDisplayTitle.tsnew file mode 100644index 00000000000..8b3c3b05584--- /dev/null+++ b/packages/twenty-front/src/pages/settings/applications/utils/getSettingsMenuItemDisplayTitle.ts@@ -0,0 +1,45 @@+import { t } from '@lingui/core/macro';+import { getLegacySettingsMenuItemUniversalIdentifier } from 'twenty-shared/application';+import { isDefined } from 'twenty-shared/utils';+import {+ type FrontComponent,+ type SettingsMenuItem,+} from '~/generated-metadata/graphql';++const LEGACY_SETTINGS_MENU_ITEM_TITLE = 'Settings';++export const getSettingsMenuItemDisplayTitle = ({+ applicationUniversalIdentifier,+ frontComponents,+ settingsMenuItem,+}: {+ applicationUniversalIdentifier: string;+ frontComponents: Pick<FrontComponent, 'id' | 'universalIdentifier'>[];+ settingsMenuItem: Pick<+ SettingsMenuItem,+ 'universalIdentifier' | 'frontComponentId' | 'title'+ >;+}): string => {+ if (settingsMenuItem.title !== LEGACY_SETTINGS_MENU_ITEM_TITLE) {+ return settingsMenuItem.title;+ }++ const frontComponentUniversalIdentifier = frontComponents.find(+ (frontComponent) => frontComponent.id === settingsMenuItem.frontComponentId,+ )?.universalIdentifier;++ if (!isDefined(frontComponentUniversalIdentifier)) {+ return settingsMenuItem.title;+ }++ const legacySettingsMenuItemUniversalIdentifier =+ getLegacySettingsMenuItemUniversalIdentifier({+ applicationUniversalIdentifier,+ frontComponentUniversalIdentifier,+ });++ return settingsMenuItem.universalIdentifier ===+ legacySettingsMenuItemUniversalIdentifier+ ? t`Settings`+ : settingsMenuItem.title;+};diff --git a/packages/twenty-shared/src/types/ValidationRuleCompilationResult.ts b/packages/twenty-shared/src/types/ValidationRuleCompilationResult.tsindex e3f216971b0..79763bfe60a 100644--- a/packages/twenty-shared/src/types/ValidationRuleCompilationResult.ts+++ b/packages/twenty-shared/src/types/ValidationRuleCompilationResult.ts@@ -1,5 +1,12 @@import { type ValidationRuleBindings } from './ValidationRuleBindings';+import { type ValidationRuleErrorCode } from './ValidationRuleErrorCode';+import { type ValidationRuleErrorParams } from './ValidationRuleErrorParams';export type ValidationRuleCompilationResult =| { isValid: true; bindings: ValidationRuleBindings }- | { isValid: false; errorMessage: string };+ | {+ isValid: false;+ errorMessage: string;+ errorCode?: ValidationRuleErrorCode;+ errorParams?: ValidationRuleErrorParams;+ };diff --git a/packages/twenty-shared/src/types/ValidationRuleErrorCode.ts b/packages/twenty-shared/src/types/ValidationRuleErrorCode.tsnew file mode 100644index 00000000000..ad05544e5f9--- /dev/null+++ b/packages/twenty-shared/src/types/ValidationRuleErrorCode.ts@@ -0,0 +1,13 @@+export type ValidationRuleErrorCode =+ | 'EMPTY_EXPRESSION'+ | 'EXPRESSION_TOO_LONG'+ | 'BRACKET_ACCESS'+ | 'SPACED_MEMBER_DOT'+ | 'NOT_A_VALUE'+ | 'UNKNOWN_FIELD'+ | 'UNKNOWN_SUBFIELD'+ | 'SUBFIELD_TOO_DEEP'+ | 'NOT_A_TO_ONE_RELATION'+ | 'UNKNOWN_RELATION_TARGET_FIELD'+ | 'RELATION_TOO_DEEP'+ | 'NON_BOOLEAN_RESULT';diff --git a/packages/twenty-shared/src/types/ValidationRuleErrorParams.ts b/packages/twenty-shared/src/types/ValidationRuleErrorParams.tsnew file mode 100644index 00000000000..29ab87d94b6--- /dev/null+++ b/packages/twenty-shared/src/types/ValidationRuleErrorParams.ts@@ -0,0 +1,7 @@+export type ValidationRuleErrorParams = {+ fieldName?: string;+ maxLength?: number;+ path?: string;+ relationFieldName?: string;+ subfieldName?: string;+};diff --git a/packages/twenty-shared/src/types/ValidationRuleEvaluationResult.ts b/packages/twenty-shared/src/types/ValidationRuleEvaluationResult.tsindex e71e454d26d..1a470dea04b 100644--- a/packages/twenty-shared/src/types/ValidationRuleEvaluationResult.ts+++ b/packages/twenty-shared/src/types/ValidationRuleEvaluationResult.ts@@ -1,4 +1,10 @@+import { type ValidationRuleErrorCode } from './ValidationRuleErrorCode';+export type ValidationRuleEvaluationResult =| { status: 'passed' }| { status: 'failed' }- | { status: 'errored'; errorMessage: string };+ | {+ status: 'errored';+ errorMessage: string;+ errorCode?: ValidationRuleErrorCode;+ };diff --git a/packages/twenty-shared/src/types/index.ts b/packages/twenty-shared/src/types/index.tsindex fd60d49798f..e538615b09e 100644--- a/packages/twenty-shared/src/types/index.ts+++ b/packages/twenty-shared/src/types/index.ts@@ -334,6 +334,8 @@ export { TwoFactorAuthenticationStrategy } from './TwoFactorAuthenticationStrateexport { UpgradeHealthEnum } from './UpgradeHealthEnum';export type { ValidationRuleBindings } from './ValidationRuleBindings';export type { ValidationRuleCompilationResult } from './ValidationRuleCompilationResult';+export type { ValidationRuleErrorCode } from './ValidationRuleErrorCode';+export type { ValidationRuleErrorParams } from './ValidationRuleErrorParams';export type { ValidationRuleEvaluationResult } from './ValidationRuleEvaluationResult';export type { ValidationRuleExpressionToken } from './ValidationRuleExpressionToken';export type { ValidationRuleFieldDescriptor } from './ValidationRuleFieldDescriptor';diff --git a/packages/twenty-shared/src/utils/tiptap/__tests__/campaign-variables.test.ts b/packages/twenty-shared/src/utils/tiptap/__tests__/campaign-variables.test.tsindex 3708607aaf6..50b82f0501d 100644--- a/packages/twenty-shared/src/utils/tiptap/__tests__/campaign-variables.test.ts+++ b/packages/twenty-shared/src/utils/tiptap/__tests__/campaign-variables.test.ts@@ -44,6 +44,18 @@ describe('listCampaignVariablesForFields', () => {expect(definitions[0]?.label).toBe('Name · First name');});+ it('should use the given sub-field labels when provided', () => {+ const definitions = listCampaignVariablesForFields(+ [{ name: 'name', label: 'Nom', type: FieldMetadataType.FULL_NAME }],+ { firstName: 'Prénom' },+ );++ expect(definitions.map((definition) => definition.label)).toEqual([+ 'Nom · Prénom',+ 'Nom · Last name',+ ]);+ });+it('should skip system, inactive and unsupported fields', () => {expect(listCampaignVariablesForFields([diff --git a/packages/twenty-shared/src/utils/tiptap/list-campaign-variables-for-fields.ts b/packages/twenty-shared/src/utils/tiptap/list-campaign-variables-for-fields.tsindex 2bd3d0b39be..3d3f5bfa4dc 100644--- a/packages/twenty-shared/src/utils/tiptap/list-campaign-variables-for-fields.ts+++ b/packages/twenty-shared/src/utils/tiptap/list-campaign-variables-for-fields.ts@@ -37,6 +37,7 @@ const COMPOSITE_CAMPAIGN_VARIABLE_SUBFIELDS: Partial<export const listCampaignVariablesForFields = (fields: CampaignVariableEligibleField[],+ subFieldLabelsByName: Partial<Record<string, string>> = {},): CampaignVariableDefinition[] => {const definitions: CampaignVariableDefinition[] = [];@@ -62,12 +63,15 @@ export const listCampaignVariablesForFields = (}for (const { subFieldName, subFieldLabel } of subFields) {+ const displayedSubFieldLabel =+ subFieldLabelsByName[subFieldName] ?? subFieldLabel;+definitions.push({name: `${field.name}.${subFieldName}`,label:subFields.length === 1? field.label- : `${field.label} · ${subFieldLabel}`,+ : `${field.label} · ${displayedSubFieldLabel}`,fieldName: field.name,fieldType: field.type,subFieldName,diff --git a/packages/twenty-shared/src/utils/validation-rule/__tests__/compileValidationRuleExpression.test.ts b/packages/twenty-shared/src/utils/validation-rule/__tests__/compileValidationRuleExpression.test.tsindex a9349398203..f302d14ded3 100644--- a/packages/twenty-shared/src/utils/validation-rule/__tests__/compileValidationRuleExpression.test.ts+++ b/packages/twenty-shared/src/utils/validation-rule/__tests__/compileValidationRuleExpression.test.ts@@ -1,3 +1,4 @@+import { VALIDATION_RULE_EXPRESSION_MAX_LENGTH } from '@/constants/ValidationRuleExpressionMaxLength';import { FieldMetadataType } from '@/types/FieldMetadataType';import { RelationType } from '@/types/RelationType';import { type ValidationRuleFieldDescriptor } from '@/types/ValidationRuleFieldDescriptor';@@ -87,6 +88,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('closeDate > now')).toEqual({isValid: false,errorMessage: 'Unknown field "closeDate"',+ errorCode: 'UNKNOWN_FIELD',+ errorParams: { fieldName: 'closeDate' },});});@@ -94,6 +97,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('amount.value > 0')).toEqual({isValid: false,errorMessage: '"value" is not a subfield of "amount"',+ errorCode: 'UNKNOWN_SUBFIELD',+ errorParams: { subfieldName: 'value', fieldName: 'amount' },});});@@ -101,6 +106,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('arrayLength(pointOfContacts) > 0')).toEqual({isValid: false,errorMessage: '"pointOfContacts" is not a to-one relation',+ errorCode: 'NOT_A_TO_ONE_RELATION',+ errorParams: { fieldName: 'pointOfContacts' },});});@@ -108,6 +115,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('isDefined(company.people)')).toEqual({isValid: false,errorMessage: '"company.people" goes more than one relation deep',+ errorCode: 'RELATION_TOO_DEEP',+ errorParams: { path: 'company.people' },});});@@ -115,6 +124,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('random() > 1')).toEqual({isValid: false,errorMessage: 'Unknown field "random"',+ errorCode: 'UNKNOWN_FIELD',+ errorParams: { fieldName: 'random' },});});@@ -122,6 +133,7 @@ describe('compileValidationRuleExpression', () => {expect(compile('stage')).toEqual({isValid: false,errorMessage: 'Expression did not return true or false',+ errorCode: 'NON_BOOLEAN_RESULT',});expect(compile('amount.amountMicros + 1').isValid).toBe(false);});@@ -130,6 +142,7 @@ describe('compileValidationRuleExpression', () => {expect(compile('company["industry"] == "SaaS"')).toEqual({isValid: false,errorMessage: 'Bracket access is not supported, use dot access instead',+ errorCode: 'BRACKET_ACCESS',});expect(compile('stage == "WON" and amount["amountMicros"] > 0').isValid,@@ -140,6 +153,8 @@ describe('compileValidationRuleExpression', () => {expect(compile('company . industry == "SaaS"')).toEqual({isValid: false,errorMessage: 'Write company.industry without spaces around the dot',+ errorCode: 'SPACED_MEMBER_DOT',+ errorParams: { path: 'company.industry' },});expect(compile('company.industry == "SaaS" or company . industry == "B2B"')@@ -181,10 +196,16 @@ describe('compileValidationRuleExpression', () => {expect(compile(' ')).toEqual({isValid: false,errorMessage: 'Expression is empty',+ errorCode: 'EMPTY_EXPRESSION',});});it('should reject an expression over the length cap', () => {- expect(compile(`stage == "${'x'.repeat(2000)}"`).isValid).toBe(false);+ expect(compile(`stage == "${'x'.repeat(2000)}"`)).toEqual({+ isValid: false,+ errorMessage: `Expression is longer than ${VALIDATION_RULE_EXPRESSION_MAX_LENGTH} characters`,+ errorCode: 'EXPRESSION_TOO_LONG',+ errorParams: { maxLength: VALIDATION_RULE_EXPRESSION_MAX_LENGTH },+ });});});diff --git a/packages/twenty-shared/src/utils/validation-rule/__tests__/evaluateValidationRuleExpression.test.ts b/packages/twenty-shared/src/utils/validation-rule/__tests__/evaluateValidationRuleExpression.test.tsindex 19ee49d7289..7e8ffcb744f 100644--- a/packages/twenty-shared/src/utils/validation-rule/__tests__/evaluateValidationRuleExpression.test.ts+++ b/packages/twenty-shared/src/utils/validation-rule/__tests__/evaluateValidationRuleExpression.test.ts@@ -295,6 +295,7 @@ describe('evaluateValidationRuleExpression', () => {expect(evaluate('stage', { stage: 'WON' })).toEqual({status: 'errored',errorMessage: 'Expression did not return true or false',+ errorCode: 'NON_BOOLEAN_RESULT',});});diff --git a/packages/twenty-shared/src/utils/validation-rule/compileValidationRuleExpression.ts b/packages/twenty-shared/src/utils/validation-rule/compileValidationRuleExpression.tsindex 5e9d81d8874..b14b4232fc4 100644--- a/packages/twenty-shared/src/utils/validation-rule/compileValidationRuleExpression.ts+++ b/packages/twenty-shared/src/utils/validation-rule/compileValidationRuleExpression.ts@@ -18,13 +18,19 @@ export const compileValidationRuleExpression = ({fields: ValidationRuleFieldDescriptor[];}): ValidationRuleCompilationResult => {if (expression.trim().length === 0) {- return { isValid: false, errorMessage: 'Expression is empty' };+ return {+ isValid: false,+ errorMessage: 'Expression is empty',+ errorCode: 'EMPTY_EXPRESSION',+ };}if (expression.length > VALIDATION_RULE_EXPRESSION_MAX_LENGTH) {return {isValid: false,errorMessage: `Expression is longer than ${VALIDATION_RULE_EXPRESSION_MAX_LENGTH} characters`,+ errorCode: 'EXPRESSION_TOO_LONG',+ errorParams: { maxLength: VALIDATION_RULE_EXPRESSION_MAX_LENGTH },};}@@ -43,6 +49,7 @@ export const compileValidationRuleExpression = ({return {isValid: false,errorMessage: 'Bracket access is not supported, use dot access instead',+ errorCode: 'BRACKET_ACCESS',};}@@ -58,9 +65,13 @@ export const compileValidationRuleExpression = ({);if (spacedMemberDotIndex !== -1) {+ const path = `${meaningfulTokens[spacedMemberDotIndex - 1]?.text}.${meaningfulTokens[spacedMemberDotIndex + 1]?.text}`;+return {isValid: false,- errorMessage: `Write ${meaningfulTokens[spacedMemberDotIndex - 1]?.text}.${meaningfulTokens[spacedMemberDotIndex + 1]?.text} without spaces around the dot`,+ errorMessage: `Write ${path} without spaces around the dot`,+ errorCode: 'SPACED_MEMBER_DOT',+ errorParams: { path },};}@@ -72,7 +83,12 @@ export const compileValidationRuleExpression = ({const resolution = resolveValidationRuleIdentifierPath({ path, fields });if (!resolution.isResolved) {- return { isValid: false, errorMessage: resolution.errorMessage };+ return {+ isValid: false,+ errorMessage: resolution.errorMessage,+ errorCode: resolution.errorCode,+ errorParams: resolution.errorParams,+ };}bindings = { ...bindings, ...resolution.bindings };@@ -86,7 +102,11 @@ export const compileValidationRuleExpression = ({});if (emptyRecordEvaluation.status === 'errored') {- return { isValid: false, errorMessage: emptyRecordEvaluation.errorMessage };+ return {+ isValid: false,+ errorMessage: emptyRecordEvaluation.errorMessage,+ errorCode: emptyRecordEvaluation.errorCode,+ };}return { isValid: true, bindings };diff --git a/packages/twenty-shared/src/utils/validation-rule/createValidationRuleEvaluator.ts b/packages/twenty-shared/src/utils/validation-rule/createValidationRuleEvaluator.tsindex 784350a5fcf..8b49644881c 100644--- a/packages/twenty-shared/src/utils/validation-rule/createValidationRuleEvaluator.ts+++ b/packages/twenty-shared/src/utils/validation-rule/createValidationRuleEvaluator.ts@@ -48,6 +48,7 @@ export const createValidationRuleEvaluator = ({return {status: 'errored',errorMessage: 'Expression did not return true or false',+ errorCode: 'NON_BOOLEAN_RESULT',};}diff --git a/packages/twenty-shared/src/utils/validation-rule/resolveValidationRuleIdentifierPath.ts b/packages/twenty-shared/src/utils/validation-rule/resolveValidationRuleIdentifierPath.tsindex fe9d515e02c..58f0ff9dd78 100644--- a/packages/twenty-shared/src/utils/validation-rule/resolveValidationRuleIdentifierPath.ts+++ b/packages/twenty-shared/src/utils/validation-rule/resolveValidationRuleIdentifierPath.ts@@ -3,12 +3,20 @@ import { compositeTypeDefinitions } from '@/types/composite-types/composite-typeimport { FieldMetadataType } from '@/types/FieldMetadataType';import { RelationType } from '@/types/RelationType';import { type ValidationRuleBindings } from '@/types/ValidationRuleBindings';+import { type ValidationRuleErrorCode } from '@/types/ValidationRuleErrorCode';+import { type ValidationRuleErrorParams } from '@/types/ValidationRuleErrorParams';import { type ValidationRuleFieldDescriptor } from '@/types/ValidationRuleFieldDescriptor';import { isDefined } from '@/utils/validation/isDefined';+type ValidationRuleIdentifierPathError = {+ errorMessage: string;+ errorCode: ValidationRuleErrorCode;+ errorParams: ValidationRuleErrorParams;+};+type ResolveValidationRuleIdentifierPathResult =| { isResolved: true; bindings: ValidationRuleBindings }- | { isResolved: false; errorMessage: string };+ | ({ isResolved: false } & ValidationRuleIdentifierPathError);const resolveSubfieldSegments = ({field,@@ -18,7 +26,7 @@ const resolveSubfieldSegments = ({field: ValidationRuleFieldDescriptor;subfieldSegments: string[];path: string;-}): string | null => {+}): ValidationRuleIdentifierPathError | null => {if (subfieldSegments.length === 0) {return null;}@@ -26,18 +34,36 @@ const resolveSubfieldSegments = ({const compositeType = compositeTypeDefinitions.get(field.type);if (!isDefined(compositeType) || subfieldSegments.length > 1) {- return `"${path}" goes deeper than the field "${field.name}" allows`;+ return {+ errorMessage: `"${path}" goes deeper than the field "${field.name}" allows`,+ errorCode: 'SUBFIELD_TOO_DEEP',+ errorParams: { path, fieldName: field.name },+ };}+ const subfieldName = subfieldSegments[0];+const isKnownSubfield = compositeType.properties.some(- (property) => property.name === subfieldSegments[0],+ (property) => property.name === subfieldName,);return isKnownSubfield? null- : `"${subfieldSegments[0]}" is not a subfield of "${field.name}"`;+ : {+ errorMessage: `"${subfieldName}" is not a subfield of "${field.name}"`,+ errorCode: 'UNKNOWN_SUBFIELD',+ errorParams: { subfieldName, fieldName: field.name },+ };};+const buildNotAValueError = (+ path: string,+): ValidationRuleIdentifierPathError => ({+ errorMessage: `"${path}" is not a value`,+ errorCode: 'NOT_A_VALUE',+ errorParams: { path },+});+export const resolveValidationRuleIdentifierPath = ({path,fields,@@ -48,13 +74,13 @@ export const resolveValidationRuleIdentifierPath = ({const [rootSegment, ...memberSegments] = path.split('.');if (!isDefined(rootSegment)) {- return { isResolved: false, errorMessage: `"${path}" is not a value` };+ return { isResolved: false, ...buildNotAValueError(path) };}if (rootSegment === VALIDATION_RULE_NOW_VARIABLE_NAME) {return memberSegments.length === 0? { isResolved: true, bindings: {} }- : { isResolved: false, errorMessage: `"${path}" is not a value` };+ : { isResolved: false, ...buildNotAValueError(path) };}const rootField = fields.find((field) => field.name === rootSegment);@@ -63,6 +89,8 @@ export const resolveValidationRuleIdentifierPath = ({return {isResolved: false,errorMessage: `Unknown field "${rootSegment}"`,+ errorCode: 'UNKNOWN_FIELD',+ errorParams: { fieldName: rootSegment },};}@@ -82,7 +110,7 @@ export const resolveValidationRuleIdentifierPath = ({isResolved: true,bindings: { [rootSegment]: rootField.universalIdentifier },}- : { isResolved: false, errorMessage: subfieldError };+ : { isResolved: false, ...subfieldError };}if (@@ -93,6 +121,8 @@ export const resolveValidationRuleIdentifierPath = ({return {isResolved: false,errorMessage: `"${rootSegment}" is not a to-one relation`,+ errorCode: 'NOT_A_TO_ONE_RELATION',+ errorParams: { fieldName: rootSegment },};}@@ -113,6 +143,11 @@ export const resolveValidationRuleIdentifierPath = ({return {isResolved: false,errorMessage: `Unknown field "${targetFieldSegment}" on "${rootSegment}"`,+ errorCode: 'UNKNOWN_RELATION_TARGET_FIELD',+ errorParams: {+ fieldName: targetFieldSegment,+ relationFieldName: rootSegment,+ },};}@@ -123,6 +158,8 @@ export const resolveValidationRuleIdentifierPath = ({return {isResolved: false,errorMessage: `"${path}" goes more than one relation deep`,+ errorCode: 'RELATION_TOO_DEEP',+ errorParams: { path },};}@@ -141,5 +178,5 @@ export const resolveValidationRuleIdentifierPath = ({targetField.universalIdentifier,},}- : { isResolved: false, errorMessage: subfieldError };+ : { isResolved: false, ...subfieldError };};