Support » Plugin: Google Website Translator » Automatic Translation

  • Resolved rantaro


    I know this plugin is designed to have visitors click languages they want and then the translation starts. But is there any way to automatically translate specified contents to specified languages once visitors render the pages?
    I tried to do this with the following way, but it didn’t work…
    The basic idea below is to have javascript to execute translation once the html finishes loading.
    1. Set “Show flags over translator”
    2. Display mode : inline
    3. Put do_shortcode(‘[prisna-google-website-translator]’) on pages with the specified contents
    4. Add the following script
    window.onload = function(){
    (function () {
    PrisnaGWT.translate(‘[language-code(e.g. ‘en’)]’);
    When I click the flags displayed by the plugin, the translation works just fine. But the codes above don’t work for some reason.
    Can anyone help me out of this?
    Thank you in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Prisna



    your idea is correct. But you should know the translator takes a few milliseconds to initialize. So the only thing you’d need to modify is the point number 4. You should run the PrisnaGWT.translate function after the translator is initialized. For instance, you can check for the visibility of the flags. Once they’re shown then you can run the translate function.


    It worked!
    Thanks a bunch!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.