Version Description
- Render gtranslate selector in a submenu if the menu link has gtranslate-parent class
- Bug fixed when select tag has more than one class assigned
Download this release
Release Info
Developer | edo888 |
Plugin | Translate WordPress with GTranslate |
Version | 2.8.19 |
Comparing to | |
See all releases |
Code changes from version 2.8.18 to 2.8.19
- gtranslate.php +12 -4
- readme.txt +5 -1
gtranslate.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: GTranslate
|
4 |
Plugin URI: https://gtranslate.io/?xyz=998
|
5 |
Description: Makes your website <strong>multilingual</strong> and available to the world using Google Translate. For support visit <a href="https://wordpress.org/support/plugin/gtranslate">GTranslate Support</a>.
|
6 |
-
Version: 2.8.
|
7 |
Author: Edvard Ananyan
|
8 |
Author URI: https://gtranslate.io
|
9 |
Text Domain: gtranslate
|
@@ -638,9 +638,9 @@ function hideGSatelites($) {
|
|
638 |
widget_code += "function GTranslateGetCurrentLang() {var keyValue = document['cookie'].match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}"+new_line;
|
639 |
widget_code += "function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}"+new_line;
|
640 |
if(analytics)
|
641 |
-
widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;if(typeof ga!='undefined'){ga('send', 'event', 'GTranslate', lang, location.hostname+location.pathname+location.search);}else{if(typeof _gaq!='undefined')_gaq.push(['_trackEvent', 'GTranslate', lang, location.hostname+location.pathname+location.search]);}var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(sel[i].className
|
642 |
else
|
643 |
-
widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(sel[i].className
|
644 |
if(widget_look == 'dropdown_with_flags') {
|
645 |
widget_code += "if(GTranslateGetCurrentLang() != null)jQuery(document).ready(function() {jQuery('div.switcher div.selected a').html(jQuery('div.switcher div.option').find('img[alt=\"'+GTranslateGetCurrentLang()+'\"]').parent().html());});"+new_line;
|
646 |
}
|
@@ -1590,7 +1590,15 @@ if(!empty($data['show_in_menu'])) {
|
|
1590 |
$html = str_replace('<a ', '<li style="position:relative;" class="menu-item menu-item-gtranslate"><a ', $html);
|
1591 |
$html = str_replace('</a>', '</a></li>', $html);
|
1592 |
|
1593 |
-
$items
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1594 |
}
|
1595 |
|
1596 |
}
|
3 |
Plugin Name: GTranslate
|
4 |
Plugin URI: https://gtranslate.io/?xyz=998
|
5 |
Description: Makes your website <strong>multilingual</strong> and available to the world using Google Translate. For support visit <a href="https://wordpress.org/support/plugin/gtranslate">GTranslate Support</a>.
|
6 |
+
Version: 2.8.19
|
7 |
Author: Edvard Ananyan
|
8 |
Author URI: https://gtranslate.io
|
9 |
Text Domain: gtranslate
|
638 |
widget_code += "function GTranslateGetCurrentLang() {var keyValue = document['cookie'].match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}"+new_line;
|
639 |
widget_code += "function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}"+new_line;
|
640 |
if(analytics)
|
641 |
+
widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;if(typeof ga!='undefined'){ga('send', 'event', 'GTranslate', lang, location.hostname+location.pathname+location.search);}else{if(typeof _gaq!='undefined')_gaq.push(['_trackEvent', 'GTranslate', lang, location.hostname+location.pathname+location.search]);}var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(/goog-te-combo/.test(sel[i].className)){teCombo=sel[i];break;}if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}"+new_line;
|
642 |
else
|
643 |
+
widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(/goog-te-combo/.test(sel[i].className)){teCombo=sel[i];break;}if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}"+new_line;
|
644 |
if(widget_look == 'dropdown_with_flags') {
|
645 |
widget_code += "if(GTranslateGetCurrentLang() != null)jQuery(document).ready(function() {jQuery('div.switcher div.selected a').html(jQuery('div.switcher div.option').find('img[alt=\"'+GTranslateGetCurrentLang()+'\"]').parent().html());});"+new_line;
|
646 |
}
|
1590 |
$html = str_replace('<a ', '<li style="position:relative;" class="menu-item menu-item-gtranslate"><a ', $html);
|
1591 |
$html = str_replace('</a>', '</a></li>', $html);
|
1592 |
|
1593 |
+
$items = str_replace('gtranslate-parent', 'gtranslate-parent menu-item-has-children', $items);
|
1594 |
+
$parent_item_position = strpos($items, 'gtranslate-parent');
|
1595 |
+
if($parent_item_position !== false) {
|
1596 |
+
$parent_link_position = strpos($items, '</a>', $parent_item_position);
|
1597 |
+
|
1598 |
+
$items = substr_replace($items, '</a><ul class="dropdown-menu sub-menu">'.$html.'</ul>', $parent_link_position, 4);
|
1599 |
+
} else {
|
1600 |
+
$items .= $html;
|
1601 |
+
}
|
1602 |
}
|
1603 |
|
1604 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Author: Edvard Ananyan
|
|
4 |
Tags: bilingual, multilingual, translate, translation, language, localization, translation proxy, i18n, l10n, localisation, multilanguage, google translate
|
5 |
Requires at least: 2.8.1
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 2.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Donate link: https://gtranslate.io/?xyz=998#pricing
|
@@ -211,6 +211,10 @@ You need to go to the language you want to edit, for instance, French: http://do
|
|
211 |
|
212 |
== Changelog ==
|
213 |
|
|
|
|
|
|
|
|
|
214 |
= 2.8.18 =
|
215 |
* Make sure default language is always selected
|
216 |
* Paid pricing updated
|
4 |
Tags: bilingual, multilingual, translate, translation, language, localization, translation proxy, i18n, l10n, localisation, multilanguage, google translate
|
5 |
Requires at least: 2.8.1
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 2.8.19
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Donate link: https://gtranslate.io/?xyz=998#pricing
|
211 |
|
212 |
== Changelog ==
|
213 |
|
214 |
+
= 2.8.19 =
|
215 |
+
* Render gtranslate selector in a submenu if the menu link has gtranslate-parent class
|
216 |
+
* Bug fixed when select tag has more than one class assigned
|
217 |
+
|
218 |
= 2.8.18 =
|
219 |
* Make sure default language is always selected
|
220 |
* Paid pricing updated
|