Translate WordPress with GTranslate - Version 2.0.18

Version Description

  • Alternative flags added: USA flag, Brazil flag, Mexico flag
Download this release

Release Info

Developer edo888
Plugin Icon 128x128 Translate WordPress with GTranslate
Version 2.0.18
Comparing to
See all releases

Code changes from version 2.0.17 to 2.0.18

alt_flags.png ADDED
Binary file
alt_flagsa.png ADDED
Binary file
gtranslate-style16.css CHANGED
@@ -1,4 +1,9 @@
1
  a.gflag {font-size:16px;padding:1px 0;background-repeat:no-repeat;background-image:url(16.png);}
2
  a.gflag img {border:0;height:16px;display:inline;}
3
  a.gflag:hover {background-image:url(16a.png);}
4
- img.gstats {display:none;}
 
 
 
 
 
1
  a.gflag {font-size:16px;padding:1px 0;background-repeat:no-repeat;background-image:url(16.png);}
2
  a.gflag img {border:0;height:16px;display:inline;}
3
  a.gflag:hover {background-image:url(16a.png);}
4
+ img.gstats {display:none;}
5
+ a.alt_flag {background-image:url(alt_flags.png);}
6
+ a.alt_flag:hover {background-image:url(alt_flagsa.png);}
7
+ a.us_flag {background-position:-0px -0px;}
8
+ a.br_flag {background-position:-100px -0px;}
9
+ a.mx_flag {background-position:-200px -0px;}
gtranslate-style24.css CHANGED
@@ -1,4 +1,9 @@
1
  a.gflag {font-size:24px;padding:1px 0;background-repeat:no-repeat;background-image:url(24.png);}
2
  a.gflag img {border:0;height:24px;display:inline;}
3
  a.gflag:hover {background-image:url(24a.png);}
4
- img.gstats {display:none;}
 
 
 
 
 
1
  a.gflag {font-size:24px;padding:1px 0;background-repeat:no-repeat;background-image:url(24.png);}
2
  a.gflag img {border:0;height:24px;display:inline;}
3
  a.gflag:hover {background-image:url(24a.png);}
4
+ img.gstats {display:none;}
5
+ a.alt_flag {background-image:url(alt_flags.png);}
6
+ a.alt_flag:hover {background-image:url(alt_flagsa.png);}
7
+ a.us_flag {background-position:-0px -100px;}
8
+ a.br_flag {background-position:-100px -100px;}
9
+ a.mx_flag {background-position:-200px -100px;}
gtranslate-style32.css CHANGED
@@ -1,4 +1,9 @@
1
  a.gflag {font-size:32px;padding:1px 0;background-repeat:no-repeat;background-image:url(32.png);}
2
  a.gflag img {border:0;height:32px;display:inline;}
3
  a.gflag:hover {background-image:url(32a.png);}
4
- img.gstats {display:none;}
 
 
 
 
 
1
  a.gflag {font-size:32px;padding:1px 0;background-repeat:no-repeat;background-image:url(32.png);}
2
  a.gflag img {border:0;height:32px;display:inline;}
3
  a.gflag:hover {background-image:url(32a.png);}
4
+ img.gstats {display:none;}
5
+ a.alt_flag {background-image:url(alt_flags.png);}
6
+ a.alt_flag:hover {background-image:url(alt_flagsa.png);}
7
+ a.us_flag {background-position:-0px -200px;}
8
+ a.br_flag {background-position:-100px -200px;}
9
+ a.mx_flag {background-position:-200px -200px;}
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://gtranslate.io/forum/">GTranslate Forum</a>.
6
- Version: 2.0.17
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
 
@@ -252,7 +252,14 @@ function RefreshDoWidgetCode() {
252
  else if(enterprise_version)
253
  href = (lang == default_language) ? '$site_url' : '$site_url'.replace('$site_url'.split('/').slice(2, 3)[0].replace('www.', ''), lang + '.' + '$site_url'.split('/').slice(2, 3)[0].replace('www.', '')).replace('://www.', '://');
254
 
255
- widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');return false;" title="'+lang_name+'" class="gflag nturl" style="background-position:-'+flag_x+'px -'+flag_y+'px;"><img src="{$site_url}/wp-content/plugins/gtranslate/blank.png" height="'+flag_size+'" width="'+flag_size+'" alt="'+lang_name+'" /></a>';
 
 
 
 
 
 
 
256
  }
257
  });
258
  }
@@ -305,7 +312,14 @@ function RefreshDoWidgetCode() {
305
  // Adding slider html
306
  widget_preview += '<div class="switcher notranslate">'+new_line;
307
  widget_preview += '<div class="selected">'+new_line;
308
- widget_preview += '<a href="#" onclick="return false;"><span class="gflag" style="background-position:-'+languages_map[default_language.replace('-', '')+'_x']+'px -'+languages_map[default_language.replace('-', '')+'_y']+'px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+default_language+'" /></span>'+languages[language_codes.indexOf(default_language)]+'</a>'+new_line;
 
 
 
 
 
 
 
309
  widget_preview += '</div>'+new_line;
310
  widget_preview += '<div class="option">'+new_line;
311
  jQuery.each(languages, function(i, val) {
@@ -321,7 +335,14 @@ function RefreshDoWidgetCode() {
321
  else if(enterprise_version)
322
  href = (lang == default_language) ? '$site_url' : '$site_url'.replace('$site_url'.split('/').slice(2, 3)[0].replace('www.', ''), lang + '.' + '$site_url'.split('/').slice(2, 3)[0].replace('www.', '')).replace('://www.', '://');
323
 
324
- widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');jQuery(this).parent().parent().find(\'div.selected a\').html(jQuery(this).html());return false;" title="'+lang_name+'" class="nturl'+(default_language == lang ? ' selected' : '')+'"><span class="gflag" style="background-position:-'+flag_x+'px -'+flag_y+'px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+lang+'" /></span>'+lang_name+'</a>';
 
 
 
 
 
 
 
325
  }
326
  });
327
 
@@ -482,6 +503,10 @@ foreach($incl_langs as $lang)
482
  $script .= "jQuery('#incl_langs$lang').attr('checked', true);\n";
483
  foreach($fincl_langs as $lang)
484
  $script .= "jQuery('#fincl_langs$lang').attr('checked', true);\n";
 
 
 
 
485
  ?>
486
 
487
  <form id="gtranslate" name="form1" method="post" action="<?php echo admin_url('options-general.php?page=gtranslate_options'); ?>">
@@ -659,7 +684,7 @@ foreach($fincl_langs as $lang)
659
  <tr id="flag_languages_option" style="display:none;">
660
  <td class="option_name" colspan="2">Flag languages:<br /><br />
661
 
662
- <div>
663
  <div style="width:25%;float:left;">
664
  <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="fincl_langsaf" name="fincl_langs[]" value="af"><label for="fincl_langsaf">Afrikaans</label><br />
665
  <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="fincl_langssq" name="fincl_langs[]" value="sq"><label for="fincl_langssq">Albanian</label><br />
@@ -728,6 +753,11 @@ foreach($fincl_langs as $lang)
728
  </div>
729
  </div>
730
  <br /><br />
 
 
 
 
 
731
  </td>
732
  </tr>
733
  <tr id="line_break_option" style="display:none;">
@@ -987,6 +1017,7 @@ foreach($fincl_langs as $lang)
987
  $data['widget_code'] = isset($_POST['widget_code']) ? stripslashes($_POST['widget_code']) : '';
988
  $data['incl_langs'] = (isset($_POST['incl_langs']) and is_array($_POST['incl_langs'])) ? $_POST['incl_langs'] : array('en');
989
  $data['fincl_langs'] = (isset($_POST['fincl_langs']) and is_array($_POST['fincl_langs'])) ? $_POST['fincl_langs'] : array('en');
 
990
 
991
  echo '<p style="color:red;">Changes Saved</p>';
992
  update_option('GTranslate', $data);
@@ -1009,6 +1040,7 @@ foreach($fincl_langs as $lang)
1009
  $data['widget_code'] = isset($data['widget_code']) ? $data['widget_code'] : '';
1010
  $data['incl_langs'] = isset($data['incl_langs']) ? $data['incl_langs'] : array();
1011
  $data['fincl_langs'] = isset($data['fincl_langs']) ? $data['fincl_langs'] : array();
 
1012
  }
1013
  }
1014
 
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://gtranslate.io/forum/">GTranslate Forum</a>.
6
+ Version: 2.0.18
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
 
252
  else if(enterprise_version)
253
  href = (lang == default_language) ? '$site_url' : '$site_url'.replace('$site_url'.split('/').slice(2, 3)[0].replace('www.', ''), lang + '.' + '$site_url'.split('/').slice(2, 3)[0].replace('www.', '')).replace('://www.', '://');
254
 
255
+ if(lang == 'en' && jQuery('#alt_us:checked').length)
256
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');return false;" title="'+lang_name+'" class="gflag nturl alt_flag us_flag"><img src="{$site_url}/wp-content/plugins/gtranslate/blank.png" height="'+flag_size+'" width="'+flag_size+'" alt="'+lang_name+'" /></a>';
257
+ else if(lang == 'pt' && jQuery('#alt_br:checked').length)
258
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');return false;" title="'+lang_name+'" class="gflag nturl alt_flag br_flag"><img src="{$site_url}/wp-content/plugins/gtranslate/blank.png" height="'+flag_size+'" width="'+flag_size+'" alt="'+lang_name+'" /></a>';
259
+ else if(lang == 'es' && jQuery('#alt_mx:checked').length)
260
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');return false;" title="'+lang_name+'" class="gflag nturl alt_flag mx_flag"><img src="{$site_url}/wp-content/plugins/gtranslate/blank.png" height="'+flag_size+'" width="'+flag_size+'" alt="'+lang_name+'" /></a>';
261
+ else
262
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');return false;" title="'+lang_name+'" class="gflag nturl" style="background-position:-'+flag_x+'px -'+flag_y+'px;"><img src="{$site_url}/wp-content/plugins/gtranslate/blank.png" height="'+flag_size+'" width="'+flag_size+'" alt="'+lang_name+'" /></a>';
263
  }
264
  });
265
  }
312
  // Adding slider html
313
  widget_preview += '<div class="switcher notranslate">'+new_line;
314
  widget_preview += '<div class="selected">'+new_line;
315
+ if(default_language == 'en' && jQuery('#alt_us:checked').length)
316
+ widget_preview += '<a href="#" onclick="return false;"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-0px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+default_language+'" /></span>'+languages[language_codes.indexOf(default_language)]+'</a>'+new_line;
317
+ else if(default_language == 'pt' && jQuery('#alt_br:checked').length)
318
+ widget_preview += '<a href="#" onclick="return false;"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-100px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+default_language+'" /></span>'+languages[language_codes.indexOf(default_language)]+'</a>'+new_line;
319
+ else if(default_language == 'es' && jQuery('#alt_mx:checked').length)
320
+ widget_preview += '<a href="#" onclick="return false;"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-200px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+default_language+'" /></span>'+languages[language_codes.indexOf(default_language)]+'</a>'+new_line;
321
+ else
322
+ widget_preview += '<a href="#" onclick="return false;"><span class="gflag" style="background-position:-'+languages_map[default_language.replace('-', '')+'_x']+'px -'+languages_map[default_language.replace('-', '')+'_y']+'px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+default_language+'" /></span>'+languages[language_codes.indexOf(default_language)]+'</a>'+new_line;
323
  widget_preview += '</div>'+new_line;
324
  widget_preview += '<div class="option">'+new_line;
325
  jQuery.each(languages, function(i, val) {
335
  else if(enterprise_version)
336
  href = (lang == default_language) ? '$site_url' : '$site_url'.replace('$site_url'.split('/').slice(2, 3)[0].replace('www.', ''), lang + '.' + '$site_url'.split('/').slice(2, 3)[0].replace('www.', '')).replace('://www.', '://');
337
 
338
+ if(lang == 'en' && jQuery('#alt_us:checked').length)
339
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');jQuery(this).parent().parent().find(\'div.selected a\').html(jQuery(this).html());return false;" title="'+lang_name+'" class="nturl'+(default_language == lang ? ' selected' : '')+'"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-0px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+lang+'" /></span>'+lang_name+'</a>';
340
+ else if(lang == 'pt' && jQuery('#alt_br:checked').length)
341
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');jQuery(this).parent().parent().find(\'div.selected a\').html(jQuery(this).html());return false;" title="'+lang_name+'" class="nturl'+(default_language == lang ? ' selected' : '')+'"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-100px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+lang+'" /></span>'+lang_name+'</a>';
342
+ else if(lang == 'es' && jQuery('#alt_mx:checked').length)
343
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');jQuery(this).parent().parent().find(\'div.selected a\').html(jQuery(this).html());return false;" title="'+lang_name+'" class="nturl'+(default_language == lang ? ' selected' : '')+'"><span class="gflag" style="background-image:url($wp_plugin_url/alt_flags.png);background-position:-200px -0px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+lang+'" /></span>'+lang_name+'</a>';
344
+ else
345
+ widget_preview += '<a href="'+href+'" onclick="doGTranslate(\''+default_language+'|'+lang+'\');jQuery(this).parent().parent().find(\'div.selected a\').html(jQuery(this).html());return false;" title="'+lang_name+'" class="nturl'+(default_language == lang ? ' selected' : '')+'"><span class="gflag" style="background-position:-'+flag_x+'px -'+flag_y+'px;"><img src="$wp_plugin_url/blank.png" height="'+16+'" width="'+16+'" alt="'+lang+'" /></span>'+lang_name+'</a>';
346
  }
347
  });
348
 
503
  $script .= "jQuery('#incl_langs$lang').attr('checked', true);\n";
504
  foreach($fincl_langs as $lang)
505
  $script .= "jQuery('#fincl_langs$lang').attr('checked', true);\n";
506
+
507
+ // alt flags
508
+ foreach($alt_flags as $flag)
509
+ $script .= "jQuery('#alt_$flag').attr('checked', true);\n";
510
  ?>
511
 
512
  <form id="gtranslate" name="form1" method="post" action="<?php echo admin_url('options-general.php?page=gtranslate_options'); ?>">
684
  <tr id="flag_languages_option" style="display:none;">
685
  <td class="option_name" colspan="2">Flag languages:<br /><br />
686
 
687
+ <div style="overflow:hidden;">
688
  <div style="width:25%;float:left;">
689
  <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="fincl_langsaf" name="fincl_langs[]" value="af"><label for="fincl_langsaf">Afrikaans</label><br />
690
  <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="fincl_langssq" name="fincl_langs[]" value="sq"><label for="fincl_langssq">Albanian</label><br />
753
  </div>
754
  </div>
755
  <br /><br />
756
+ Alternative flags:<br /><br />
757
+ <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="alt_us" name="alt_flags[]" value="us"><label for="alt_us">USA flag</label><br />
758
+ <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="alt_br" name="alt_flags[]" value="br"><label for="alt_br">Brazil flag</label><br />
759
+ <input type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()" id="alt_mx" name="alt_flags[]" value="mx"><label for="alt_mx">Mexico flag</label><br />
760
+ <br /><br />
761
  </td>
762
  </tr>
763
  <tr id="line_break_option" style="display:none;">
1017
  $data['widget_code'] = isset($_POST['widget_code']) ? stripslashes($_POST['widget_code']) : '';
1018
  $data['incl_langs'] = (isset($_POST['incl_langs']) and is_array($_POST['incl_langs'])) ? $_POST['incl_langs'] : array('en');
1019
  $data['fincl_langs'] = (isset($_POST['fincl_langs']) and is_array($_POST['fincl_langs'])) ? $_POST['fincl_langs'] : array('en');
1020
+ $data['alt_flags'] = (isset($_POST['alt_flags']) and is_array($_POST['alt_flags'])) ? $_POST['alt_flags'] : array();
1021
 
1022
  echo '<p style="color:red;">Changes Saved</p>';
1023
  update_option('GTranslate', $data);
1040
  $data['widget_code'] = isset($data['widget_code']) ? $data['widget_code'] : '';
1041
  $data['incl_langs'] = isset($data['incl_langs']) ? $data['incl_langs'] : array();
1042
  $data['fincl_langs'] = isset($data['fincl_langs']) ? $data['fincl_langs'] : array();
1043
+ $data['alt_flags'] = isset($data['alt_flags']) ? $data['alt_flags'] : array();
1044
  }
1045
  }
1046
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Author: Edvard Ananyan
4
  Tags: translation proxy, localization, translate, translation, localization, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig
5
  Requires at least: 2.8
6
  Tested up to: 4.6
7
- Stable tag: 2.0.17
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
@@ -395,6 +395,9 @@ You need to go to the language you want to edit, for instance, French: http://do
395
 
396
  == Changelog ==
397
 
 
 
 
398
  = 2.0.17 =
399
  * GTranslate settings logo moved to localhost
400
 
4
  Tags: translation proxy, localization, translate, translation, localization, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig
5
  Requires at least: 2.8
6
  Tested up to: 4.6
7
+ Stable tag: 2.0.18
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
395
 
396
  == Changelog ==
397
 
398
+ = 2.0.18 =
399
+ * Alternative flags added: USA flag, Brazil flag, Mexico flag
400
+
401
  = 2.0.17 =
402
  * GTranslate settings logo moved to localhost
403