Add server translation (#9847)
First proof of concept for server-side translation. The goal was to translate one metadata item: <img width="939" alt="Screenshot 2025-01-26 at 08 18 41" src="https://github.com/user-attachments/assets/e42a3f7f-f5e3-4ee7-9be5-272a2adccb23" />
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { FieldMetadataType } from 'twenty-shared';
|
||||
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
@ -52,9 +53,9 @@ export const SEARCH_FIELDS_FOR_COMPANY: FieldTypeAndNameMetadata[] = [
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.company,
|
||||
namePlural: 'companies',
|
||||
labelSingular: 'Company',
|
||||
labelPlural: 'Companies',
|
||||
description: 'A company',
|
||||
labelSingular: msg`Company`,
|
||||
labelPlural: msg`Companies`,
|
||||
description: msg`A company`,
|
||||
icon: STANDARD_OBJECT_ICONS.company,
|
||||
shortcut: 'C',
|
||||
labelIdentifierStandardId: COMPANY_STANDARD_FIELD_IDS.name,
|
||||
@ -67,7 +68,7 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'The company name',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
})
|
||||
[NAME_FIELD_NAME]: string;
|
||||
name: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
|
||||
@ -78,7 +79,7 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconLink',
|
||||
})
|
||||
@WorkspaceIsUnique()
|
||||
[DOMAIN_NAME_FIELD_NAME]?: LinksMetadata;
|
||||
domainName: LinksMetadata;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: COMPANY_STANDARD_FIELD_IDS.employees,
|
||||
@ -294,5 +295,5 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -2,8 +2,10 @@ import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class MessageImportDriverException extends CustomException {
|
||||
code: MessageImportDriverExceptionCode;
|
||||
|
||||
constructor(message: string, code: MessageImportDriverExceptionCode) {
|
||||
super(message, code);
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'Note title',
|
||||
icon: 'IconNotes',
|
||||
})
|
||||
[TITLE_FIELD_NAME]: string;
|
||||
title: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.body,
|
||||
@ -78,7 +78,7 @@ export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconFilePencil',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
[BODY_FIELD_NAME]: string | null;
|
||||
body: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.createdBy,
|
||||
@ -155,5 +155,5 @@ export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -248,5 +248,5 @@ export class OpportunityWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconUser',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
[NAME_FIELD_NAME]: FullNameMetadata | null;
|
||||
name: FullNameMetadata | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: PERSON_STANDARD_FIELD_IDS.emails,
|
||||
@ -83,7 +83,7 @@ export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconMail',
|
||||
})
|
||||
@WorkspaceIsUnique()
|
||||
[EMAILS_FIELD_NAME]: EmailsMetadata;
|
||||
emails: EmailsMetadata;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: PERSON_STANDARD_FIELD_IDS.linkedinLink,
|
||||
@ -112,7 +112,7 @@ export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'Contact’s job title',
|
||||
icon: 'IconBriefcase',
|
||||
})
|
||||
[JOB_TITLE_FIELD_NAME]: string;
|
||||
jobTitle: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: PERSON_STANDARD_FIELD_IDS.phone,
|
||||
@ -304,5 +304,5 @@ export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ export class TaskWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'Task title',
|
||||
icon: 'IconNotes',
|
||||
})
|
||||
[TITLE_FIELD_NAME]: string;
|
||||
title: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: TASK_STANDARD_FIELD_IDS.body,
|
||||
@ -80,7 +80,7 @@ export class TaskWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconFilePencil',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
[BODY_FIELD_NAME]: string | null;
|
||||
body: string | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: TASK_STANDARD_FIELD_IDS.dueAt,
|
||||
@ -207,5 +207,5 @@ export class TaskWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ export class WorkspaceMemberWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'Workspace member name',
|
||||
icon: 'IconCircleUser',
|
||||
})
|
||||
[NAME_FIELD_NAME]: FullNameMetadata;
|
||||
name: FullNameMetadata;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.colorScheme,
|
||||
@ -126,7 +126,7 @@ export class WorkspaceMemberWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
description: 'Related user email address',
|
||||
icon: 'IconMail',
|
||||
})
|
||||
[USER_EMAIL_FIELD_NAME]: string;
|
||||
userEmail: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userId,
|
||||
@ -351,5 +351,5 @@ export class WorkspaceMemberWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
[SEARCH_VECTOR_FIELD.name]: any;
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user