본문 바로가기

Story/Javascript

페이지 번역 위젯

반응형

1. MicrosoftTranslatorWidget

주소 http://www.microsofttranslator.com/widget/

<div id="MicrosoftTranslatorWidget" style="width: 200px; min-height: 83px; border-color: #3A5770; background-color: #78ADD0;"><noscript><a href="http://www.microsofttranslator.com/bv.aspx?a=http%3a%2f%2fcoolthingoftheday.blogspot.com%2f">Translate this page</a><br />Powered by <a href="http://www.microsofttranslator.com">Microsoft&#174; Translator</a></noscript></div>
<script type="text/javascript"> /* <![CDATA[ */ setTimeout(function() { var s = document.createElement("script"); s.type = "text/javascript"; s.charset = "UTF-8"; s.src = "http://www.microsofttranslator.com/Ajax/V2/Widget.aspx?mode=manual&from=en&layout=ts"; var p = document.getElementsByTagName('head')[0] || document.documentElement; p.insertBefore(s, p.firstChild); }, 0); /* ]]> */ </script>

페이지 내에 이 소스를 넣어준다.

다시 줄정리해서 보면

<div id="MicrosoftTranslatorWidget" style="width: 200px; min-height: 83px; border-color: #3A5770; background-color: #78ADD0;">
    <noscript><a href="http://www.microsofttranslator.com/bv.aspx?a=http%3a%2f%2fcoolthingoftheday.blogspot.com%2f">Translate this page</a><br />Powered by <a href="http://www.microsofttranslator.com">Microsoft&#174; Translator</a></noscript>
</div>
<script type="text/javascript">
/* <![CDATA[ */
setTimeout(function() {
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.charset = "UTF-8";
    s.src = "http://www.microsofttranslator.com/Ajax/V2/Widget.aspx?mode=manual&from=en&layout=ts";
    var p = document.getElementsByTagName('head')[0] || document.documentElement; p.insertBefore(s, p.firstChild); }, 0);
/* ]]> */
</script>

 

2.구글 번역

구글 번역기 붙이기
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'ko'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

...
내용 .. 가을 하늘
...
반응형