2017-03-15 9 views
0

내 웹 사이트에 두 개의 이미지가 있습니다. 영어와 한국어가 있습니다. 사용자가 대한민국 국기를 클릭하고 사용자가 영국을 클릭하면 영어로 다시 돌아갈 때 내 웹 페이지가 한국어로 번역되기를 원합니다.이미지의 웹 사이트 번역을위한 특정 언어를 지정하십시오.

Google 번역 API 또는 Microsoft Translate API를 호출하고 번역 된 페이지를 반환하는 각 이미지의 onclick 이벤트에 사용할 javascript 함수를 사용하고 싶습니다.

이것이 가능한지는 잘 모르겠지만 그렇다면 정말 고맙겠습니다. 플러그인을 직접 추가하는 것은 현재로서는 사용할 수있는 옵션이 아닙니다.

는 는

덕분에 ...

+0

그리고 지금까지 무엇을 했습니까? – mehulmpt

+0

나는 페이지에 빙 번역 위젯을 넣었지만, 이것은 정말로 마음에 들지 않습니다 ... – Josh

답변

0

하드 파고 후 ... 내가 빙 솔루션 번역을 마련했습니다 ...

당신은 ... 경고를 언급 그리고 수는 60000은 여기를 의미 번역이 60 초 이내에 완료되지 않으면 오류가 표시됩니다 ...

<!-- The image showing korean --> 
<img id="Koebtn" src="images/SP2.jpg"> 


<!-- The Code to translate --> 
<script src="http://www.microsoftTranslator.com/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**" type="text/javascript"></script> 
    <script type="text/javascript"> 
    $(document).ready(function() { 
     $("#Koebtn").click(function(){ 

     if (document.readyState == 'complete') { 
       Microsoft.Translator.Widget.Translate('en', 'es', onProgress, onError, onComplete, onRestoreOriginal, 60000); 
      } 

      //You can use Microsoft.Translator.Widget.GetLanguagesForTranslate to map the language code with the language name 
     function onProgress(value) { 
      document.getElementById('counter').innerHTML = Math.round(value); 
     } 

     function onError(error) { 
      alert("Translation Error: " + error); 
     } 

     function onComplete() { 
      document.getElementById('counter').style.color = 'green'; 
     } 
     //fires when the user clicks on the exit box of the floating widget 
     function onRestoreOriginal() { 
      alert("The page was reverted to the original language. This message is not part of the widget."); 
     } 

     }); 
    }); 
</script> 
+0

비슷한 해결책을 원하지만 Google은 API를 번역하고 있습니다 ... 해결책을 가진 사람 ??? – Josh