Skip to main content
added 361 characters in body
Source Link
Ravinder Kumar
  • 2.6k
  • 1
  • 13
  • 20

You can also try this:

1.downloadDownload jquery translate script from this link

2.How it works ( doc, live test )

//<?php
function includeravs_frontend_translate_script() script{
<script type="text/javascript" src="js/jquery  wp_enqueue_script( 'translate', get_template_directory_uri() .js"></script>
<script type="text'/javascript" src="jsjs/jquery.translate.js"></script>js', array( 'jquery' ), '0.0.1', true );
}
add_action( 'wp_enqueue_scripts', 'ravs_frontend_translate_script' );


function ravs_translate_webpage_fx(){
?>
<script>
    // run script after both script load for translate webpage
        jQuery(document).ready(function(){
          //from english to german:
          jQuery('body').translate( 'ar' );
        });
</script>
<?php
add_action('wp_footer','ravs_translate_webpage_fx', 999 ); // make sure this hook run after jquery-translate include in webpage

You can also try this:

1.download jquery translate script from this link

2.How it works ( doc, live test )

// include script
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.translate.js"></script>

// run script after both script load for translate webpage
    jQuery(document).ready(function(){
      //from english to german:
      jQuery('body').translate( 'ar' );
    });

You can also try this:

1.Download jquery translate script from this link

2.How it works ( doc, live test )

<?php
function ravs_frontend_translate_script() {
    wp_enqueue_script( 'translate', get_template_directory_uri() . '/js/jquery.translate.js', array( 'jquery' ), '0.0.1', true );
}
add_action( 'wp_enqueue_scripts', 'ravs_frontend_translate_script' );


function ravs_translate_webpage_fx(){
?>
<script>
    // run script after both script load for translate webpage
        jQuery(document).ready(function(){
          //from english to german:
          jQuery('body').translate( 'ar' );
        });
</script>
<?php
add_action('wp_footer','ravs_translate_webpage_fx', 999 ); // make sure this hook run after jquery-translate include in webpage
Source Link
Ravinder Kumar
  • 2.6k
  • 1
  • 13
  • 20

You can also try this:

1.download jquery translate script from this link

2.How it works ( doc, live test )

// include script
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.translate.js"></script>

// run script after both script load for translate webpage
    jQuery(document).ready(function(){
      //from english to german:
      jQuery('body').translate( 'ar' );
    });