---
title: "google-api-translate-java"
author: "taink"
date: "2010-11-14T17:51:35Z"
tags: ["Google", "Java"]
categories: ["编程语言"]
slug: "google-api-translate-java"
draft: false
lastmod: "2010-11-14T17:52:18Z"
id: 811106
url: "https://taink.iteye.com/blog/811106"
---

```
//  http://code.google.com/p/google-api-translate-java/



import com.google.api.translate.Language;
import com.google.api.translate.Translate;

public class Main {
  public static void main(String[] args) throws Exception {
    // Set the HTTP referrer to your website address.
    Translate.setHttpReferrer(/* Enter the URL of your site here */);

    String translatedText = Translate.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);

    System.out.println(translatedText);
  }
}
```