Closed lucinda34 closed 9 years ago
Can you explain what exactly does not work? What errors do you get and what have you tried? Opening an unconstructive issue shouting "It doesn't work!!!!11!" is not a good idea.
Thank you for responding! It's not a shout, it's a whisper... Sorry!
Just does nothing... It stays a blank page:
http://dlc.pt/equipa_dlc/lucinda/tradutor/
This is my code... The file included is on the right path....
<?php
include ("Stichoza/Google/GoogleTranslate.php");
$tr = new GoogleTranslate("en", "ka");
//echo GoogleTranslate::staticTranslate("Hello again", "en", "ka");
echo $tr->translate("Hello World!");
?>
As of v2.0.0
this library is namespaced as PSR-4 standards require (See the readme.md for more information). In your code the object isn't actually instantiating. You should get an error about it if you haven't turned off error_reporting
in your PHP configuration.
So you are using namespaces incorrectly.
You should either add use Stichoza\Google\GoogleTranslate;
before instantiating an object, or just use full namespace in classname.
use
keyworduse Stichoza\Google\GoogleTranslate;
$tr = new GoogleTranslate('en', 'pt');
$tr = Stichoza\Google\GoogleTranslate('en', 'pt');
I put the class in the same dir...
And the code is this:
<?php
include ("GoogleTranslate.php");//in same dir
use Stichoza\Google\GoogleTranslate;//namespace in class
$tr = new GoogleTranslate("en", "ka");
echo $tr->translate("Hello World!");
?>
Nothing again: http://www.dlc.pt/equipa_dlc/lucinda/tradutor/ Could you please help me ? What I'm doing wrong?
I think it's not a problem of this library. I copied the exact code you wrote and it works for me. You can see output in the attached image below.
Consider enabling error_reporting
on your server to see what's wrong.
You are great!!! Realy works!!! It was an issue in the server...
Thank you so much!
You're welcome! :smile:
It doesn't work with me!