Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I translate my website with Google Translate?

I have a web page created in English. Depending on the continent, I want to dynamically translate my whole webpage to another language.

The webpage is fairly complex, so I cannot do it string by string. I just want to do it in a way like at the time of loading it will get translated into desired language.

Can I translate my webpage using the Google Translate API?

like image 808
Rahul Borkar Avatar asked Feb 09 '11 09:02

Rahul Borkar


2 Answers

Here is an example to to add Google translator to web page to translate specific element:

<html> 
    <head> 
    <title>My Page</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head> 
<body> 
    <div class="translate">Тестирование</p>
    <div class="translate_control" lang="en"></div>

    <script>
    function googleSectionalElementInit() {
      new google.translate.SectionalElement({
        sectionalNodeClassName: 'translate',
        controlNodeClassName: 'translate_control',
        background: '#f4fa58'
      }, 'google_sectional_element');
    }
    </script>
    <script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=en"></script>

</body>
</html>

http://jsfiddle.net/maxim75/H3Wkr/ - working example

like image 198
Maksym Kozlenko Avatar answered Sep 30 '22 03:09

Maksym Kozlenko


You could add a Google Translate widget to you page and users can translate to their language of choice on demand. http://www.google.com/webelements/#!/translate

like image 23
abraham Avatar answered Sep 30 '22 03:09

abraham