Add POC for Field translation (#9898)

Similar to ObjectMetadata translation

Also fixed an issue linked to the migration from `t` to `message`
helper: we're forced to rebuild the ID ourselves
This commit is contained in:
Félix Malfait
2025-01-28 21:25:09 +01:00
committed by GitHub
parent 8754b7107d
commit b1219ff107
13 changed files with 120 additions and 55 deletions

View File

@ -8,6 +8,7 @@ import {
Resolver,
} from '@nestjs/graphql';
import { I18nContext } from 'src/engine/core-modules/i18n/types/i18n-context.type';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
@ -32,7 +33,7 @@ export class ObjectMetadataResolver {
@ResolveField(() => String, { nullable: true })
async labelPlural(
@Parent() objectMetadata: ObjectMetadataDTO,
@Context() context,
@Context() context: I18nContext,
): Promise<string> {
return this.objectMetadataService.resolveTranslatableString(
objectMetadata,
@ -44,7 +45,7 @@ export class ObjectMetadataResolver {
@ResolveField(() => String, { nullable: true })
async labelSingular(
@Parent() objectMetadata: ObjectMetadataDTO,
@Context() context,
@Context() context: I18nContext,
): Promise<string> {
return this.objectMetadataService.resolveTranslatableString(
objectMetadata,
@ -56,7 +57,7 @@ export class ObjectMetadataResolver {
@ResolveField(() => String, { nullable: true })
async description(
@Parent() objectMetadata: ObjectMetadataDTO,
@Context() context,
@Context() context: I18nContext,
): Promise<string> {
return this.objectMetadataService.resolveTranslatableString(
objectMetadata,