Class Translate

A wrapper for Amazon Translate.

Constructors

  • Initialize a new Translate helper object.

    Parameters

    • options: {
          region?: string;
      } = {}
      • Optionalregion?: string

    Returns Translate

Properties

client: TranslateClient
sourceLanguageCode: string = 'en'

Default input language code.

targetLanguageCode: string = 'en'

Default output language code.

terminologyNames: string[] = []

Default terminology list.

Methods

  • Analyse a PDFTemplate to extract terms to translate based on a PDFEntity (using a sourceLanguage as reference).

    Parameters

    • template: PDFTemplateSection[]
    • entity: PDFEntity
    • sourceLanguage: string

    Returns Promise<Set<string>>

  • Get the contents of a PDF template (against a PDFEntity) translated in the desired language, if the latter isn't between the ones already available.

    Parameters

    • entity: PDFEntity
    • template: PDFTemplateSection[]
    • language: string
    • languages: Languages

    Returns Promise<Record<string, string>>

    an object that maps original texts with their translations (or nothing).

  • Translates input text from the source language to the target language.

    Parameters

    Returns Promise<string>