Update user friendly errors for translations (#15000)

Force msg typing instead of string for user friendly errors
This commit is contained in:
Félix Malfait
2025-10-09 18:17:32 +02:00
committed by GitHub
parent 660cd38f35
commit e577c2d746
124 changed files with 796 additions and 563 deletions
@@ -1,4 +1,4 @@
import { t } from '@lingui/core/macro';
import { msg } from '@lingui/core/macro';
import camelCase from 'lodash.camelcase';
import { slugify } from 'transliteration';
import { isDefined } from 'twenty-shared/utils';
@@ -14,7 +14,7 @@ export const computeMetadataNameFromLabel = (label: string): string => {
'Label is required',
InvalidMetadataExceptionCode.LABEL_REQUIRED,
{
userFriendlyMessage: t`Label is required`,
userFriendlyMessage: msg`Label is required`,
},
);
}
@@ -36,7 +36,7 @@ export const computeMetadataNameFromLabel = (label: string): string => {
`Invalid label: "${label}"`,
InvalidMetadataExceptionCode.INVALID_LABEL,
{
userFriendlyMessage: t`Invalid label: "${label}"`,
userFriendlyMessage: msg`Invalid label: "${label}"`,
},
);
}
@@ -1,4 +1,4 @@
import { t } from '@lingui/core/macro';
import { msg } from '@lingui/core/macro';
import { FieldMetadataType } from 'twenty-shared/types';
import { compositeTypeDefinitions } from 'src/engine/metadata-modules/field-metadata/composite-types';
@@ -54,7 +54,7 @@ export const validateFieldNameAvailabilityOrThrow = ({
`Name "${name}" is not available as it is already used by another field`,
InvalidMetadataExceptionCode.NOT_AVAILABLE,
{
userFriendlyMessage: t`This name is not available as it is already used by another field.`,
userFriendlyMessage: msg`This name is not available as it is already used by another field.`,
},
);
}
@@ -64,7 +64,7 @@ export const validateFieldNameAvailabilityOrThrow = ({
`Name "${name}" is not available`,
InvalidMetadataExceptionCode.RESERVED_KEYWORD,
{
userFriendlyMessage: t`This name is not available.`,
userFriendlyMessage: msg`This name is not available.`,
},
);
}
@@ -1,4 +1,4 @@
import { t } from '@lingui/core/macro';
import { msg } from '@lingui/core/macro';
import {
InvalidMetadataException,
@@ -74,7 +74,7 @@ export const validateMetadataNameIsNotReservedKeywordOrThrow = (
`The name "${name}" is not available`,
InvalidMetadataExceptionCode.RESERVED_KEYWORD,
{
userFriendlyMessage: t`This name is not available.`,
userFriendlyMessage: msg`This name is not available.`,
},
);
}
@@ -1,4 +1,4 @@
import { t } from '@lingui/core/macro';
import { msg } from '@lingui/core/macro';
import { isDefined } from 'twenty-shared/utils';
import { type FlatEntityMaps } from 'src/engine/core-modules/common/types/flat-entity-maps.type';
@@ -43,7 +43,7 @@ export const validatesNoOtherObjectWithSameNameExistsOrThrows = (
'Object already exists',
ObjectMetadataExceptionCode.OBJECT_ALREADY_EXISTS,
{
userFriendlyMessage: t`Object already exists`,
userFriendlyMessage: msg`Object already exists`,
},
);
}