statickidz / php-google-translate-free

PHP class to use the Google Translator API for free.
GNU General Public License v3.0
271 stars 91 forks source link

Detect Language Auto #24

Closed cihanbagdatli closed 3 years ago

cihanbagdatli commented 4 years ago

Hi, If you want to detect language auto.

$source = 'tr';
$target = 'en';
$text = "türkçe";
$trans = new GoogleTranslate();
echo $trans->translate($source, $target, $text);

For Example Detect:

            $source = 'auto';
            $target = 'en';
            $text = "türkçe";
            $trans = new GoogleTranslate();
            echo $trans->translate($source, $target, $text);

after result echo: english

Thanks so much forever.

statickidz commented 3 years ago

You can pass auto as source language and it should work