public static String translate(String str) {
	if(!turnedon)
	    return str;
	String res = "";
	URL url = url(str);
	if(url == null)
	    return str;
	try {
	    final HttpURLConnection uc = (HttpURLConnection) url
		    .openConnection();
	    uc.setRequestMethod("GET");
	    uc.setDoOutput(true);
	    try {
		String result;
		try {
		    result = inputStreamToString(uc.getInputStream());
		} catch (Exception e) {
		    return str;
		}
		JSONObject o = new JSONObject(result);
		res = o.getJSONObject("data").getJSONArray("translations").getJSONObject(0).getString("translatedText");
		str = res;
		res = o.getJSONObject("data").getJSONArray("translations").getJSONObject(0).getString("detectedSourceLanguage");
		res = "[" + res + "] " + str;
	    } catch (JSONException e) {
		return str;
	    } finally { // http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html
		uc.getInputStream().close();
		if (uc.getErrorStream() != null) {
		    uc.getErrorStream().close();
		}
	    }
	} catch (IOException e) {
	    return str;
	}
	
	return res;
    }