[−][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:
[x]
Yandex.Translate[x]
with API key[ ]
without key (5_000 chars/translation max)
[ ]
Google Translate[ ]
Bing
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:
my_translator.translate(my_text, input_language, target_language)
my_translator.detect(my_text)
if the API implements language detection
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 |
ApiError | Used on enums representing errors that a call to an API returned. |
ApiKey | Extends |