how to save google translator data into local storage?

Viewed 90

Recently I added a google translator on my website but the translation works only a single time. How can I store the user-selected language into local storage and use the local storage another time when the user comes again.

The code is: and the website link is https://shubhamnegi123.github.io/nav-education/

 <div class="top-header"> 
           <div id="translator"></div> 
           <script src="https://translate.google.com/translate_a/element.js? 
                   cb=googleTranslateElementInit">
           </script>
           <script>       
                    function googleTranslateElementInit() { 
                    new google.translate.TranslateElement(           
                    { pageLanguage: "en" },       
                       "translator"           
                             );       
                     } 
           </script>
0 Answers
Related