2012-09-21 29 views
1

如何在輸入中使用html表格檢測插入語言以翻譯爲其他語言? 使用希伯來語(iwrit) - 英語語言。谷歌翻譯參數表格

<form action="http://translate.google.com/translate_t" target="_blank"> 
    <input type="text" name="text"> 
    <input type="hidden" value="hp" name="prev"> 
    <input type="hidden" value="iw" name="hl"> 
    <input type="hidden" value="y" name="js"> 
    <input type="hidden" value="" name="file"> 
    <input type="hidden" value="iw" name="sl"> 
    <input type="hidden" value="en" name="tl"> 
    <input type="hidden" value="#" name="history_state0"> 
    <input type="submit" value="Translate"> 
</form> 

回答

3

假設你需要它來生活,而不是更新形式提交,您將需要某種形式的請求時,文本翻譯的變化(http://api.jquery.com/change/),然後對形式表示相應的改變語言。

至於功能本身,Google有一個翻譯API(https://developers.google.com/translate/v2/libraries)。在那裏你會找到一個JavaScript界面​​,並且應該爲你處理所有繁重的工作。

我希望有幫助。