<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>Who you gonna call? DogTranslate();

Replies: 1

What is the javascript function to call to switch to a language? I had thought it was doGTranslate.

I do not want to use the default switcher produced by the plugin’s shortcode. I need a button that toggles from English to Chinese.

The button is labeled “Chinese” in Chinese, so when you click it, it switches to the Chinese page.   On that page is a button that is labeled “English” in English, and when you click that, it switches to the English page. 

I was thinking I could do something like this (where I have the Chinese button with a class of .change-language-to-chinese):

jQuery(document).ready(function( $ ){
$('.change-language-to-chinese').on('click',function() {
doGTranslate('en|zh-CN');
return false;
});
});

But that does not appear to work. I think with the latest version (3.0.1) something fundamentally changed.

(Also, I am assuming that if I load the switcher-via-shortcode somewhere on the page, and it is off-screen, then the necessary javascript should be loaded. With the previous version, I had simply sent a click to the switcher widget and it worked.)

I have tried with support at Gtranslate.io but they do not seem to understand my request for the function.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer