View Source TxtaiEx.Translation (txtai_ex v0.1.1)

txtai translation instance for interfacing with a remote txtai service via REST API calls, providing functionality for translating text between languages.

Summary

Functions

Translates a list of texts from the source language to the target language in batch.

Translates a single text from the source language to the target language.

Functions

Link to this function

batchtranslate(api, texts, target \\ "en", source \\ nil)

View Source

Translates a list of texts from the source language to the target language in batch.

Parameters

  • api: The API struct containing configuration for URL and token.
  • texts: A list of texts to translate.
  • target: The target language code (defaults to "en").
  • source: The source language code (optional, auto-detects if not provided).

Returns

  • on success.
  • on failure.
Link to this function

translate(api, text, target \\ "en", source \\ nil)

View Source

Translates a single text from the source language to the target language.

Parameters

  • api: The API struct containing configuration for URL and token.
  • text: The text to translate.
  • target: The target language code (defaults to "en").
  • source: The source language code (optional, auto-detects if not provided).

Returns

  • on success.
  • on failure.