Skip to content

Commit

Permalink
fix: Google Translate widget not present on chrome (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
AyakorK authored Oct 2, 2023
1 parent 855785c commit 0851104
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions app/views/layouts/decidim/_head_extra.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,11 @@

function googleTranslateElementInit() {
new google.translate.TranslateElement(
{
pageLanguage: pageLanguage
},
'google_translate_element'
{
pageLanguage: autoTargetLanguage
},
'google_translate_element'
);

if (autoTargetLanguage != '' && autoTargetLanguage != pageLanguage ) {
waitForElm('#google_translate_element select option[value="' + autoTargetLanguage + '"]').then((gOption) => {
var gSelect = gOption.parentNode;
gSelect.selectedIndex= gOption.index;
gSelect.dispatchEvent(new Event('change'));
});
}

}
</script>
<script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Expand Down

0 comments on commit 0851104

Please sign in to comment.