We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Simple language widget that you can do yourself | Forum

Patricia Zorrilla Leader
Patricia Zorrilla Sep 9 '19

Add a normal text widget.

Enter the following code:


<div id="google_translate_element"></div><script type="text/javascript">function googleTranslateElementInit() {

 new google.translate.TranslateElement({pageLanguage: 'es', includedLanguages: 'de,en,es,fr,it,pt,ca,eu,gl', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');

}

</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>


Where do you put:

{pageLanguage: 'es', includedLanguages: 'de,en,es,fr,it,pt,ca,eu,gl',


you put the code of your base language (in my case it is 'es')and the comma separated list of languages you want to display in the drop-down.


List of available languages

https://cloud.google.com/translate/docs/languages?hl=es-419


Result:




The Forum post is edited by Patricia Zorrilla Sep 9 '19
Marcus
Marcus Sep 9 '19
Great thanks gonna use this for some projects. 
Oxwall Germany Club
Oxwall Germany Sep 22 '19
Topic was moved from General Questions.