From 085110484a1ad7002107765f5c5f2d9bc29dc32e Mon Sep 17 00:00:00 2001 From: Guillaume MORET <90462045+AyakorK@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:18:03 +0200 Subject: [PATCH] fix: Google Translate widget not present on chrome (#66) --- app/views/layouts/decidim/_head_extra.html.erb | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/app/views/layouts/decidim/_head_extra.html.erb b/app/views/layouts/decidim/_head_extra.html.erb index 21749e6..0e63e07 100644 --- a/app/views/layouts/decidim/_head_extra.html.erb +++ b/app/views/layouts/decidim/_head_extra.html.erb @@ -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')); - }); - } - }