Merge pull request #1075 from bigcapitalhq/fix/export-i18n-column-headers
fix(server): localize i18n column headers in CSV/XLSX/PDF exports
This commit is contained in:
@@ -12,6 +12,7 @@ import { ServiceError } from '../Items/ServiceError';
|
|||||||
import { ResourceService } from '../Resource/ResourceService';
|
import { ResourceService } from '../Resource/ResourceService';
|
||||||
import { getExportableService } from './decorators/ExportableModel.decorator';
|
import { getExportableService } from './decorators/ExportableModel.decorator';
|
||||||
import { ContextIdFactory, ModuleRef } from '@nestjs/core';
|
import { ContextIdFactory, ModuleRef } from '@nestjs/core';
|
||||||
|
import { I18nService } from 'nestjs-i18n';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExportResourceService {
|
export class ExportResourceService {
|
||||||
@@ -20,6 +21,7 @@ export class ExportResourceService {
|
|||||||
private readonly exportPdf: ExportPdf,
|
private readonly exportPdf: ExportPdf,
|
||||||
private readonly resourceService: ResourceService,
|
private readonly resourceService: ResourceService,
|
||||||
private readonly moduleRef: ModuleRef,
|
private readonly moduleRef: ModuleRef,
|
||||||
|
private readonly i18nService: I18nService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,7 +149,7 @@ export class ExportResourceService {
|
|||||||
const group = parent;
|
const group = parent;
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
name: value.name,
|
name: this.i18nService.t(value.name, { defaultValue: value.name }),
|
||||||
type: value.type || 'text',
|
type: value.type || 'text',
|
||||||
accessor: value.accessor || key,
|
accessor: value.accessor || key,
|
||||||
group,
|
group,
|
||||||
@@ -174,7 +176,7 @@ export class ExportResourceService {
|
|||||||
const group = parent;
|
const group = parent;
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
name: value.name,
|
name: this.i18nService.t(value.name, { defaultValue: value.name }),
|
||||||
type: value.type || 'text',
|
type: value.type || 'text',
|
||||||
accessor: value.accessor || key,
|
accessor: value.accessor || key,
|
||||||
group,
|
group,
|
||||||
|
|||||||
Reference in New Issue
Block a user