Skip to content

db/translator

Documentation

Overview

Classes

Translator

translateList()

Translates properties for a list of entities by querying the corresponding language table.

ts
static translateList(list: any, language: string, basetTable: string): void;
ParameterTypeDescription
listanyThe array of entities to be translated.
languagestringThe target language code (e.g., 'en', 'de'). If undefined, no translation occurs.
basetTablestringThe name of the base entity table (used to derive the language table name).

Returns

  • Type: void
  • Description: The translated array of entities.

translateEntity()

Translates properties for a single entity by querying the corresponding language table.

ts
static translateEntity(entity: any, id: any, language: string, basetTable: string): any;
ParameterTypeDescription
entityanyThe entity object to be translated.
idanyThe ID of the entity.
languagestringThe target language code (e.g., 'en', 'de'). If undefined, no translation occurs.
basetTablestringThe name of the base entity table.

Returns

  • Type: any
  • Description: The translated entity object.