Comments (15)
The same problem. Is there some guy has any idear.
from google-translate-php.
here is PHP test:
http://www.liuxiatool.com/t.php
from google-translate-php.
Thank you guys for your contribution. You rock!
from google-translate-php.
I've got the same problem. We're counting on you guy...
from google-translate-php.
Any fix? I've done composer update
but it gives me
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
and the issue still are :(
from google-translate-php.
OK. This is what i changed based on code from @helen5106. Don't know how or where @helen5106 got the changes from, Just refactored the stichoza code based on @helen5106 code:
In the main TranslateClient (/vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/TranslateClient.php)
//lines 52-80
/**
* @var array URL Parameters
/
private $urlParams = [
'client' => 'webapp',//CHANGED *****
'sl' => null, // Source language
'tl' => null, // Target language
'hl' => 'en',
'dt' => 'at', //ADDED ******
//'text' => null, // String to translate // REMOVED****** changed to q last line
'ie' => 'UTF-8', // Input encoding
'oe' => 'UTF-8', // Output encoding
//'multires' => 1, // ??????????? // REMOVED******
'otf' => 0, // SHOULD IT BE CHANGED TO 2 ????????******
//'pc' => 1, // REMOVED******
//'trs' => 1, // REMOVED******
'ssel' => 0,
'tsel' => 0,
'kc' => 1, // ADDED******
//'sc' => 1, // REMOVED******
'tk' => null,
'q' => null, // String to translate ADDED****** changed text to q
];
and in GoogleTokenGenerator (//vendor/stichoza/google-translate-php/src/Stichoza/GoogleTranslate/Tokens/GoogleTokenGenerator.php)
line 38
private function TL($a)
{
$b = $this->generateB(); // REMOVED******
//REPLACED WITH :
$tkk = explode('.', $this->TKK());
$b = $tkk[0];
//AFTER LINE 65: {$a = $this->RL($a, '+-3^+b+-f');}
$a ^= $tkk[1]; ADDED*****
private function generateB() //FUNCTION NOW REDUNDANT******
//REPLACED WITH THIS FUNCTION:
private function TKK()
{
$a = 561666268;
$b = 1526272306;
return 406398 . '.' . ($a + $b);
}
from google-translate-php.
I confirm the issue, the library doesn't work again.It's now broken.
from google-translate-php.
I have encountered this problem,
I checked the encryption algorithm should be changed parameters tk
from google-translate-php.
Solved #32 💃
from google-translate-php.
Anyone has an idea when the library code will be updated with working code and ready?
from google-translate-php.
Hi guys!
here's the ruby script:
def tkk
a = 561666268;
b = 1526272306;
return 406398.to_s + '.' + (a + b).to_s;
end
def char_code_at(str, index)
char = str[index]
v = char.unpack('H*')[0]
v.to_i(16)
end
def b(a, b)
d = 0
while d < (b.length - 2) do
c = b[d+2]
c = "a" <= c ? char_code_at(c, 0) - 87 : c.to_i
c = "+" == b[d+1] ? a >> c : a << c
a = "+" == b[d] ? a + c & 4294967295 : a ^ c
d += 3
end
a
end
def tk(a)
e = tkk.split(".")
h = e[0].to_i
g = []
d = 0
f = 0
while f < a.length do
c = char_code_at(a, f)
puts c
if 128 > c
g[(d+=1)-1] = c
else
if 2048 > c
g[(d+=1)-1] = c >> 6 | 192
else
if 55296 == (c & 64512) && f + 1 < a.length && 56320 == (char_code_at(a, f+1) & 64512)
c = 65536 + ((c & 1023) << 10) + (char_code_at(a,f+=1) & 1023)
g[(d+=1)-1] = c >> 18 | 240
g[(d+1)-1] = c >> 12 & 63 | 128
else
d[(d+1)-1] =c >> 12 || 224
g[(d+1)-1] = c >> 6 & 63 | 128
g[(d+1)-1] = c & 63 | 128
end
end
end
f += 1
end
a = h
d = 0
while d < g.length
a+= g[d]
a = b(a, "+-a^+6")
d+=1
end
a = b(a, "+-3^+b+-f")
a ^= (e[1]).to_i
0 > a && (a = (a & 2147483647) + 2147483648);
a %= 1E6;
return a.to_i.to_s + "." + (a.to_i ^ h).to_s;
end
puts tk("testando translator")
from google-translate-php.
@helen5106 I can see your testing tool was working correctly, but not on my localhost , It doesn't return any thing.
from google-translate-php.
@pukkaTaT Sorry that the code is unavailable. Is there someone do it successfully?
from google-translate-php.
You rock @nkreer! Library is working again!
from google-translate-php.
But I forgot to push a new version tag for composer. I'll do it now
from google-translate-php.
Related Issues (20)
- setUrl() It is not available in mainland China HOT 1
- Memory Usage HOT 4
- Very slow HOT 1
- Country an cities sometimes are not translated HOT 4
- ErrorException: Maximum execution time of 60 seconds exceeded HOT 4
- Class "Stichoza\GoogleTranslate\GoogleTranslate" not found HOT 1
- How do I swap to using my own paid api key? HOT 1
- Loading Problem. HOT 2
- I use the IP of a VPN server as a proxy, I wonder why it doesn't work when I use 'https' instead? HOT 5
- Can you give me a list of free Proxies that I can use so that translation is not blocked in the future? HOT 1
- Can you fix this bug in your library for me?
- 400 Bad Request Client error: GET HOT 5
- Can you add the link of my package to your package? HOT 1
- Ignore escaped keys on translations HOT 4
- Error: Class "Stichoza\GoogleTranslate\GoogleTranslate" not found in file HOT 6
- Bug report: preserveParameters gives unexpected results when translating to French HOT 1
- cURL error 60: SSL certificate problem HOT 1
- Please assist me HOT 3
- How can I translate my page web HTML into your library? HOT 2
- PHP - extract the children from this <div id="page-container"> then translate it and put them back into this same <div id="page-container">
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-translate-php.