Git Product home page Git Product logo

Comments (15)

laan avatar laan commented on July 22, 2024 4

The same problem. Is there some guy has any idear.

from google-translate-php.

helen5106 avatar helen5106 commented on July 22, 2024 4

here is PHP test:

http://www.liuxiatool.com/t.php

from google-translate-php.

Stichoza avatar Stichoza commented on July 22, 2024 3

Thank you guys for your contribution. You rock!

from google-translate-php.

bmtriet avatar bmtriet commented on July 22, 2024 1

I've got the same problem. We're counting on you guy...

from google-translate-php.

rignaneseleo avatar rignaneseleo commented on July 22, 2024 1

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.

hurnell avatar hurnell commented on July 22, 2024 1

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.

joeforjoomla avatar joeforjoomla commented on July 22, 2024

I confirm the issue, the library doesn't work again.It's now broken.

from google-translate-php.

SmallXing avatar SmallXing commented on July 22, 2024

I have encountered this problem,
I checked the encryption algorithm should be changed parameters tk

from google-translate-php.

quanglam2807 avatar quanglam2807 commented on July 22, 2024

Solved #32 💃

from google-translate-php.

joeforjoomla avatar joeforjoomla commented on July 22, 2024

Anyone has an idea when the library code will be updated with working code and ready?

from google-translate-php.

vinicivs-monteiro avatar vinicivs-monteiro commented on July 22, 2024

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.

bmtriet avatar bmtriet commented on July 22, 2024

@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.

laan avatar laan commented on July 22, 2024

@pukkaTaT Sorry that the code is unavailable. Is there someone do it successfully?

from google-translate-php.

limonte avatar limonte commented on July 22, 2024

You rock @nkreer! Library is working again!

from google-translate-php.

Stichoza avatar Stichoza commented on July 22, 2024

But I forgot to push a new version tag for composer. I'll do it now

from google-translate-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.