Tejas Rana
  • Home
  • About
  • Experience
  • Skills
  • Blogs
  • Technology
  • Contact
January 9 2016

Integration of Google Translate in any website

tejas Tips & Tricks

Do you need your website in multilingual but don’t want to repopulate content in multiple language. In that case you can use Google API to make your website multilingual.
First of all decide the area where you want to add language selector.
In that place you have to add this DIV section with ID so that Script find that block and append language dropdown.

<div id="google_translate_element"></div>

now add JS library for translation.

<script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Its up to you where you want to add this library either in head section or in footer. but I recommend you to place it in footer so that you web page load quickly and after that it call 3rd party library.
now after this library call its function so that it start working. For that we have to use this JS snippt

<script>
    function googleTranslateElementInit() {
        new google.translate.TranslateElement(
            {pageLanguage: 'en'},
            'google_translate_element'
        );
    }
</script>

That’s all.. now you will be able to see drop down on that place where you call that DIV section.
7VgGB

Context Validation in Domain-Driven Design PHP Best Practices and Tips

Related Posts

001

Tips & Tricks

Anatomy of A Coronavirus-Proof Business[Infographic]

1-

Tips & Tricks

AWS EC2 alternative

Backdrop-Logo-Vertical_0

Drupal, Tips & Tricks

10 reasons why choose BackdropCMS instead of Drupal

Categories

  • .NET
  • Android
  • Angular
  • CakePHP
  • CSS
  • Devops
  • Drupal
  • Infi MVC
  • iOS
  • Javascript
  • Magento
  • Meteor
  • MongoDB
  • Opencart
  • Other
  • PHP
  • Python
  • Ruby
  • Tips & Tricks
  • WordPress

Recent Posts

  • Simplify Product Filtering by Category and Store ID in the Admin Panel with Our Powerful OpenCart 3.x Free Extension
  • Opencart 3.x Set currency based on user’s IP [Free Extension]
  • Anatomy of A Coronavirus-Proof Business[Infographic]
  • Opencart 3 Social Login Extension [FREE]
  • What is NGRX and Use of NGRX

Recent Comments

  • Nilesh on What is State Management in Angular? How to improve Performance?
  • Dinesh on Use Magento If You're Serious About eCommerce
  • Virendra on Use Magento If You're Serious About eCommerce
  • Tejas Rana on Show limited words in PHP from string with HTML tags
  • nadim on Show limited words in PHP from string with HTML tags
Tejas Rana
© Tejas Rana 2025