Discover google translate and pronounce, include the articles, news, trends, analysis and practical advice about google translate and pronounce on alibabacloud.com
PHP Code:
Copy Code code as follows:
#!/usr/bin/php-q
/**
* PHP Script for Google Translate
* @author: Yishan Wang
* @version: 1.0.0
*/
Class Google_api_translator
{
Public $url = "http://translate.google.com/translate_t";
Public $text = "";
Public $out = "";
Public $ip = ';
function SetText ($text) {
$this->text = $text;
}
function translate
Today I found Google's translation tool is very useful, you go to http://translate.google.com/translate_tools? Hl = en SL = ZH-CN, select the language in which your webpage is used, and the corresponding
Code . For example, if you select Chinese Simplified, the following code is generated:
Script SRC
=
"
Http://www.gmodules.com/ig/ifr? Url = http://www.google.com/ig/modules/translatemypage.xmlup_source_language=zh-CNw=160h=60title=border=output=js
"
>
Script
>
put it in
Python is very fun .. It took 5 to 6 hours. Based on some examples on the internet, I wrote a Google Translate desktop version. The interface and functions are simple and can only be translated between Chinese and English. Mainly to learn Python
It is very convenient to use Glade on the interface. After painting, you only need to link the signal, and glade with pygtk is very convenient.
The source code of
The solution is to go to my computer or computer on the desktop, find C:/Windows/System32/drivers/etc/hosts, and use notepad to open the hosts file;Add the following two lines (there must be a space between the IP address and the URL ):203.208.46.145 translate.google.com203.208.46.145 translate.googleapis.comClick "file" rarr; "Save ".Restart the browser to see if the translation is correct,In addition to this method, we can try to open g.cn and click "
options to develop an excellent WEB application. You will also learn about ICEfaces user interface components and the basic functionality of Google's API. Finally, you will create a WAR file and deploy it to websphere®community Edition (Community Edition).
Goal
In this tutorial, you will:
Understanding the different GUI controls
Learn about the basics of Google Translate API
Learn how to use backing b
Recently in a task, but little information on the Internet, after a few twists and turns, finally got it. The implementation process is very simple, take out share, so that everyone like me for a long time.
Google translation to upgrade to 2.0 after the fee version, so first need to apply to Google a key. The pay standard is 20 dollars per 1 million text characters (feel small).
Getting started with python web crawler (2) -- using python to call Google Translate
I have been reading documents outside China recently. I don't know some new words. Google Translate is used for understanding, and F12 is used to view the source code on the next page. It is found that
Google believes that people will be able to rely on machine logic in the future and not linguists to translate documents into the world's main language immediately.
Google's program is called "Statistical machine Translation" (Statistical machine translation), which is different from previous efforts.
In the past, people have put grammar rules and dictionaries set up by linguists into computers.
C # implement Google Translate API,
Since Google Translate's official API is a paid version, in the spirit of free and open source, share the code for implementing Google Translate API with C. This code is very simple, mainly divided into two parts: request content through W
Many browsers have the ability to automatically translate Web pages, such as Google Chrome, in fact, through the Google API interface can also be added to the Zen-cart site page of a translation selection box, as follows: The following is the code to add:! Start Google Tra
Many browsers have the abili
This article describes how to use urllib to retrieve googletranslate (Google translate,
The code is as follows:
#! /Usr/bin/env python3#-*-Coding: UTF-8 -*-# File Name: gt1.py# Purpose:# Creation Date: 1390366260# Last Modified: Wed 22 Jan 2014 06:14:11 PM CST# Release By: Doom. zhou
Import urllib. requestImport sys
Typ = sys. getfilesystemencoding ()
Def translate
Call Google translation API for translation
#!/usr/bin/python #coding: UTF-8 import sys reload (SYS) sys.setdefaultencoding (' UTF8 ') from xml.etree import Eleme Nttree as ET #引入解析xml文件的模块 import re import urllib,urllib2 #引入接入网络接口API的模块 from socket import error as SocketError IM Port errno import OS import string #调用google translator API to translate def
Create a new ANSI PHP file, and then make a class:
Copy Code code as follows:
Header ("content-type:text/html; Charset=utf-8 ");
Class google_api_translator{
Public $opts = Array ("text" => "", "Language_pair" => "En|it");
Public $out = "";
function Setopts ($opts) {
if ($opts ["text"]!= "") $this->opts["Text" = $opts ["text"];
if ($opts ["Language_pair"]!= "") $this->opts["Language_pair"] = $opts ["Language_pair"];
}
function translate
/* Google Translate PHP interface* Official Written 2009-03-28* http://blog.csdn.net/aprin/* Note: If the translated text is UTF-8 encoded, delete the Mb_convert_encoding function*/Class Google_api_translator {Public $url = "http://translate.google.com/translate_t";Public $text = "";//Translated textPublic $out = ""; Translation outputfunction SetText ($text) {$this->text = $text;}function
A translation function is used in the project, that is, after the translation is submitted to Google, the returned results are obtained.
First, find out the context of Google translation:Request Processing
After submitting the translation, check what the request and response are:
VcHLzOG9u7XEVVJMPC9zdHJvbmc + PC9wPgo8cD48L3A + CjxwcmUgY2xhc3M9 "brush: java;"> url = httl: // translate.google.cn/translate_a/t
Google code: Insert after meta name="google-translate-customization" content="4bd8dffe75af5007-16fa37f088724895-g08c0457d35008bb8-47">meta>and insert the following code where you want the button to appear:Bing Code:div id=' Microsofttranslatorwidget ' class=' light ' style =' color:white;background-color: #555555 '>div>script type=' Text/javascript '>SetTimeou
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.