Forums

Forums / General Discussions / Adding google translate button on TPC

Adding google translate button on TPC

2 posts, 0 answered
  1. Madson Almeida
    Madson Almeida avatar
    4 posts
    Registered:
    19 Mar 2021
    20 Sep
    Link to this post
    Hi everyone,

    Is it possible to implement the google translate button on TPC?
    Do you have any case using google solution?
    Please refer to this web site "https://www.w3schools.com/howto/howto_google_translate.asp"

    Kind Regards,

    Madson Almeida
  2. Brady Ward
    Brady Ward avatar
    9 posts
    Registered:
    19 Aug 2021
    23 Sep in reply to Madson Almeida
    Link to this post
    Hello Madson,

    You can add a Google Translate button to Sitefinity/TPC quite easily. When dropped into a page, the Google Translate button will attempt to translate all text on the page.

    To add the button to a specific page you can:
    1. Add a Content Block widget onto the page and insert a div (ie. <div id="google_translate_element"></div>)
    2. Use an “Embed Code” widget and insert the following script <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    3. Use a “JavaScript” widget to insert the following code:
    function googleTranslateElementInit() {
      new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
    }

    To add the translate button to every page, use the above code samples in a page template following the same steps. Keep in mind, the button will appear wherever the above div is placed. If you require further assistance, please don't hesitate to join one of our daily Q&A sessions or email support at support@crmportalconnector.com.

    All the best,
    Brady
2 posts, 0 answered