Git Product home page Git Product logo

google-api-translate-java's People

Contributors

boatmeme avatar epylar avatar rbclark avatar richmidwinter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-api-translate-java's Issues

problem with key

Hello,

I looking arround have paid access (whith key)
but it doesn't work

no use of my key, check that in the api google console report graph.
so I keep having the quota exceed response. so bad

I've notice that for paid acces, the url is different (secured one):
https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&q=hello%20world&source=en&target=de
instead of
http://ajax.googleapis.com/ajax/services/language/translate
in the source

change it on java doesn't made me go anywhere.

if you thought about something.
thank you anyway, your little wrapper was a good one.

tests

The tests are nice, but they kind of fail, because Google is translating the same stuff differently in 2014 than in 2012.

I am not sure of any long-term solution, other than keep updating the tests continually.

The API doesn't work anymore!

The API simply returns a blank text now. Maybe Google changed their format?
Is it able to fix it, or is it complicated?
Thanks.

microsoft translate

Microsoft Translate API looks like it shouldn't be hard to add. It sometimes returns better results (sometimes not) and it's cheaper.

I will try to fork this project and add it myself.

HTTP response code: 414

When v2 version always uses the GET method to the google api service.

The next modifications will restore the use of POST (like in the v1 variant):

GoogleAPI.java, line 117 insert:

      uc.setRequestProperty("X-HTTP-Method-Override", "GET");

TranslateV2.jave, line 40-71 replace with

/**
 * Constants.
 */
private static final String URL = "https://www.googleapis.com/language/translate/v2";
private static final String PAR_TEMPLATE = "key=%s&q=%s&target=%s";

/**
 * {@inheritDoc}
 */
@Override
public String execute(final String text, final Language from, final Language to) throws GoogleAPIException {
    try {
        validateReferrer();

        if (key == null) {
            throw new IllegalStateException("You MUST have a Google API Key to use the V2 APIs. See http://code.google.com/apis/language/translate/v2/getting_started.html");
        }

        final String parameters = String.format(PAR_TEMPLATE, key, URLEncoder.encode(text, ENCODING), to.toString())
                + (Language.AUTO_DETECT.equals(from) ? "" : String.format("&source=%s", from.toString()));

        final URL url = new URL(URL);

        final JSONObject json = retrieveJSON(url,parameters);

        return getJSONResponse(json);
    } catch (final Exception e) {
        System.out.println("Error: " +e.getMessage());

        throw new GoogleAPIException(e);
    }
}

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.