[][src]Crate text_translator

text_translator

Description

This crate permits to translate text between languages easily. Its goals are:

  • implementing an unique library for different APIs
  • permitting language translations / detections with or withtout API key when possible
  • ease of use / relative performances
  • (later) async translations

It wants to implement the following APIs:

How to use

To use it, you first need to construct a translator (a struct implementing the Api trait).

Then, you will be able to do various function calls on this struct:

Languages are represented with the Language enum for target language, and InputLanguage for input language. See their respective documentations for more.

Examples

For the moment, only the Yandex API is implemented.

To see examples on how to use it, see its documentation.

Modules

yandex

A module containing the implementation of the Yandex Translate API.

Structs

Yandex

Yandex Translate API

Enums

Error

Enum containing different errors that may be raised by the program at runtime.

InputLanguage

Represents the languages that the text to translate shall use.

Language

Represents all the languages available for translation.

Traits

Api

A trait defining a translate API.

ApiDetect

Extends Api to implement language detection.

ApiError

Used on enums representing errors that a call to an API returned.

ApiKey

Extends Api, where the API needs to have an API Key.