- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
function TL($a)
{
$tkk = explode('.', TKK());
$b = $tkk[0];
for($d = array(), $e = 0, $f = 0; $f < mb_strlen ( $a, 'UTF-8' ); $f ++) {
$g = charCodeAt ( $a, $f );
if (128 > $g) {
$d [$e ++] = $g;
} else {
if (2048 > $g) {
$d [$e ++] = $g >> 6 | 192;
} else {
if (55296 == ($g & 64512) && $f + 1 < mb_strlen ( $a, 'UTF-8' ) && 56320 == (charCodeAt ( $a, $f + 1 ) & 64512)) {
$g = 65536 + (($g & 1023) << 10) + (charCodeAt ( $a, ++ $f ) & 1023);
$d [$e ++] = $g >> 18 | 240;
$d [$e ++] = $g >> 12 & 63 | 128;
} else {
$d [$e ++] = $g >> 12 | 224;
$d [$e ++] = $g >> 6 & 63 | 128;
}
}
$d [$e ++] = $g & 63 | 128;
}
}
$a = $b;
for($e = 0; $e < count ( $d ); $e ++) {
$a += $d [$e];
$a = RL ( $a, '+-a^+6' );
}
$a = RL ( $a, "+-3^+b+-f" );
$a ^= $tkk[1];
if (0 > $a) {
$a = ($a & 2147483647) + 2147483648;
}
$a = fmod ( $a, pow ( 10, 6 ) );
return $a . "." . ($a ^ $b);
}
function translate($sl, $tl, $q)
{
$tk = TL($q);
$q = urlencode(stripslashes($q));
$url = "https://translate.google.com/translate_a/t?client=webapp&sl=".$sl."&tl=".$tl."&hl=".$tl."&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&ssel=0&tsel=0&kc=1&tk=". $tk ."&q=" . $q;
$output = json_decode(file_get_contents($url));
return str_replace('"', '', $output);
}