1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*!
# 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](https://tech.yandex.com/translate/doc/dg/concepts/about-docpage)
- `[x]` with [API key](https://translate.yandex.com/developers/keys)
- `[ ]` without key (5_000 chars/translation max)
- `[ ]` [Google Translate](https://cloud.google.com/translate/docs/)
- `[ ]` [Bing](https://azure.microsoft.com/en-us/services/cognitive-services/translator-text-api/)
## How to use
To use it, you first need to construct a translator (a struct implementing the [Api](trait.Api.html) trait).
Then, you will be able to do various function calls on this struct:
- [`my_translator.translate(my_text, input_language, target_language)`](trait.Api.html#tymethod.translate)
- [`my_translator.detect(my_text)`](trait.ApiDetect.html#tymethod.detect) if the API implements language detection
Languages are represented with the [`Language`](enum.Language.html) enum for target language, and [`InputLanguage`](enum.InputLanguage.html) 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](struct.Yandex.html).
*/
pub use *;
pub use *;
/// Enum containing different errors that may be raised by the program at runtime.