🇧🇪Belgium @Amedee

Account created on 18 April 2010, over 14 years ago
#

Recent comments

🇧🇪Belgium Amedee

The problem is that the module assumes that the original page is in English, and won't initially offer to translate in the current language.
Once you select another language, the page is no more in English, so it will appear in the selector.

I fixed it by hard-coding my site language in google_translator.module (French in my case):

164   unset($active_langages[0]);
165   if (!empty($active_langages)) {
166     $display_mode = variable_get('google_translator_active_languages_display_mode', '');
167     $display_mode = !empty($display_mode) ? 'layout: google.translate.TranslateElement.InlineLayout.' . $display_mode : '';
168     $default = "<span id='google_translator_element' class='google_translator'>{$close}</span><script>function googleTranslateElementInit() {
169   new google.translate.TranslateElement({
170     pageLanguage: 'fr',                                // <-- set site language here
171     includedLanguages: '" . implode(',', array_keys($active_langages)) . "'," . $display_mode . " }, 'google_translator_element');}</script>
172     <script src='//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'></script>";
173   }
174   return $default;
175 }

Ideally this should be a module configuration parameter

Production build 0.71.5 2024