使用Google API进行翻译 支持大数据量的文字翻译

今天同事要写程序翻译点东西,找到了一个封装了的class,但是有些内容翻译出来不对。仔细看了下,主要是大数据量的和一些带html代码的数据,遂对代码做了细微的更改,并把api的参数等等的说明都收集放在了文件末尾,方便查看。

<?php
/**
* @author bombworm@gmail.com
* @联系方式 QQ 79194034
* @link http://www.codingall.com
* @version 1.0
* @license remain this copyright when using
* @abstract Translate a large piece of text with the Google Translate API
* @tutorial http://code.google.com/intl/en/apis/ajaxlanguage/documentation/reference.html
* @example
* Google_Translate_API::translate('write codes, go " http://www.codingall.com "', 'en', 'zh-cn');
*/

/**
* Translating language with Google API
* @author gabe@fijiwebdesign.com
* @version $id$
* @license - Share-Alike 3.0 (http://creativecommons.org/licenses/by-sa/3.0/)
*
* Google requires attribution for their Language API, please see: http://code.google.com/apis/ajaxlanguage/documentation/#Branding
*
*/
class Google_Translate_API {

/**
* Translate a piece of text with the Google Translate API
* @return String
* @param $text String
* @param $from String[optional] Original language of $text. An empty String will let

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值