Last active
April 1, 2023 18:23
-
-
Save yashnirmal/282c9e69d13bb2667620d5d94eb631b1 to your computer and use it in GitHub Desktop.
Making Multilingual Websites using Google Translate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>My Simple Website</title> | |
<!-- Loading the Google Translate API --> | |
<script type="text/javascript" defer src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> | |
<script defer type="text/javascript"> | |
// assigning the element having id 'google_translate_element' to be the Google translate widget and assigning the default language to be English(en) | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element'); | |
} | |
</script> | |
</head> | |
<body> | |
<!-- Below div will act the Google Translate widget --> | |
<div style="text-align:center" id="google_translate_element"></div> | |
<h1 style="text-align:center">Simple Multilingual Website</h1> | |
<h2 style="text-align:center">Like and follow for more!</h2> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment