google-translate-php icon indicating copy to clipboard operation
google-translate-php copied to clipboard

Error: Class "Stichoza\GoogleTranslate\GoogleTranslate" not found in file

Open ShazinAhmed97 opened this issue 1 year ago • 5 comments

when it runs on the local server there is no issue at all its working perfect .. but when i test it on liver server this error shows i tried many changes but no use

use Stichoza\GoogleTranslate\GoogleTranslate;

private function translateProducts($products, $targetLanguage) { $translator = new GoogleTranslate();

    // Set the target language
    $translator->setTarget($targetLanguage);

    if (is_array($products))
    {
        $translatedProducts = [];
        foreach ($products as $product) {
            $translatedProducts[] = $translator->translate($product);
        }
    }
    else
    {
        $translatedProducts = $translator->translate($products);
    }

    //print_r($translatedProducts); die();
    return $translatedProducts;
}`

this is my function

ShazinAhmed97 avatar Jan 03 '24 06:01 ShazinAhmed97

Do you have your composer configured correctly? Seems like an issue with autoloader

Stichoza avatar Jan 03 '24 17:01 Stichoza

yes i have "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/", "Stichoza\\GoogleTranslate\\" : "vendor/stichoza/google-translate/src)" } },

ShazinAhmed97 avatar Jan 05 '24 04:01 ShazinAhmed97

I cannot reproduce this bug, can you list steps for it?

Stichoza avatar Jan 16 '24 00:01 Stichoza

is there any restrictions for live server ?

ShazinAhmed97 avatar Jan 27 '24 07:01 ShazinAhmed97

There are no restrictions. Make sure you're deployment is correct

Stichoza avatar Feb 01 '24 17:02 Stichoza

I encountered the same error after installation, but after a few minutes, it worked fine (I believe it's a vscode issue).

miztizm avatar May 06 '24 15:05 miztizm