Git Product home page Git Product logo

Comments (7)

Stichoza avatar Stichoza commented on July 22, 2024

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.

from google-translate-php.

lucinda34 avatar lucinda34 commented on July 22, 2024

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!");
?>

from google-translate-php.

Stichoza avatar Stichoza commented on July 22, 2024

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.

With use keyword

use Stichoza\Google\GoogleTranslate;
$tr = new GoogleTranslate('en', 'pt');

Or with full namespace

$tr = Stichoza\Google\GoogleTranslate('en', 'pt');

from google-translate-php.

lucinda34 avatar lucinda34 commented on July 22, 2024

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?

from google-translate-php.

Stichoza avatar Stichoza commented on July 22, 2024

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.

screen shot 2014-10-31 at 18 55 39

from google-translate-php.

lucinda34 avatar lucinda34 commented on July 22, 2024

You are great!!! Realy works!!! It was an issue in the server...

Thank you so much!

from google-translate-php.

Stichoza avatar Stichoza commented on July 22, 2024

You're welcome! 😄

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.