function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vinay ChVinay Ch 

how to implement google translate in lightning component

Please help me anyone, how to implement below javascript in lightning component, below code help to translate the language change in site page.I implemented same code in VFpage and it's working as expected but same thing i should implement in lightning application

<div id="google_translate_element"></div>
<script type="text/javascript">
        function googleTranslateElementInit() {
             new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'en,sr,zh,th,ko,rosl,hr,ms,uk,et,ar,he,cs,de,fr,el,hu,it,ja,da,pl,zf,nl,no,pt,sk,ru,es,tr,fi,sv,bg,lt,,lv,af,is,ca,sh,id,vi'}, 'google_translate_element');
<script type="text/javascript" src="//"></script>

Saket Sharma 37Saket Sharma 37
Hi Vinay,

In lightning there is locker service which dosent allows u to use CDN that means the script u are including is not allowed so for this u need to use vf page to call api's  and then set up the communication between lightning component and vf page. I also faced the same problem when I was integrating google map in lightning. I am sharing u a link u can go through it.

if u get your problem solved then please mark my answer as best answer

Saket Sharma