@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $('#delete').click(function() { |
| 233 | 233 | var trans_id = $('.trans-id').val(); |
| 234 | 234 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/delete'; |
| 235 | - ?> |
|
| 235 | + ?> |
|
| 236 | 236 | $.ajax({ |
| 237 | 237 | type: "POST", |
| 238 | 238 | url: "{{ $url_route }}", |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $('#delete-all-button-confirm').click(function() { |
| 250 | 250 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/delete/all'; |
| 251 | - ?> |
|
| 251 | + ?> |
|
| 252 | 252 | $.ajax({ |
| 253 | 253 | type: "POST", |
| 254 | 254 | url: "{{ $url_route }}", |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $('#edit').click(function() { |
| 266 | 266 | var trans_id = $('.trans-id').val(); |
| 267 | 267 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/edit'; |
| 268 | - ?> |
|
| 268 | + ?> |
|
| 269 | 269 | $.ajax({ |
| 270 | 270 | type: "POST", |
| 271 | 271 | url: "{{ $url_route }}", |
@@ -5,38 +5,38 @@ |
||
| 5 | 5 | class MymemoryTrans extends Translation |
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | - * Get translation from mymemory API. |
|
| 9 | - */ |
|
| 10 | - public function main() |
|
| 11 | - { |
|
| 12 | - $host = 'api.mymemory.translated.net'; |
|
| 13 | - |
|
| 14 | - // Check if host is online. |
|
| 15 | - if ($this->checkHost($host)) { |
|
| 16 | - |
|
| 17 | - // Host online |
|
| 18 | - $urlString = urlencode($this->string); |
|
| 19 | - $urldata = file_get_contents("http://$host/get?q=$urlString&langpair=$this->from|$this->to"); |
|
| 20 | - $data = json_decode($urldata, true); |
|
| 21 | - |
|
| 22 | - if ($data['responseStatus'] != 200) { |
|
| 23 | - if ($this->debug == true) { |
|
| 24 | - if ($data['responseStatus'] == 403) { |
|
| 25 | - $details = ($data['responseDetails']); |
|
| 26 | - } else { |
|
| 27 | - $details = $data['responseDetails']; |
|
| 28 | - } |
|
| 29 | - $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - return; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $this->translation = $data['responseData']['translatedText']; |
|
| 36 | - |
|
| 37 | - $this->checkSave(); |
|
| 38 | - |
|
| 39 | - return; |
|
| 40 | - } |
|
| 41 | - } |
|
| 8 | + * Get translation from mymemory API. |
|
| 9 | + */ |
|
| 10 | + public function main() |
|
| 11 | + { |
|
| 12 | + $host = 'api.mymemory.translated.net'; |
|
| 13 | + |
|
| 14 | + // Check if host is online. |
|
| 15 | + if ($this->checkHost($host)) { |
|
| 16 | + |
|
| 17 | + // Host online |
|
| 18 | + $urlString = urlencode($this->string); |
|
| 19 | + $urldata = file_get_contents("http://$host/get?q=$urlString&langpair=$this->from|$this->to"); |
|
| 20 | + $data = json_decode($urldata, true); |
|
| 21 | + |
|
| 22 | + if ($data['responseStatus'] != 200) { |
|
| 23 | + if ($this->debug == true) { |
|
| 24 | + if ($data['responseStatus'] == 403) { |
|
| 25 | + $details = ($data['responseDetails']); |
|
| 26 | + } else { |
|
| 27 | + $details = $data['responseDetails']; |
|
| 28 | + } |
|
| 29 | + $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $this->translation = $data['responseData']['translatedText']; |
|
| 36 | + |
|
| 37 | + $this->checkSave(); |
|
| 38 | + |
|
| 39 | + return; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | } |