2017-04-15 8 views
0

내 웹 사이트에 Google 번역기 API를 사용하고 있습니다. cordova에서 모바일 응용 프로그램에 대한 Google API를 지원하는 무엇입니까 ?? 문제가 뭔지 모르겠습니다.Google 번역기 Api in Cordova

<html> 
<head> 
<script> 
var apiKey = 'YOUR_API_KEY'; // get from https://console.cloud.google.com 

</script> 
</head> 
<body> 
<script> 
function doTranslate() { 
    gapi.client.language.translations.list({ 
     q:document.getElementById('from').value, 
     target:'es'}).then(function(r) { 
      document.getElementById('to').value = 
       r.result.data.translations[0].translatedText; }) 
} 
</script> 
<textarea id="from"></textarea> 
<textarea disable id="to"></textarea> 
<script src="https://apis.google.com/js/client:api.js?onload=initGapi"></script> 
<button onclick="doTranslate()">Translate</button> 
</body> 
</html> 

키가를 사용하여 변환 API로 번역 텍스트를 전송하는 번역 기능입니다 :

+0

요구 사항과 현재 구현에 대해 자세히 설명해 주시겠습니까? :) –

+0

죄송합니다 .. cordova에서 작동합니다. 나는 http를 링크에 추가하지 않았다. 그래서 그것은 작동하지 않았다. 이제 제대로 작동합니다. 감사 :-) – Surya

답변

0
당신은 자바 스크립트 클라이언트 라이브러리를 사용하여 클라이언트 측 변환을 시도 할 수도

다음 예는 방법을 보여줍니다 자바 스크립트 클라이언트 라이브러리.