Hey there! In this article let us see how to integrate Google Translate into your website.
Add the following in your Footer
. The following code basically searches for the google_translate_element
element in your website and replaces that with the Google Translator element
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
<script asyc type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Add the following HTML code in your navigation or another place where you want to show the Google Translate plugin.
<li class="language-translator">
<span id="google_translate_element"></span>
</li>
Its that simple. Happy coding.
Global Data In All Laravel Blade Pages
SQLite Doesn't Support Dropping Foreign Keys in Laravel
Generate Fake Data In PHP With Faker
Add Google ADS In AMP (Accelerated Mobile Pages) Website
Sass or SCSS @mixin vs @extends vs Placeholder (%)
Manipulate HTML Using DOMDocument In PHP
Localization In Laravel REST API
Why You Should Run Cronjobs In Laravel?
SummerNote WYSIWYG Text Editor
Securely SSH Your Server & Push Files With FileZilla
Detect AdBlocker With Javascript And Increase Website Ads Revenue
Why And How To Use PHP PDO With CRUD Examples
Google, Twitter, GitHub, Facebook & Many Other Social Generic Logins With PHP Laravel Socialite