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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * DeepL API Documentation
 *
 * The DeepL API provides programmatic access to DeepL’s machine translation technology.
 *
 * The version of the OpenAPI document: 2.7.0
 *
 * Generated by: https://openapi-generator.tech
 */

/// TargetLanguage : Language of the text to be translated. Options currently available:  * `BG` - Bulgarian  * `CS` - Czech  * `DA` - Danish  * `DE` - German  * `EL` - Greek  * `EN` - English  * `ES` - Spanish  * `ET` - Estonian  * `FI` - Finnish  * `FR` - French  * `HU` - Hungarian  * `ID` - Indonesian  * `IT` - Italian  * `JA` - Japanese  * `KO` - Korean  * `LT` - Lithuanian  * `LV` - Latvian  * `NB` - Norwegian (Bokmål)  * `NL` - Dutch  * `PL` - Polish  * `PT` - Portuguese (all Portuguese varieties mixed)  * `RO` - Romanian  * `RU` - Russian  * `SK` - Slovak  * `SL` - Slovenian  * `SV` - Swedish  * `TR` - Turkish  * `UK` - Ukrainian  * `ZH` - Chinese  If this parameter is omitted, the API will attempt to detect the language of the text and translate it.

/// Language of the text to be translated. Options currently available:  * `BG` - Bulgarian  * `CS` - Czech  * `DA` - Danish  * `DE` - German  * `EL` - Greek  * `EN` - English  * `ES` - Spanish  * `ET` - Estonian  * `FI` - Finnish  * `FR` - French  * `HU` - Hungarian  * `ID` - Indonesian  * `IT` - Italian  * `JA` - Japanese  * `KO` - Korean  * `LT` - Lithuanian  * `LV` - Latvian  * `NB` - Norwegian (Bokmål)  * `NL` - Dutch  * `PL` - Polish  * `PT` - Portuguese (all Portuguese varieties mixed)  * `RO` - Romanian  * `RU` - Russian  * `SK` - Slovak  * `SL` - Slovenian  * `SV` - Swedish  * `TR` - Turkish  * `UK` - Ukrainian  * `ZH` - Chinese  If this parameter is omitted, the API will attempt to detect the language of the text and translate it.
/// EN-GB - English (British)
/// EN-US - English (American)
/// PT-BR - Portuguese (Brazilian)
/// PT-PT - Portuguese (all Portuguese varieties excluding Brazilian Portuguese)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TargetLanguage {
    #[serde(rename = "BG")]
    Bg,
    #[serde(rename = "CS")]
    Cs,
    #[serde(rename = "DA")]
    Da,
    #[serde(rename = "DE")]
    De,
    #[serde(rename = "EL")]
    El,
    #[serde(rename = "EN")]
    En,
    #[serde(rename = "EN-GB")]
    EnGb,
    #[serde(rename = "EN-US")]
    EnUs,
    #[serde(rename = "ES")]
    Es,
    #[serde(rename = "ET")]
    Et,
    #[serde(rename = "FI")]
    Fi,
    #[serde(rename = "FR")]
    Fr,
    #[serde(rename = "HU")]
    Hu,
    #[serde(rename = "ID")]
    Id,
    #[serde(rename = "IT")]
    It,
    #[serde(rename = "JA")]
    Ja,
    #[serde(rename = "KO")]
    Ko,
    #[serde(rename = "LT")]
    Lt,
    #[serde(rename = "LV")]
    Lv,
    #[serde(rename = "NB")]
    Nb,
    #[serde(rename = "NL")]
    Nl,
    #[serde(rename = "PL")]
    Pl,
    #[serde(rename = "PL-BR")]
    PtBr,
    #[serde(rename = "PL-PT")]
    PtPt,
    #[serde(rename = "PT")]
    Pt,
    #[serde(rename = "RO")]
    Ro,
    #[serde(rename = "RU")]
    Ru,
    #[serde(rename = "SK")]
    Sk,
    #[serde(rename = "SL")]
    Sl,
    #[serde(rename = "SV")]
    Sv,
    #[serde(rename = "TR")]
    Tr,
    #[serde(rename = "UK")]
    Uk,
    #[serde(rename = "ZH")]
    Zh,
}

impl ToString for TargetLanguage {
    fn to_string(&self) -> String {
        match self {
            Self::Bg => String::from("BG"),
            Self::Cs => String::from("CS"),
            Self::Da => String::from("DA"),
            Self::De => String::from("DE"),
            Self::El => String::from("EL"),
            Self::En => String::from("EN"),
            Self::Es => String::from("ES"),
            Self::Et => String::from("ET"),
            Self::Fi => String::from("FI"),
            Self::Fr => String::from("FR"),
            Self::Hu => String::from("HU"),
            Self::Id => String::from("ID"),
            Self::It => String::from("IT"),
            Self::Ja => String::from("JA"),
            Self::Ko => String::from("KO"),
            Self::Lt => String::from("LT"),
            Self::Lv => String::from("LV"),
            Self::Nb => String::from("NB"),
            Self::Nl => String::from("NL"),
            Self::Pl => String::from("PL"),
            Self::Pt => String::from("PT"),
            Self::Ro => String::from("RO"),
            Self::Ru => String::from("RU"),
            Self::Sk => String::from("SK"),
            Self::Sl => String::from("SL"),
            Self::Sv => String::from("SV"),
            Self::Tr => String::from("TR"),
            Self::Uk => String::from("UK"),
            Self::Zh => String::from("ZH"),
            Self::EnGb => String::from("EN-GB"),
            Self::EnUs => String::from("EN-US"),
            Self::PtBr => String::from("PT-BR"),
            Self::PtPt => String::from("PT-PT"),
        }
    }
}

impl Default for TargetLanguage {
    fn default() -> TargetLanguage {
        Self::Bg
    }
}