tanmuhittin / laravel-google-translate

Translate translation files to other languages using google translate or another translation api
MIT License
424 stars 71 forks source link

400 Bad Request #13

Closed lloricode closed 5 years ago

lloricode commented 5 years ago

Here the output from php artisan translate:files

vagrant@homestead:~/code/laravel$ art translate:files

 What is base locale? [en]:
 > 

 What are the target locales? Comma seperate each lang key [tr,it]:
 > ar,es

 Force overwrite existing translations? [No]:
  [0] No
  [1] Yes
 > 1

 Use text exploration and json translation or php files? [php]:
  [0] json
  [1] php
 > 1

 Are there specific target files to translate only? ex: file1,file2 []:
 > 

 Are there specific files to exclude? [auth,pagination,validation,passwords]:
 > 

 Verbose each translation? [Yes]:
  [0] No
  [1] Yes
 > 1

 0/2 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
en -> ar translating...
File already exists: lang/ar/alerts.php. Checking missing translations
The role was successfully created. : تم إنشاء الدور بنجاح.
The role was successfully deleted. : تم حذف الدور بنجاح.

   ErrorException  : Client error: `POST https://translate.google.com/translate_a/single?client=t&hl=en&dt=t&dt=bd&dt=at&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&sl=en&tl=ar&ie=UTF-8&oe=UTF-8&multires=1&otf=0&pc=1&trs=1&ssel=0&tsel=0&kc=1&tk=735779.854365` resulted in a `400 Bad Request` response:
<!DOCTYPE html><html lang=en><meta charset=utf-8><meta name=viewport content="initial-scale=1, minimum-scale=1, width=de (truncated...)

  at /home/vagrant/code/laravels/core-boilerplate/vendor/stichoza/google-translate-php/src/GoogleTranslate.php:312
    308|                     'query' => $queryUrl,
    309|                     'body'  => $queryBodyEncoded,
    310|                 ] + $this->options);
    311|         } catch (RequestException $e) {
  > 312|             throw new ErrorException($e->getMessage());
    313|         }
    314| 
    315|         $body = $response->getBody(); // Get response body
    316| 

  Exception trace:

  1   Stichoza\GoogleTranslate\GoogleTranslate::getResponse("The role was successfully updated.")
      /home/vagrant/code/laravels/core-boilerplate/vendor/stichoza/google-translate-php/src/GoogleTranslate.php:223

  2   Stichoza\GoogleTranslate\GoogleTranslate::translate("The role was successfully updated.")
      /home/vagrant/code/laravels/core-boilerplate/vendor/tanmuhittin/laravel-google-translate/src/commands/TranslateFilesCommand.php:167

  Please use the argument -v to see more details.
lloricode commented 5 years ago

other info

vagrant@homestead:~/code/laravel$ art --version
Laravel Framework 5.8.29
vagrant@homestead:~/code/laravel$ php -v
PHP 7.2.17-1+ubuntu18.04.1+deb.sury.org+3 (cli) (built: Apr 10 2019 10:50:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.17-1+ubuntu18.04.1+deb.sury.org+3, Copyright (c) 1999-2018, by Zend Technologies
    with blackfire v1.24.4~linux-x64-non_zts72, https://blackfire.io, by Blackfire
vagrant@homestead:~/code/laravel$ 
tanmuhittin commented 5 years ago

Related to https://github.com/Stichoza/google-translate-php/issues/112 Until it is fixed, I recommend using a Google Translate API key