forked from plainheart/google-translate-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
165 lines (157 loc) · 3.65 KB
/
index.d.ts
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
export = googleTranslateApi;
declare function googleTranslateApi(
text: string,
options?: googleTranslateApi.IOptions,
gotOptions?: any
): Promise<googleTranslateApi.ITranslateResponse>;
declare namespace googleTranslateApi {
export interface IOptions {
from?: string;
to?: string;
raw?: boolean;
client?: 't'|'gtx';
tld?: string;
endpoints?: ('website' | 'dictExt' | 'api')[];
randomEndpoint?: boolean;
endpointFallback?: boolean;
}
export interface ITranslateLanguage {
didYouMean: boolean;
iso: string;
}
export interface ITranslateText {
autoCorrected: boolean;
value: string;
didYouMean: boolean;
}
export interface ITranslateResponse {
text: string;
pronunciation: string;
from: {
language: ITranslateLanguage;
text: ITranslateText;
};
raw: string | object;
}
export enum languages {
"zh-CN" = "Chinese (Simplified)",
"zh-TW" = "Chinese (Traditional)",
af = "Afrikaans",
am = "Amharic",
ar = "Arabic",
auto = "Automatic",
az = "Azerbaijani",
be = "Belarusian",
bg = "Bulgarian",
bn = "Bengali",
bs = "Bosnian",
ca = "Catalan",
ceb = "Cebuano",
co = "Corsican",
cs = "Czech",
cy = "Welsh",
da = "Danish",
de = "German",
el = "Greek",
en = "English",
eo = "Esperanto",
es = "Spanish",
et = "Estonian",
eu = "Basque",
fa = "Persian",
fi = "Finnish",
fr = "French",
fy = "Frisian",
ga = "Irish",
gd = "Scots Gaelic",
gl = "Galician",
gu = "Gujarati",
ha = "Hausa",
haw = "Hawaiian",
he = "Hebrew",
hi = "Hindi",
hmn = "Hmong",
hr = "Croatian",
ht = "Haitian Creole",
hu = "Hungarian",
hy = "Armenian",
id = "Indonesian",
ig = "Igbo",
is = "Icelandic",
it = "Italian",
iw = "Hebrew",
ja = "Japanese",
jw = "Javanese",
ka = "Georgian",
kk = "Kazakh",
km = "Khmer",
kn = "Kannada",
ko = "Korean",
ku = "Kurdish (Kurmanji)",
ky = "Kyrgyz",
la = "Latin",
lb = "Luxembourgish",
lo = "Lao",
lt = "Lithuanian",
lv = "Latvian",
mg = "Malagasy",
mi = "Maori",
mk = "Macedonian",
ml = "Malayalam",
mn = "Mongolian",
mr = "Marathi",
ms = "Malay",
mt = "Maltese",
my = "Myanmar (Burmese)",
ne = "Nepali",
nl = "Dutch",
no = "Norwegian",
ny = "Chichewa",
pa = "Punjabi",
pl = "Polish",
ps = "Pashto",
pt = "Portuguese",
ro = "Romanian",
ru = "Russian",
sd = "Sindhi",
si = "Sinhala",
sk = "Slovak",
sl = "Slovenian",
sm = "Samoan",
sn = "Shona",
so = "Somali",
sq = "Albanian",
sr = "Serbian",
st = "Sesotho",
su = "Sundanese",
sv = "Swedish",
sw = "Swahili",
ta = "Tamil",
te = "Telugu",
tg = "Tajik",
th = "Thai",
tl = "Filipino",
tr = "Turkish",
uk = "Ukrainian",
ur = "Urdu",
uz = "Uzbek",
vi = "Vietnamese",
xh = "Xhosa",
yi = "Yiddish",
yo = "Yoruba",
zu = "Zulu",
}
namespace languages {
/**
* Returns the ISO 639-1 code of the desiredLang – if it is supported by Google Translate
* @param desiredLang – the name or the code(case sensitive) of the desired language
* @returns The ISO 639-1 code of the language or false if the language is not supported
*/
function getCode(desiredLang: string): string | boolean;
/**
* Returns true if the desiredLang is supported by Google Translate and false otherwise
* @param desiredLang – the ISO 639-1 code or the name of the desired language
*/
function isSupported(desiredLang: string): boolean;
}
}