Version Description
Download this release
Release Info
Developer | rm2773 |
Plugin | Google Language Translator |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 2.0
- admin.js +52 -0
- flags.js +10 -0
- google-language-translator.php +262 -42
- images/china.png +0 -0
- images/denmark.png +0 -0
- images/france.png +0 -0
- images/germany.png +0 -0
- images/italy.png +0 -0
- images/japan.png +0 -0
- images/spain.png +0 -0
- images/united-states.png +0 -0
- language-dropdown.js +0 -12
- readme.txt +65 -47
- settings.css +0 -1
admin.js
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function(){
|
2 |
+
var language_display = jQuery('input[name=googlelanguagetranslator_language_option]:checked').val();
|
3 |
+
|
4 |
+
if ( language_display == 'all') {
|
5 |
+
jQuery ('.languages').css('display','none');
|
6 |
+
jQuery ('.choose_flags').css('display','none');
|
7 |
+
|
8 |
+
} else if (language_display == 'specific') {
|
9 |
+
jQuery ('.languages').css('display','inline');
|
10 |
+
jQuery ('.choose_flags_intro').css('display','none');
|
11 |
+
jQuery ('.choose_flags').css('display','none');
|
12 |
+
}
|
13 |
+
|
14 |
+
jQuery('input[name=googlelanguagetranslator_language_option]').change(function(){
|
15 |
+
if( jQuery(this).val() == 'all'){
|
16 |
+
jQuery ('.languages').fadeOut("slow");
|
17 |
+
jQuery ('.choose_flags_intro').css('display','');
|
18 |
+
var flag_display = jQuery('input[name=googlelanguagetranslator_flags]:checked').val();
|
19 |
+
if ( flag_display == 'show_flags') {
|
20 |
+
jQuery ('.choose_flags').css('display','');
|
21 |
+
}
|
22 |
+
} else if (jQuery(this).val() == 'specific') {
|
23 |
+
jQuery ('.languages').fadeIn("slow");
|
24 |
+
jQuery ('.choose_flags_intro').css('display','none');
|
25 |
+
jQuery ('.choose_flags').css('display','none');
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
var language_display = jQuery('input[name=googlelanguagetranslator_language_option]:checked').val();
|
30 |
+
var flag_display = jQuery('input[name=googlelanguagetranslator_flags]:checked').val();
|
31 |
+
if ( flag_display == 'hide_flags') {
|
32 |
+
jQuery ('.choose_flags').css('display','none');
|
33 |
+
} else if (flag_display == 'show_flags') {
|
34 |
+
if ( language_display == 'all') {
|
35 |
+
jQuery ('.choose_flags').css('display','');
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
jQuery('input[name=googlelanguagetranslator_flags]').change(function(){
|
40 |
+
if( jQuery(this).val() == 'hide_flags'){
|
41 |
+
jQuery ('.choose_flags').fadeOut("slow");
|
42 |
+
} else if (jQuery(this).val() == 'show_flags') {
|
43 |
+
jQuery ('.choose_flags').fadeIn("slow");
|
44 |
+
}
|
45 |
+
});
|
46 |
+
});
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
flags.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*-------------------------------------------------------------------------------*
|
2 |
+
* Script for onClick trigger functionality used by flag images
|
3 |
+
* Full Credit: Edvard Ananyan at http://edo.webmaster.am (author of GTranslate translator plugin)
|
4 |
+
* GTranslate Free Version is licensed under GNU/GPL license
|
5 |
+
*-------------------------------------------------------------------------------*/
|
6 |
+
|
7 |
+
/* <![CDATA[ */
|
8 |
+
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('6 7(a,b){n{4(2.9){3 c=2.9("o");c.p(b,f,f);a.q(c)}g{3 c=2.r();a.s(\'t\'+b,c)}}u(e){}}6 h(a){4(a.8)a=a.8;4(a==\'\')v;3 b=a.w(\'|\')[1];3 c;3 d=2.x(\'y\');z(3 i=0;i<d.5;i++)4(d[i].A==\'B-C-D\')c=d[i];4(2.j(\'k\')==E||2.j(\'k\').l.5==0||c.5==0||c.l.5==0){F(6(){h(a)},G)}g{c.8=b;7(c,\'m\');7(c,\'m\')}}',43,43,'||document|var|if|length|function|GTranslateFireEvent|value|createEvent||||||true|else|doGoogleLanguageTranslator||getElementById|google_language_translator|innerHTML|change|try|HTMLEvents|initEvent|dispatchEvent|createEventObject|fireEvent|on|catch|return|split|getElementsByTagName|select|for|className|goog|te|combo|null|setTimeout|500'.split('|'),0,{}))
|
9 |
+
/* ]]> */
|
10 |
+
|
google-language-translator.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
-
Version:
|
6 |
Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
7 |
Author: Rob Myrick
|
8 |
Author URI: http://www.studio88design.com/
|
@@ -11,15 +11,20 @@ Author URI: http://www.studio88design.com/
|
|
11 |
function toggle_dropdown_script($hook_suffix) {
|
12 |
global $my_settings_page;
|
13 |
if ($my_settings_page == $hook_suffix) {
|
14 |
-
wp_enqueue_script( 'my-script', plugins_url('/
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
}
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
add_filter('widget_text', 'do_shortcode');
|
24 |
|
25 |
add_action('admin_menu', 'googlelanguagetranslator_menu_options');
|
@@ -56,7 +61,15 @@ function google_translator_shortcode() {
|
|
56 |
elseif(get_option('googlelanguagetranslator_showbranding')=='No'){
|
57 |
return googlelanguagetranslator_showbranding_no();
|
58 |
add_action ('wp_head','googlelanguagetranslator_showbranding_no');
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
if (get_option('googlelanguagetranslator_toolbar')=='Yes') {
|
@@ -88,6 +101,8 @@ function googlelanguagetranslator_menu_options(){
|
|
88 |
update_option('googlelanguagetranslator_toolbar',$_POST['googlelanguagetranslator_toolbar']);
|
89 |
update_option('googlelanguagetranslator_showbranding',$_POST['googlelanguagetranslator_showbranding']);
|
90 |
update_option('googlelanguagetranslator_language_option',$_POST['googlelanguagetranslator_language_option']);
|
|
|
|
|
91 |
}
|
92 |
|
93 |
if(isset($_POST['googlelanguagetranslator_update_options'])) {
|
@@ -100,8 +115,10 @@ function googlelanguagetranslator_menu_options(){
|
|
100 |
$get_language_choices['eu'] = $_POST['eu'];
|
101 |
$get_language_choices['be'] = $_POST['be'];
|
102 |
$get_language_choices['bn'] = $_POST['bn'];
|
|
|
103 |
$get_language_choices['bg'] = $_POST['bg'];
|
104 |
$get_language_choices['ca'] = $_POST['ca'];
|
|
|
105 |
$get_language_choices['zh-CN'] = $_POST['zh-CN'];
|
106 |
$get_language_choices['zh-TW'] = $_POST['zh-TW'];
|
107 |
$get_language_choices['cs'] = $_POST['cs'];
|
@@ -122,13 +139,16 @@ function googlelanguagetranslator_menu_options(){
|
|
122 |
$get_language_choices['ht'] = $_POST['ht'];
|
123 |
$get_language_choices['iw'] = $_POST['iw'];
|
124 |
$get_language_choices['hi'] = $_POST['hi'];
|
|
|
125 |
$get_language_choices['hu'] = $_POST['hu'];
|
126 |
$get_language_choices['is'] = $_POST['is'];
|
127 |
$get_language_choices['id'] = $_POST['id'];
|
128 |
$get_language_choices['ga'] = $_POST['ga'];
|
129 |
$get_language_choices['it'] = $_POST['it'];
|
130 |
$get_language_choices['ja'] = $_POST['ja'];
|
|
|
131 |
$get_language_choices['kn'] = $_POST['kn'];
|
|
|
132 |
$get_language_choices['ko'] = $_POST['ko'];
|
133 |
$get_language_choices['lo'] = $_POST['lo'];
|
134 |
$get_language_choices['la'] = $_POST['la'];
|
@@ -137,6 +157,7 @@ function googlelanguagetranslator_menu_options(){
|
|
137 |
$get_language_choices['mk'] = $_POST['mk'];
|
138 |
$get_language_choices['ms'] = $_POST['ms'];
|
139 |
$get_language_choices['mt'] = $_POST['mt'];
|
|
|
140 |
$get_language_choices['no'] = $_POST['no'];
|
141 |
$get_language_choices['fa'] = $_POST['fa'];
|
142 |
$get_language_choices['pl'] = $_POST['pl'];
|
@@ -160,8 +181,22 @@ function googlelanguagetranslator_menu_options(){
|
|
160 |
$get_language_choices['yi'] = $_POST['yi'];
|
161 |
update_option('language_display_settings', $get_language_choices);
|
162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
164 |
|
|
|
|
|
165 |
function googlelanguagetranslator_menu(){
|
166 |
if (!current_user_can('manage_options')) {
|
167 |
wp_die( __('You do not have sufficient permissions to access this page.') );
|
@@ -177,7 +212,7 @@ function googlelanguagetranslator_menu(){
|
|
177 |
<?php wp_nonce_field('update-options');?>
|
178 |
<table width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
|
179 |
<tr>
|
180 |
-
<td style="width:
|
181 |
<td><input class="activate" type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" <?php if(get_option('googlelanguagetranslator_active')==1){echo "checked";}?> />
|
182 |
Click Here to Activate Google Language Translator</td>
|
183 |
</tr>
|
@@ -185,7 +220,7 @@ function googlelanguagetranslator_menu(){
|
|
185 |
<tr>
|
186 |
<td>Choose the original language of your website</td>
|
187 |
<td>
|
188 |
-
<select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language" style="width:
|
189 |
<option value="en" <?php if(get_option('googlelanguagetranslator_language')=='en'){echo "selected";}?>>English</option>
|
190 |
<option value="es" <?php if(get_option('googlelanguagetranslator_language')=='es'){echo "selected";}?>>Spanish</option>
|
191 |
<option value="fr" <?php if(get_option('googlelanguagetranslator_language')=='fr'){echo "selected";}?>>French</option>
|
@@ -199,7 +234,7 @@ function googlelanguagetranslator_menu(){
|
|
199 |
</tr>
|
200 |
|
201 |
<tr>
|
202 |
-
<td>What translation languages will you display to website visitors
|
203 |
<td>
|
204 |
<input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if(get_option('googlelanguagetranslator_language_option')=='all'){echo "checked";}?>/> All Languages<br/>
|
205 |
<input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if(get_option('googlelanguagetranslator_language_option')=='specific'){echo "checked";}?>/> Specific Languages
|
@@ -217,13 +252,15 @@ function googlelanguagetranslator_menu(){
|
|
217 |
<div><input type="checkbox" name="az" value="1"<?php checked( isset ( $get_language_choices['az'] ) ); ?> /> Azerbaijani</div>
|
218 |
<div><input type="checkbox" name="eu" value="1"<?php checked( isset ( $get_language_choices['eu'] ) ); ?> /> Basque</div>
|
219 |
<div><input type="checkbox" name="be" value="1"<?php checked( isset ( $get_language_choices['be'] ) ); ?> /> Belarusian</div>
|
220 |
-
<div><input type="checkbox" name="bn" value="1"<?php checked( isset ( $get_language_choices['bn'] ) ); ?> /> Bengali</div>
|
|
|
221 |
<div><input type="checkbox" name="bg" value="1"<?php checked( isset ( $get_language_choices['bg'] ) ); ?> /> Bulgarian</div>
|
222 |
-
<div><input type="checkbox" name="ca" value="1"<?php checked( isset ( $get_language_choices['ca'] ) ); ?> /> Catalan</div>
|
|
|
223 |
<div><input type="checkbox" name="zh-CN" value="1"<?php checked( isset ( $get_language_choices['zh-CN'] ) ); ?> /> Chinese</div>
|
224 |
<div><input type="checkbox" name="zh-TW" value="1"<?php checked( isset ( $get_language_choices['zh-TW'] ) ); ?> /> Chinese (Han)</div>
|
225 |
-
<div><input type="checkbox" name="
|
226 |
-
<div><input type="checkbox" name="
|
227 |
<div><input type="checkbox" name="da" value="1"<?php checked( isset ( $get_language_choices['da'] ) ); ?> /> Danish</div>
|
228 |
<div><input type="checkbox" name="nl" value="1"<?php checked( isset ( $get_language_choices['nl'] ) ); ?> /> Dutch</div>
|
229 |
<div><input type="checkbox" name="en" value="1"<?php checked( isset ( $get_language_choices['en'] ) ); ?> /> English</div>
|
@@ -242,17 +279,20 @@ function googlelanguagetranslator_menu(){
|
|
242 |
<div><input type="checkbox" name="gu" value="1"<?php checked( isset ( $get_language_choices['gu'] ) ); ?> /> Gujarati</div>
|
243 |
<div><input type="checkbox" name="ht" value="1"<?php checked( isset ( $get_language_choices['ht'] ) ); ?> /> Haitian</div>
|
244 |
<div><input type="checkbox" name="iw" value="1"<?php checked( isset ( $get_language_choices['iw'] ) ); ?> /> Hebrew</div>
|
245 |
-
<div><input type="checkbox" name="hi" value="1"<?php checked( isset ( $get_language_choices['hi'] ) ); ?> /> Hindi</div>
|
|
|
246 |
<div><input type="checkbox" name="hu" value="1"<?php checked( isset ( $get_language_choices['hu'] ) ); ?> /> Hungarian</div>
|
247 |
<div><input type="checkbox" name="is" value="1"<?php checked( isset ( $get_language_choices['is'] ) ); ?> /> Icelandic</div>
|
248 |
<div><input type="checkbox" name="id" value="1"<?php checked( isset ( $get_language_choices['id'] ) ); ?> /> Indonesian</div>
|
249 |
<div><input type="checkbox" name="ga" value="1"<?php checked( isset ( $get_language_choices['ga'] ) ); ?> /> Irish</div>
|
|
|
250 |
</div>
|
251 |
|
252 |
-
<div class="languages" style="width:25%; float:left">
|
253 |
-
<div><input type="checkbox" name="
|
254 |
-
|
255 |
-
<div><input type="checkbox" name="kn" value="1"<?php checked( isset ( $get_language_choices['kn'] ) ); ?> /> Kannada</div>
|
|
|
256 |
<div><input type="checkbox" name="ko" value="1"<?php checked( isset ( $get_language_choices['ko'] ) ); ?> /> Korean</div>
|
257 |
<div><input type="checkbox" name="lo" value="1"<?php checked( isset ( $get_language_choices['lo'] ) ); ?> /> Lao</div>
|
258 |
<div><input type="checkbox" name="la" value="1"<?php checked( isset ( $get_language_choices['la'] ) ); ?> /> Latin</div>
|
@@ -260,7 +300,8 @@ function googlelanguagetranslator_menu(){
|
|
260 |
<div><input type="checkbox" name="lt" value="1"<?php checked( isset ( $get_language_choices['lt'] ) ); ?> /> Lithuanian</div>
|
261 |
<div><input type="checkbox" name="mk" value="1"<?php checked( isset ( $get_language_choices['mk'] ) ); ?> /> Macedonian</div>
|
262 |
<div><input type="checkbox" name="ms" value="1"<?php checked( isset ( $get_language_choices['ms'] ) ); ?> /> Malay</div>
|
263 |
-
<div><input type="checkbox" name="mt" value="1"<?php checked( isset ( $get_language_choices['mt'] ) ); ?> /> Maltese</div>
|
|
|
264 |
<div><input type="checkbox" name="no" value="1"<?php checked( isset ( $get_language_choices['no'] ) ); ?> /> Norwegian</div>
|
265 |
<div><input type="checkbox" name="fa" value="1"<?php checked( isset ( $get_language_choices['fa'] ) ); ?> /> Persian</div>
|
266 |
<div><input type="checkbox" name="pl" value="1"<?php checked( isset ( $get_language_choices['pl'] ) ); ?> /> Polish</div>
|
@@ -292,11 +333,50 @@ function googlelanguagetranslator_menu(){
|
|
292 |
|
293 |
</td>
|
294 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
<tr>
|
297 |
<td>Display options:</td>
|
298 |
<td>
|
299 |
-
<select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:
|
300 |
<option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
|
301 |
<option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
|
302 |
</select> </td>
|
@@ -305,7 +385,7 @@ function googlelanguagetranslator_menu(){
|
|
305 |
<tr>
|
306 |
<td>Show Google Toolbar?</td>
|
307 |
<td>
|
308 |
-
<select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:
|
309 |
<option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
|
310 |
<option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
|
311 |
</select> </td>
|
@@ -314,7 +394,7 @@ function googlelanguagetranslator_menu(){
|
|
314 |
<tr>
|
315 |
<td>Show Google Branding?</td>
|
316 |
<td>
|
317 |
-
<select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:
|
318 |
<option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
|
319 |
<option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
|
320 |
</select> </td>
|
@@ -410,7 +490,7 @@ function googlelanguagetranslator_included_languages() {
|
|
410 |
$comma_separated = implode(",",array_values($items));
|
411 |
|
412 |
if ( get_option('googlelanguagetranslator_display') == 'Vertical') {
|
413 |
-
$lang .= 'includedLanguages:\''.$comma_separated.'\'';
|
414 |
return $lang;
|
415 |
} elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
|
416 |
$lang .= 'includedLanguages:\''.$comma_separated.'\',';
|
@@ -422,27 +502,71 @@ function googlelanguagetranslator_included_languages() {
|
|
422 |
function googlelanguagetranslator_vertical(){
|
423 |
$language_choices = googlelanguagetranslator_included_languages();
|
424 |
if(get_option('googlelanguagetranslator_active')==1){
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
return '<div>'.$str.'</div>';
|
433 |
}
|
434 |
}
|
435 |
|
436 |
function googlelanguagetranslator_horizontal(){
|
437 |
-
|
438 |
if(get_option('googlelanguagetranslator_active')==1){
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
return '<div>'.$str.'</div>';
|
447 |
}
|
448 |
}
|
@@ -450,7 +574,7 @@ function googlelanguagetranslator_horizontal(){
|
|
450 |
function googlelanguagetranslator_toolbar_yes(){
|
451 |
if(get_option('googlelanguagetranslator_active')==1) { ?>
|
452 |
<style type="text/css">
|
453 |
-
#
|
454 |
.goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
|
455 |
.goog-tooltip {display: none !important;}
|
456 |
.goog-tooltip:hover {display: none !important;}
|
@@ -483,10 +607,28 @@ function googlelanguagetranslator_showbranding_yes() {
|
|
483 |
}
|
484 |
}
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
function googlelanguagetranslator_showbranding_no() {
|
487 |
if(get_option('googlelanguagetranslator_active')==1) { ?>
|
488 |
<style type="text/css">
|
489 |
-
#
|
490 |
.goog-te-gadget {color:transparent !important;}
|
491 |
.goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
|
492 |
.goog-tooltip {display: none !important;}
|
@@ -496,4 +638,82 @@ function googlelanguagetranslator_showbranding_no() {
|
|
496 |
<?php
|
497 |
}
|
498 |
}
|
499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
+
Version: 2.0
|
6 |
Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
7 |
Author: Rob Myrick
|
8 |
Author URI: http://www.studio88design.com/
|
11 |
function toggle_dropdown_script($hook_suffix) {
|
12 |
global $my_settings_page;
|
13 |
if ($my_settings_page == $hook_suffix) {
|
14 |
+
wp_enqueue_script( 'my-script', plugins_url('/admin.js',__FILE__), array('jquery'));
|
15 |
|
16 |
+
//if (get_option('googlelanguagetranslator_language_option')=='all') {
|
17 |
+
//wp_register_style( 'settings.css', plugins_url('/settings.css', __FILE__), array(), '1.0', 'all' );
|
18 |
+
//wp_enqueue_style( 'settings.css' );
|
19 |
+
//}
|
20 |
}
|
21 |
}
|
22 |
|
23 |
+
function flags() {
|
24 |
+
wp_enqueue_script( 'flags', plugins_url('/flags.js',__FILE__), array('jquery'));
|
25 |
+
}
|
26 |
+
add_action('wp_enqueue_scripts', 'flags');
|
27 |
+
|
28 |
add_filter('widget_text', 'do_shortcode');
|
29 |
|
30 |
add_action('admin_menu', 'googlelanguagetranslator_menu_options');
|
61 |
elseif(get_option('googlelanguagetranslator_showbranding')=='No'){
|
62 |
return googlelanguagetranslator_showbranding_no();
|
63 |
add_action ('wp_head','googlelanguagetranslator_showbranding_no');
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
if (get_option('googlelanguagetranslator_translatebox') == 'no') {
|
68 |
+
add_action ('wp_head', 'googlelanguagetranslator_translatebox');
|
69 |
+
}
|
70 |
+
|
71 |
+
if (get_option('googlelanguagetranslator_flags') == 'hide_flags') {
|
72 |
+
add_action ('wp_head','googlelanguagetranslator_flags');
|
73 |
}
|
74 |
|
75 |
if (get_option('googlelanguagetranslator_toolbar')=='Yes') {
|
101 |
update_option('googlelanguagetranslator_toolbar',$_POST['googlelanguagetranslator_toolbar']);
|
102 |
update_option('googlelanguagetranslator_showbranding',$_POST['googlelanguagetranslator_showbranding']);
|
103 |
update_option('googlelanguagetranslator_language_option',$_POST['googlelanguagetranslator_language_option']);
|
104 |
+
update_option('googlelanguagetranslator_flags', $_POST['googlelanguagetranslator_flags']);
|
105 |
+
update_option('googlelanguagetranslator_translatebox', $_POST['googlelanguagetranslator_translatebox']);
|
106 |
}
|
107 |
|
108 |
if(isset($_POST['googlelanguagetranslator_update_options'])) {
|
115 |
$get_language_choices['eu'] = $_POST['eu'];
|
116 |
$get_language_choices['be'] = $_POST['be'];
|
117 |
$get_language_choices['bn'] = $_POST['bn'];
|
118 |
+
$get_language_choices['bs'] = $_POST['bs'];
|
119 |
$get_language_choices['bg'] = $_POST['bg'];
|
120 |
$get_language_choices['ca'] = $_POST['ca'];
|
121 |
+
$get_language_choices['ceb'] = $_POST['ceb'];
|
122 |
$get_language_choices['zh-CN'] = $_POST['zh-CN'];
|
123 |
$get_language_choices['zh-TW'] = $_POST['zh-TW'];
|
124 |
$get_language_choices['cs'] = $_POST['cs'];
|
139 |
$get_language_choices['ht'] = $_POST['ht'];
|
140 |
$get_language_choices['iw'] = $_POST['iw'];
|
141 |
$get_language_choices['hi'] = $_POST['hi'];
|
142 |
+
$get_language_choices['hmn'] = $_POST['hmn'];
|
143 |
$get_language_choices['hu'] = $_POST['hu'];
|
144 |
$get_language_choices['is'] = $_POST['is'];
|
145 |
$get_language_choices['id'] = $_POST['id'];
|
146 |
$get_language_choices['ga'] = $_POST['ga'];
|
147 |
$get_language_choices['it'] = $_POST['it'];
|
148 |
$get_language_choices['ja'] = $_POST['ja'];
|
149 |
+
$get_language_choices['jw'] = $_POST['jw'];
|
150 |
$get_language_choices['kn'] = $_POST['kn'];
|
151 |
+
$get_language_choices['km'] = $_POST['km'];
|
152 |
$get_language_choices['ko'] = $_POST['ko'];
|
153 |
$get_language_choices['lo'] = $_POST['lo'];
|
154 |
$get_language_choices['la'] = $_POST['la'];
|
157 |
$get_language_choices['mk'] = $_POST['mk'];
|
158 |
$get_language_choices['ms'] = $_POST['ms'];
|
159 |
$get_language_choices['mt'] = $_POST['mt'];
|
160 |
+
$get_language_choices['mr'] = $_POST['mr'];
|
161 |
$get_language_choices['no'] = $_POST['no'];
|
162 |
$get_language_choices['fa'] = $_POST['fa'];
|
163 |
$get_language_choices['pl'] = $_POST['pl'];
|
181 |
$get_language_choices['yi'] = $_POST['yi'];
|
182 |
update_option('language_display_settings', $get_language_choices);
|
183 |
}
|
184 |
+
|
185 |
+
if(isset($_POST['googlelanguagetranslator_update_options'])) {
|
186 |
+
$get_flag_choices = get_option ('flag_display_settings');
|
187 |
+
$get_flag_choices['flag-zh-CN'] = $_POST['flag-zh-CN'];
|
188 |
+
$get_flag_choices['flag-en'] = $_POST['flag-en'];
|
189 |
+
$get_flag_choices['flag-fr'] = $_POST['flag-fr'];
|
190 |
+
$get_flag_choices['flag-de'] = $_POST['flag-de'];
|
191 |
+
$get_flag_choices['flag-it'] = $_POST['flag-it'];
|
192 |
+
$get_flag_choices['flag-es'] = $_POST['flag-es'];
|
193 |
+
$get_flag_choices['flag-da'] = $_POST['flag-da'];
|
194 |
+
update_option('flag_display_settings', $get_flag_choices);
|
195 |
+
}
|
196 |
}
|
197 |
|
198 |
+
|
199 |
+
|
200 |
function googlelanguagetranslator_menu(){
|
201 |
if (!current_user_can('manage_options')) {
|
202 |
wp_die( __('You do not have sufficient permissions to access this page.') );
|
212 |
<?php wp_nonce_field('update-options');?>
|
213 |
<table width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
|
214 |
<tr>
|
215 |
+
<td style="width:45%">Plugin Status:</td>
|
216 |
<td><input class="activate" type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" <?php if(get_option('googlelanguagetranslator_active')==1){echo "checked";}?> />
|
217 |
Click Here to Activate Google Language Translator</td>
|
218 |
</tr>
|
220 |
<tr>
|
221 |
<td>Choose the original language of your website</td>
|
222 |
<td>
|
223 |
+
<select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language" style="width:170px">
|
224 |
<option value="en" <?php if(get_option('googlelanguagetranslator_language')=='en'){echo "selected";}?>>English</option>
|
225 |
<option value="es" <?php if(get_option('googlelanguagetranslator_language')=='es'){echo "selected";}?>>Spanish</option>
|
226 |
<option value="fr" <?php if(get_option('googlelanguagetranslator_language')=='fr'){echo "selected";}?>>French</option>
|
234 |
</tr>
|
235 |
|
236 |
<tr>
|
237 |
+
<td>What translation languages will you display to website visitors?<br/>(Note: To show flags you must choose "All Languages")</td>
|
238 |
<td>
|
239 |
<input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if(get_option('googlelanguagetranslator_language_option')=='all'){echo "checked";}?>/> All Languages<br/>
|
240 |
<input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if(get_option('googlelanguagetranslator_language_option')=='specific'){echo "checked";}?>/> Specific Languages
|
252 |
<div><input type="checkbox" name="az" value="1"<?php checked( isset ( $get_language_choices['az'] ) ); ?> /> Azerbaijani</div>
|
253 |
<div><input type="checkbox" name="eu" value="1"<?php checked( isset ( $get_language_choices['eu'] ) ); ?> /> Basque</div>
|
254 |
<div><input type="checkbox" name="be" value="1"<?php checked( isset ( $get_language_choices['be'] ) ); ?> /> Belarusian</div>
|
255 |
+
<div><input type="checkbox" name="bn" value="1"<?php checked( isset ( $get_language_choices['bn'] ) ); ?> /> Bengali</div>
|
256 |
+
<div><input type="checkbox" name="bs" value="1"<?php checked( isset ( $get_language_choices['bs'] ) ); ?> /> Bosnian</div>
|
257 |
<div><input type="checkbox" name="bg" value="1"<?php checked( isset ( $get_language_choices['bg'] ) ); ?> /> Bulgarian</div>
|
258 |
+
<div><input type="checkbox" name="ca" value="1"<?php checked( isset ( $get_language_choices['ca'] ) ); ?> /> Catalan</div>
|
259 |
+
<div><input type="checkbox" name="ceb" value="1"<?php checked( isset ( $get_language_choices['ceb'] ) ); ?> /> Cebuano</div>
|
260 |
<div><input type="checkbox" name="zh-CN" value="1"<?php checked( isset ( $get_language_choices['zh-CN'] ) ); ?> /> Chinese</div>
|
261 |
<div><input type="checkbox" name="zh-TW" value="1"<?php checked( isset ( $get_language_choices['zh-TW'] ) ); ?> /> Chinese (Han)</div>
|
262 |
+
<div><input type="checkbox" name="hr" value="1"<?php checked( isset ( $get_language_choices['hr'] ) ); ?> /> Croatian</div>
|
263 |
+
<div><input type="checkbox" name="cs" value="1"<?php checked( isset ( $get_language_choices['cs'] ) ); ?> /> Czech</div>
|
264 |
<div><input type="checkbox" name="da" value="1"<?php checked( isset ( $get_language_choices['da'] ) ); ?> /> Danish</div>
|
265 |
<div><input type="checkbox" name="nl" value="1"<?php checked( isset ( $get_language_choices['nl'] ) ); ?> /> Dutch</div>
|
266 |
<div><input type="checkbox" name="en" value="1"<?php checked( isset ( $get_language_choices['en'] ) ); ?> /> English</div>
|
279 |
<div><input type="checkbox" name="gu" value="1"<?php checked( isset ( $get_language_choices['gu'] ) ); ?> /> Gujarati</div>
|
280 |
<div><input type="checkbox" name="ht" value="1"<?php checked( isset ( $get_language_choices['ht'] ) ); ?> /> Haitian</div>
|
281 |
<div><input type="checkbox" name="iw" value="1"<?php checked( isset ( $get_language_choices['iw'] ) ); ?> /> Hebrew</div>
|
282 |
+
<div><input type="checkbox" name="hi" value="1"<?php checked( isset ( $get_language_choices['hi'] ) ); ?> /> Hindi</div>
|
283 |
+
<div><input type="checkbox" name="hmn" value="1"<?php checked( isset ( $get_language_choices['hmn'] ) ); ?> /> Hmong</div>
|
284 |
<div><input type="checkbox" name="hu" value="1"<?php checked( isset ( $get_language_choices['hu'] ) ); ?> /> Hungarian</div>
|
285 |
<div><input type="checkbox" name="is" value="1"<?php checked( isset ( $get_language_choices['is'] ) ); ?> /> Icelandic</div>
|
286 |
<div><input type="checkbox" name="id" value="1"<?php checked( isset ( $get_language_choices['id'] ) ); ?> /> Indonesian</div>
|
287 |
<div><input type="checkbox" name="ga" value="1"<?php checked( isset ( $get_language_choices['ga'] ) ); ?> /> Irish</div>
|
288 |
+
<div><input type="checkbox" name="it" value="1"<?php checked( isset ( $get_language_choices['it'] ) ); ?> /> Italian</div>
|
289 |
</div>
|
290 |
|
291 |
+
<div class="languages" style="width:25%; float:left">
|
292 |
+
<div><input type="checkbox" name="ja" value="1"<?php checked( isset ( $get_language_choices['ja'] ) ); ?> /> Japanese</div>
|
293 |
+
<div><input type="checkbox" name="jw" value="1"<?php checked( isset ( $get_language_choices['jw'] ) ); ?> /> Javanese</div>
|
294 |
+
<div><input type="checkbox" name="kn" value="1"<?php checked( isset ( $get_language_choices['kn'] ) ); ?> /> Kannada</div>
|
295 |
+
<div><input type="checkbox" name="km" value="1"<?php checked( isset ( $get_language_choices['km'] ) ); ?> /> Khmer</div>
|
296 |
<div><input type="checkbox" name="ko" value="1"<?php checked( isset ( $get_language_choices['ko'] ) ); ?> /> Korean</div>
|
297 |
<div><input type="checkbox" name="lo" value="1"<?php checked( isset ( $get_language_choices['lo'] ) ); ?> /> Lao</div>
|
298 |
<div><input type="checkbox" name="la" value="1"<?php checked( isset ( $get_language_choices['la'] ) ); ?> /> Latin</div>
|
300 |
<div><input type="checkbox" name="lt" value="1"<?php checked( isset ( $get_language_choices['lt'] ) ); ?> /> Lithuanian</div>
|
301 |
<div><input type="checkbox" name="mk" value="1"<?php checked( isset ( $get_language_choices['mk'] ) ); ?> /> Macedonian</div>
|
302 |
<div><input type="checkbox" name="ms" value="1"<?php checked( isset ( $get_language_choices['ms'] ) ); ?> /> Malay</div>
|
303 |
+
<div><input type="checkbox" name="mt" value="1"<?php checked( isset ( $get_language_choices['mt'] ) ); ?> /> Maltese</div>
|
304 |
+
<div><input type="checkbox" name="mr" value="1"<?php checked( isset ( $get_language_choices['mr'] ) ); ?> /> Marathi</div>
|
305 |
<div><input type="checkbox" name="no" value="1"<?php checked( isset ( $get_language_choices['no'] ) ); ?> /> Norwegian</div>
|
306 |
<div><input type="checkbox" name="fa" value="1"<?php checked( isset ( $get_language_choices['fa'] ) ); ?> /> Persian</div>
|
307 |
<div><input type="checkbox" name="pl" value="1"<?php checked( isset ( $get_language_choices['pl'] ) ); ?> /> Polish</div>
|
333 |
|
334 |
</td>
|
335 |
</tr>
|
336 |
+
|
337 |
+
<tr>
|
338 |
+
<td class="choose_flags_intro">Show flag images?<br/>(Display up to 7 flags above the translator)</td>
|
339 |
+
<td class="choose_flags_intro">
|
340 |
+
<input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if(get_option('googlelanguagetranslator_flags')=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
|
341 |
+
<input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if(get_option('googlelanguagetranslator_flags')=='hide_flags'){echo "checked";}?>/> No, hide flag images
|
342 |
+
</td>
|
343 |
+
</tr>
|
344 |
+
|
345 |
+
<tr>
|
346 |
+
<td class="choose_flags">Choose the flags you want to display:</td>
|
347 |
+
|
348 |
+
<td class="choose_flags">
|
349 |
+
<div class="flagdisplay">
|
350 |
+
<?php $get_flag_choices = get_option ('flag_display_settings'); ?>
|
351 |
+
<div><input type="checkbox" name="flag-zh-CN" value="1"<?php checked( isset ( $get_flag_choices['flag-zh-CN'] ) ); ?> /> Chinese</div>
|
352 |
+
<div><input type="checkbox" name="flag-en" value="1"<?php checked( isset ( $get_flag_choices['flag-en'] ) ); ?> /> English</div>
|
353 |
+
<div><input type="checkbox" name="flag-fr" value="1"<?php checked( isset ( $get_flag_choices['flag-fr'] ) ); ?> /> French</div>
|
354 |
+
<div><input type="checkbox" name="flag-de" value="1"<?php checked( isset ( $get_flag_choices['flag-de'] ) ); ?> /> German</div>
|
355 |
+
<div><input type="checkbox" name="flag-it" value="1"<?php checked( isset ( $get_flag_choices['flag-it'] ) ); ?> /> Italian</div>
|
356 |
+
<div><input type="checkbox" name="flag-es" value="1"<?php checked( isset ( $get_flag_choices['flag-es'] ) ); ?> /> Spanish</div>
|
357 |
+
<div><input type="checkbox" name="flag-da" value="1"<?php checked( isset ( $get_flag_choices['flag-da'] ) ); ?> /> Danish</div>
|
358 |
+
|
359 |
+
</div>
|
360 |
+
|
361 |
+
<div style="clear:both"></div>
|
362 |
+
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
+
|
366 |
+
<tr>
|
367 |
+
<td>Show translate box?</td>
|
368 |
+
<td>
|
369 |
+
<select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:170px">
|
370 |
+
<option value="yes" <?php if(get_option('googlelanguagetranslator_translatebox')=='yes'){echo "selected";}?>>Yes, show language box</option>
|
371 |
+
<option value="no" <?php if(get_option('googlelanguagetranslator_translatebox')=='no'){echo "selected";}?>>No, hide language box</option>
|
372 |
+
</select>
|
373 |
+
</td>
|
374 |
+
</tr>
|
375 |
|
376 |
<tr>
|
377 |
<td>Display options:</td>
|
378 |
<td>
|
379 |
+
<select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
|
380 |
<option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
|
381 |
<option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
|
382 |
</select> </td>
|
385 |
<tr>
|
386 |
<td>Show Google Toolbar?</td>
|
387 |
<td>
|
388 |
+
<select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
|
389 |
<option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
|
390 |
<option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
|
391 |
</select> </td>
|
394 |
<tr>
|
395 |
<td>Show Google Branding?</td>
|
396 |
<td>
|
397 |
+
<select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
|
398 |
<option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
|
399 |
<option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
|
400 |
</select> </td>
|
490 |
$comma_separated = implode(",",array_values($items));
|
491 |
|
492 |
if ( get_option('googlelanguagetranslator_display') == 'Vertical') {
|
493 |
+
$lang .= 'includedLanguages:\''.$comma_separated.'\',';
|
494 |
return $lang;
|
495 |
} elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
|
496 |
$lang .= 'includedLanguages:\''.$comma_separated.'\',';
|
502 |
function googlelanguagetranslator_vertical(){
|
503 |
$language_choices = googlelanguagetranslator_included_languages();
|
504 |
if(get_option('googlelanguagetranslator_active')==1){
|
505 |
+
$str.= '<div id="flags">
|
506 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|en\');return false;" title="English" class="flag english"></a>
|
507 |
+
|
508 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|es\');return false;" title="Spanish" class="flag spanish"></a>
|
509 |
+
|
510 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|fr\');return false;" title="French" class="flag french"></a>
|
511 |
+
|
512 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|it\');return false;" title="Italian" class="flag italian"></a>
|
513 |
+
|
514 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|de\');return false;" title="German" class="flag german"></a>
|
515 |
+
|
516 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|da\');return false;" title="Danish" class="flag danish"></a>
|
517 |
+
|
518 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|zh-CN\');return false;" title="Chinese" class="flag chinese"></a>
|
519 |
+
|
520 |
+
</div>
|
521 |
+
<script type="text/javascript">
|
522 |
+
function GoogleLanguageTranslatorInit() {
|
523 |
+
new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\', '.$language_choices.'autoDisplay: false }, \'google_language_translator\'); }
|
524 |
+
</script><script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
|
525 |
+
<div id="google_language_translator"></div>';
|
526 |
+
// $str.='<div id="google_translate_element"></div><script>
|
527 |
+
//function googleTranslateElementInit() {
|
528 |
+
//new google.translate.TranslateElement({
|
529 |
+
//pageLanguage: \''.get_option('googlelanguagetranslator_language').'\', '.$language_choices.'
|
530 |
+
//}, \'google_translate_element\');
|
531 |
+
//}
|
532 |
+
//</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>';
|
533 |
return '<div>'.$str.'</div>';
|
534 |
}
|
535 |
}
|
536 |
|
537 |
function googlelanguagetranslator_horizontal(){
|
538 |
+
$language_choices = googlelanguagetranslator_included_languages();
|
539 |
if(get_option('googlelanguagetranslator_active')==1){
|
540 |
+
$str.= '<div id="flags">
|
541 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|en\');return false;" title="English" class="flag english"></a>
|
542 |
+
|
543 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|es\');return false;" title="Spanish" class="flag spanish"></a>
|
544 |
+
|
545 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|fr\');return false;" title="French" class="flag french"></a>
|
546 |
+
|
547 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|it\');return false;" title="Italian" class="flag italian"></a>
|
548 |
+
|
549 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|de\');return false;" title="German" class="flag german"></a>
|
550 |
+
|
551 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|da\');return false;" title="Danish" class="flag danish"></a>
|
552 |
+
|
553 |
+
<a href="#" onclick="doGoogleLanguageTranslator(\'en|zh-CN\');return false;" title="Chinese" class="flag chinese"></a>
|
554 |
+
|
555 |
+
</div>
|
556 |
+
<script type="text/javascript">
|
557 |
+
function GoogleLanguageTranslatorInit() {
|
558 |
+
new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\', '.$language_choices.' layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL }, \'google_language_translator\'); }
|
559 |
+
</script><script type="text/javascript" src="http://translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
|
560 |
+
<div id="google_language_translator"></div>';
|
561 |
+
//$language_choices = googlelanguagetranslator_included_languages();
|
562 |
+
//if(get_option('googlelanguagetranslator_active')==1){
|
563 |
+
// $str.='<div id="google_translate_element"></div><script>
|
564 |
+
//function googleTranslateElementInit() {
|
565 |
+
// new google.translate.TranslateElement({
|
566 |
+
// pageLanguage: \''.get_option('googlelanguagetranslator_language').'\', '.$language_choices.' layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
|
567 |
+
// }, \'google_translate_element\');
|
568 |
+
//}
|
569 |
+
//</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>';
|
570 |
return '<div>'.$str.'</div>';
|
571 |
}
|
572 |
}
|
574 |
function googlelanguagetranslator_toolbar_yes(){
|
575 |
if(get_option('googlelanguagetranslator_active')==1) { ?>
|
576 |
<style type="text/css">
|
577 |
+
#google_language_translator {color: transparent;}
|
578 |
.goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
|
579 |
.goog-tooltip {display: none !important;}
|
580 |
.goog-tooltip:hover {display: none !important;}
|
607 |
}
|
608 |
}
|
609 |
|
610 |
+
function googlelanguagetranslator_flags() {
|
611 |
+
if(get_option('googlelanguagetranslator_active') ==1) { ?>
|
612 |
+
<style type="text/css">
|
613 |
+
#flags { display:none; }
|
614 |
+
</style>
|
615 |
+
<?php
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
function googlelanguagetranslator_translatebox() {
|
620 |
+
if(get_option('googlelanguagetranslator_active') ==1) { ?>
|
621 |
+
<style type="text/css">
|
622 |
+
#google_language_translator { display:none; }
|
623 |
+
</style>
|
624 |
+
<?php
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
function googlelanguagetranslator_showbranding_no() {
|
629 |
if(get_option('googlelanguagetranslator_active')==1) { ?>
|
630 |
<style type="text/css">
|
631 |
+
#google_language_translator a {display: none !important;}
|
632 |
.goog-te-gadget {color:transparent !important;}
|
633 |
.goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
|
634 |
.goog-tooltip {display: none !important;}
|
638 |
<?php
|
639 |
}
|
640 |
}
|
641 |
+
|
642 |
+
function googlelanguagetranslator_flags_display() { ?>
|
643 |
+
<style type="text/css">
|
644 |
+
#flags a { display:inline-block; width:16px; height:12px; }
|
645 |
+
</style>
|
646 |
+
<?php $get_flag_choices = get_option ('flag_display_settings');
|
647 |
+
|
648 |
+
|
649 |
+
if ( isset ( $get_flag_choices['flag-zh-CN'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
650 |
+
<style type="text/css">
|
651 |
+
#flags a.chinese { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/china.png") 0px -1px no-repeat; }
|
652 |
+
</style>
|
653 |
+
<?php } else { ?>
|
654 |
+
<style type="text/css">
|
655 |
+
#flags a.chinese { display:none; }
|
656 |
+
</style>
|
657 |
+
<?php }
|
658 |
+
|
659 |
+
if ( isset ( $get_flag_choices['flag-en'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
660 |
+
<style type="text/css">
|
661 |
+
#flags a.english { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/united-states.png") 0px -1px no-repeat; }
|
662 |
+
</style>
|
663 |
+
<?php } else { ?>
|
664 |
+
<style type="text/css">
|
665 |
+
#flags a.english { display:none; }
|
666 |
+
</style>
|
667 |
+
<?php }
|
668 |
+
|
669 |
+
if ( isset ( $get_flag_choices['flag-fr'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
670 |
+
<style type="text/css">
|
671 |
+
#flags a.french { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/france.png") 0px -1px no-repeat; }
|
672 |
+
</style>
|
673 |
+
<?php } else { ?>
|
674 |
+
<style type="text/css">
|
675 |
+
#flags a.french { display:none; }
|
676 |
+
</style>
|
677 |
+
<?php }
|
678 |
+
|
679 |
+
if ( isset ( $get_flag_choices['flag-de'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
680 |
+
<style type="text/css">
|
681 |
+
#flags a.german { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/germany.png") 0px -1px no-repeat; }
|
682 |
+
</style>
|
683 |
+
<?php } else { ?>
|
684 |
+
<style type="text/css">
|
685 |
+
#flags a.german { display:none; }
|
686 |
+
</style>
|
687 |
+
<?php }
|
688 |
+
|
689 |
+
if ( isset ( $get_flag_choices['flag-it'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
690 |
+
<style type="text/css">
|
691 |
+
#flags a.italian { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/italy.png") 0px -1px no-repeat; }
|
692 |
+
</style>
|
693 |
+
<?php } else { ?>
|
694 |
+
<style type="text/css">
|
695 |
+
#flags a.italian { display:none; }
|
696 |
+
</style>
|
697 |
+
<?php }
|
698 |
+
|
699 |
+
if ( isset ( $get_flag_choices['flag-es'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
700 |
+
<style type="text/css">
|
701 |
+
#flags a.spanish { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/spain.png") 0px -1px no-repeat; }
|
702 |
+
</style>
|
703 |
+
<?php } else { ?>
|
704 |
+
<style type="text/css">
|
705 |
+
#flags a.spanish { display:none; }
|
706 |
+
</style>
|
707 |
+
<?php }
|
708 |
+
|
709 |
+
if ( isset ( $get_flag_choices['flag-da'] ) && (get_option('googlelanguagetranslator_language_option')=='all') ) { ?>
|
710 |
+
<style type="text/css">
|
711 |
+
#flags a.danish { background:url("<?php echo plugins_url(); ?>/google-language-translator/images/denmark.png") 0px -1px no-repeat; }
|
712 |
+
</style>
|
713 |
+
<?php } else { ?>
|
714 |
+
<style type="text/css">
|
715 |
+
#flags a.danish { display:none; }
|
716 |
+
</style>
|
717 |
+
<?php }
|
718 |
+
}
|
719 |
+
add_action('wp_head','googlelanguagetranslator_flags_display');
|
images/china.png
ADDED
Binary file
|
images/denmark.png
ADDED
Binary file
|
images/france.png
ADDED
Binary file
|
images/germany.png
ADDED
Binary file
|
images/italy.png
ADDED
Binary file
|
images/japan.png
ADDED
Binary file
|
images/spain.png
ADDED
Binary file
|
images/united-states.png
ADDED
Binary file
|
language-dropdown.js
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(){
|
2 |
-
|
3 |
-
jQuery('input[type="radio"][value="all"]').change(function() {
|
4 |
-
jQuery('.languages').css('display','none');
|
5 |
-
jQuery('label').css('display','none');
|
6 |
-
});
|
7 |
-
jQuery('input[type="radio"][value="specific"]').change(function() {
|
8 |
-
jQuery('.languages').css('display','inline');
|
9 |
-
jQuery('label').css('display','inline');
|
10 |
-
});
|
11 |
-
|
12 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,47 +1,65 @@
|
|
1 |
-
=== Google Language Translator ===
|
2 |
-
Contributors: Rob Myrick
|
3 |
-
Donate link: https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=c6aycTLE8Qho4lN9-QgzmJQKxNrRLomhJQ8gEAM2t5EZc5enxqC4Dpii-1C&dispatch=5885d80a13c0db1f8e263663d3faee8d0b7e678a25d883d0fa72c947f193f8fd
|
4 |
-
Plugin link: http://www.studio88design.com/plugins/google-language-translator
|
5 |
-
Tags: language translator, google translator, language translate, google, google language translator, translation, translate, multi language
|
6 |
-
Requires at least: 2.9
|
7 |
-
Tested up to: 3.
|
8 |
-
stable tag:
|
9 |
-
|
10 |
-
Welcome to Google Language Tranlator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
Settings include: inline or vertical layout, show/hide specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
15 |
-
|
16 |
-
== Installation ==
|
17 |
-
|
18 |
-
1. Download the zip folder named google-language-translator.zip
|
19 |
-
2. Unzip the folder and put it in the plugins directory of your wordpress installation. (wp-content/plugins).
|
20 |
-
3. Activate the plugin through the plugin window in the admin panel.
|
21 |
-
4. Go to Settings > Google Language Translator, enable the plugin, and then choose your settings.
|
22 |
-
5. Copy the shortcode and paste it into a page, post or widget.
|
23 |
-
6. Do not use the shortcode twice on a single page - it will not work.
|
24 |
-
|
25 |
-
== Frequently Asked Questions ==
|
26 |
-
|
27 |
-
== Changelog ==
|
28 |
-
|
29 |
-
1.1 The shortcode supplied on the settings page was updated to display '[google-translator]'.
|
30 |
-
|
31 |
-
1.2 Shortcode support is now available for adding [google-translator] to text widgets. I apologize for any inconvenience this may have caused.
|
32 |
-
|
33 |
-
1.3 HTML display problem in the sidebar area now fixed. Previously, inserting the [google-translator] plugin into a text widget caused it to display above the widget, instead of inside of it.
|
34 |
-
|
35 |
-
1.4 Corrected display problems associated with CSS styles not being placed correctly in wp_head.
|
36 |
-
|
37 |
-
1.5 Added "Original Language" support to the plugin settings, which allows the user to choose the original language of their website, which ultimately removes the original language as a choice in the language drop-down presented to website visitors.
|
38 |
-
|
39 |
-
1.6 Added "Specific Language" support to the plugin settings, which allows the user to choose specific languages that are displayed to website visitors.
|
40 |
-
|
41 |
-
1.7 Modified google-language-translator.php so that jQuery and CSS styles were enqueued properly onto the settings page only. Previously, jQuery functionality and CSS styles were being added to all pages of the Wordpresss Dashboard, which was causing functionality and display issues for some users.
|
42 |
-
|
43 |
-
1.8 Modified google-language-translator.php to display the correct output to the browser when horizontal layout is selected. Previously, it was not displaying at all.
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Google Language Translator ===
|
2 |
+
Contributors: Rob Myrick
|
3 |
+
Donate link: https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=c6aycTLE8Qho4lN9-QgzmJQKxNrRLomhJQ8gEAM2t5EZc5enxqC4Dpii-1C&dispatch=5885d80a13c0db1f8e263663d3faee8d0b7e678a25d883d0fa72c947f193f8fd
|
4 |
+
Plugin link: http://www.studio88design.com/plugins/google-language-translator
|
5 |
+
Tags: language translator, google translator, language translate, google, google language translator, translation, translate, multi language
|
6 |
+
Requires at least: 2.9
|
7 |
+
Tested up to: 3.52
|
8 |
+
stable tag: 2.0
|
9 |
+
|
10 |
+
Welcome to Google Language Tranlator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Settings include: inline or vertical layout, show/hide specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
|
15 |
+
|
16 |
+
== Installation ==
|
17 |
+
|
18 |
+
1. Download the zip folder named google-language-translator.zip
|
19 |
+
2. Unzip the folder and put it in the plugins directory of your wordpress installation. (wp-content/plugins).
|
20 |
+
3. Activate the plugin through the plugin window in the admin panel.
|
21 |
+
4. Go to Settings > Google Language Translator, enable the plugin, and then choose your settings.
|
22 |
+
5. Copy the shortcode and paste it into a page, post or widget.
|
23 |
+
6. Do not use the shortcode twice on a single page - it will not work.
|
24 |
+
|
25 |
+
== Frequently Asked Questions ==
|
26 |
+
|
27 |
+
== Changelog ==
|
28 |
+
|
29 |
+
1.1 The shortcode supplied on the settings page was updated to display '[google-translator]'.
|
30 |
+
|
31 |
+
1.2 Shortcode support is now available for adding [google-translator] to text widgets. I apologize for any inconvenience this may have caused.
|
32 |
+
|
33 |
+
1.3 HTML display problem in the sidebar area now fixed. Previously, inserting the [google-translator] plugin into a text widget caused it to display above the widget, instead of inside of it.
|
34 |
+
|
35 |
+
1.4 Corrected display problems associated with CSS styles not being placed correctly in wp_head.
|
36 |
+
|
37 |
+
1.5 Added "Original Language" support to the plugin settings, which allows the user to choose the original language of their website, which ultimately removes the original language as a choice in the language drop-down presented to website visitors.
|
38 |
+
|
39 |
+
1.6 Added "Specific Language" support to the plugin settings, which allows the user to choose specific languages that are displayed to website visitors.
|
40 |
+
|
41 |
+
1.7 Modified google-language-translator.php so that jQuery and CSS styles were enqueued properly onto the settings page only. Previously, jQuery functionality and CSS styles were being added to all pages of the Wordpresss Dashboard, which was causing functionality and display issues for some users.
|
42 |
+
|
43 |
+
1.8 Modified google-language-translator.php to display the correct output to the browser when horizontal layout is selected. Previously, it was not displaying at all.
|
44 |
+
|
45 |
+
1.9
|
46 |
+
|
47 |
+
- Added 7 flag image choices that, when clicked by website visitors, will change the language displayed, both on the website, AND in the drop-down box (flag language choices are limited to those provided in this plugin).
|
48 |
+
|
49 |
+
- Added 6 additional languages to the translator, as provided in Google's most recent updates ( new languages include Bosnian, Cebuano, Khmer, Marathi, Hmong, Javanese ).
|
50 |
+
|
51 |
+
- Corrected a minor technical issue where the Czech option (on the backend) was incorrectly displaying the Croatian language on the front end.
|
52 |
+
|
53 |
+
- Added jQuery functionality to the settings panel to improve the user experience.
|
54 |
+
|
55 |
+
- Added an option for users to display/hide the flag images.
|
56 |
+
|
57 |
+
- Added an option for users to display/hide the translate box when flags are displayed.
|
58 |
+
|
59 |
+
- Removed the settings.css file - I found a better way of displaying the options without CSS.
|
60 |
+
|
61 |
+
2.0 Corrected some immediate errors in the 1.9 update.
|
62 |
+
|
63 |
+
== Screenshots ==
|
64 |
+
|
65 |
+
1. Settings include: inline or vertical layout, hide/show Google toolbar, display specific languages, and show/hide Google branding. Add the shortcode to pages, posts, and widgets.
|
settings.css
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
label, .languages { display:none; }
|
|