Translate WordPress with GTranslate - Version 2.8.20

Version Description

  • Google neural machine translations, better quality!!!
  • Added gzip compression for communication between server and client
  • Fixed issue with double translation
Download this release

Release Info

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

Code changes from version 2.8.19 to 2.8.20

Files changed (3) hide show
  1. gtranslate.php +1 -1
  2. readme.txt +10 -2
  3. url_addon/gtranslate.php +22 -5
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.19
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
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.20
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
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.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
@@ -24,6 +24,7 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
24
  **Features**
25
 
26
  * Free Google automatic machine translation
 
27
  * Hides "Suggest better translation" pop-up
28
  * Hides Google top frame after translation
29
  * Mouse over effect
@@ -125,7 +126,9 @@ GTranslate is a multilingual solution for your website.
125
  Yes! We have free version and paid versions with [advanced features](https://gtranslate.io/?xyz=998#pricing).
126
 
127
  = What is the quality of translation? =
128
- It's Google translation, hence Google quality. We use machine translations provided by Google Translate service. In the paid versions you can refine the translations manually and order professional translations directly from your site.
 
 
129
 
130
  = Are the translations provided free of charge? =
131
  Yes, we use Google Translate widget for website which provides free machine translations which makes it possible to make your wordpress website multilingual instantly upon installation.
@@ -211,6 +214,11 @@ You need to go to the language you want to edit, for instance, French: http://do
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
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.20
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
24
  **Features**
25
 
26
  * Free Google automatic machine translation
27
+ * New neural machine translations with excellent quality
28
  * Hides "Suggest better translation" pop-up
29
  * Hides Google top frame after translation
30
  * Mouse over effect
126
  Yes! We have free version and paid versions with [advanced features](https://gtranslate.io/?xyz=998#pricing).
127
 
128
  = What is the quality of translation? =
129
+ We use Google neural machine translations which are very accurate for popular language pairs. In the paid versions you can refine the translations manually and order professional translations directly from your site.
130
+
131
+ You can read this blog post for more info: https://gtranslate.io/blog/translation-quality-got-better-with-neural-machine-translations
132
 
133
  = Are the translations provided free of charge? =
134
  Yes, we use Google Translate widget for website which provides free machine translations which makes it possible to make your wordpress website multilingual instantly upon installation.
214
 
215
  == Changelog ==
216
 
217
+ = 2.8.20 =
218
+ * Google neural machine translations, better quality!!!
219
+ * Added gzip compression for communication between server and client
220
+ * Fixed issue with double translation
221
+
222
  = 2.8.19 =
223
  * Render gtranslate selector in a submenu if the menu link has gtranslate-parent class
224
  * Bug fixed when select tag has more than one class assigned
url_addon/gtranslate.php CHANGED
@@ -60,7 +60,7 @@ if(!function_exists("getallheaders")) {
60
 
61
  $request_headers = getallheaders();
62
 
63
- if(isset($request_headers['X-GT-Lang'])) {
64
  echo 'Please remove DNS cname records for GTranslate!';
65
  exit;
66
  }
@@ -70,7 +70,9 @@ $request_headers['Host'] = $host;
70
  if(isset($request_headers['HOST'])) unset($request_headers['HOST']);
71
  if(isset($request_headers['host'])) unset($request_headers['host']);
72
 
73
- $request_headers['Accept-Encoding'] = '';
 
 
74
  if(isset($request_headers['accept-encoding'])) unset($request_headers['accept-encoding']);
75
 
76
  if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
@@ -134,13 +136,25 @@ $header_size = $response_info['header_size'];
134
  $header = substr($response, 0, $header_size);
135
  $html = substr($response, $header_size);
136
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  $response_headers = explode(PHP_EOL, $header);
138
  //print_r($response_headers);
139
  $headers_sent = '';
140
  foreach($response_headers as $header) {
141
- if(!empty($header) and !preg_match('/Content\-Length|Transfer\-Encoding|Content\-Encoding|Link/', $header)) {
142
 
143
- if(preg_match('/^Location:/', $header))
144
  $header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
145
 
146
  $headers_sent .= $header;
@@ -170,7 +184,10 @@ if(isset($_GET['language_edit'])) {
170
  $html = str_replace('/tdn-bin/', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $glang . '/tdn-bin/', $html);
171
  }
172
 
173
- echo $html;
 
 
 
174
 
175
  function http_build_query_for_curl($arrays, &$new = array(), $prefix = null) { // flatten multidimentional array for post
176
  if(is_object($arrays)) {
60
 
61
  $request_headers = getallheaders();
62
 
63
+ if(isset($request_headers['X-GT-Lang']) or isset($request_headers['X-Gt-Lang']) or isset($request_headers['x-gt-lang'])) {
64
  echo 'Please remove DNS cname records for GTranslate!';
65
  exit;
66
  }
70
  if(isset($request_headers['HOST'])) unset($request_headers['HOST']);
71
  if(isset($request_headers['host'])) unset($request_headers['host']);
72
 
73
+ if(!function_exists('gzdecode'))
74
+ $request_headers['Accept-Encoding'] = '';
75
+
76
  if(isset($request_headers['accept-encoding'])) unset($request_headers['accept-encoding']);
77
 
78
  if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
136
  $header = substr($response, 0, $header_size);
137
  $html = substr($response, $header_size);
138
 
139
+ if(function_exists('gzdecode')) {
140
+ $return_gz = false;
141
+ $html_gunzip = gzdecode($html);
142
+
143
+ if($html_gunzip !== false) {
144
+ $html = $html_gunzip;
145
+ unset($html_gunzip);
146
+
147
+ $return_gz = true;
148
+ }
149
+ }
150
+
151
  $response_headers = explode(PHP_EOL, $header);
152
  //print_r($response_headers);
153
  $headers_sent = '';
154
  foreach($response_headers as $header) {
155
+ if(!empty($header) and !preg_match('/Content\-Length|Transfer\-Encoding|Link/i', $header)) {
156
 
157
+ if(preg_match('/^Location:/i', $header))
158
  $header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
159
 
160
  $headers_sent .= $header;
184
  $html = str_replace('/tdn-bin/', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' . $glang . '/tdn-bin/', $html);
185
  }
186
 
187
+ if(function_exists('gzencode') and isset($return_gz) and $return_gz)
188
+ echo gzencode($html);
189
+ else
190
+ echo $html;
191
 
192
  function http_build_query_for_curl($arrays, &$new = array(), $prefix = null) { // flatten multidimentional array for post
193
  if(is_object($arrays)) {