@@ -156,13 +156,13 @@ |
||
| 156 | 156 | $( function() { |
| 157 | 157 | $('#delete').click(function() { |
| 158 | 158 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/delete'; |
| 159 | - ?> |
|
| 159 | + ?> |
|
| 160 | 160 | $.get("{{ $url_route }}"+'/'+$('.trans-id').val()); |
| 161 | 161 | }); |
| 162 | 162 | $('#edit').click(function() { |
| 163 | 163 | var translation = $('.input-trans').val(); |
| 164 | 164 | <?php $url_route = url('/').'/'.config('laralang.default.prefix').'/edit'; |
| 165 | - ?> |
|
| 165 | + ?> |
|
| 166 | 166 | $.get("{{ $url_route }}"+'/'+$('.trans-id').val()+'/'+translation); |
| 167 | 167 | }); |
| 168 | 168 | |
@@ -205,52 +205,52 @@ |
||
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Get translation from mymemory API. |
|
| 210 | - */ |
|
| 211 | - private function mymemoryTrans() |
|
| 212 | - { |
|
| 213 | - // Check if it can be translated from online sources. |
|
| 214 | - |
|
| 215 | - $host = 'api.mymemory.translated.net'; |
|
| 216 | - if ($socket = @fsockopen($host, 80, $errno, $errstr, 30)) { |
|
| 217 | - |
|
| 218 | - // Host online |
|
| 219 | - $urlString = urlencode($this->string); |
|
| 220 | - $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
| 221 | - $json = file_get_contents($url); |
|
| 222 | - $data = json_decode($json); |
|
| 223 | - |
|
| 224 | - // Checking response status |
|
| 225 | - |
|
| 226 | - if ($data->responseStatus != 200) { |
|
| 227 | - if ($this->debug == true) { |
|
| 228 | - $details = $data->responseDetails; |
|
| 229 | - if ($data->responseStatus == 403) { |
|
| 230 | - $details = ($data->responseDetails); |
|
| 231 | - } |
|
| 232 | - $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
| 233 | - } |
|
| 208 | + /** |
|
| 209 | + * Get translation from mymemory API. |
|
| 210 | + */ |
|
| 211 | + private function mymemoryTrans() |
|
| 212 | + { |
|
| 213 | + // Check if it can be translated from online sources. |
|
| 214 | + |
|
| 215 | + $host = 'api.mymemory.translated.net'; |
|
| 216 | + if ($socket = @fsockopen($host, 80, $errno, $errstr, 30)) { |
|
| 217 | + |
|
| 218 | + // Host online |
|
| 219 | + $urlString = urlencode($this->string); |
|
| 220 | + $url = "http://$host/get?q=$urlString&langpair=$this->from%7C$this->to"; |
|
| 221 | + $json = file_get_contents($url); |
|
| 222 | + $data = json_decode($json); |
|
| 223 | + |
|
| 224 | + // Checking response status |
|
| 225 | + |
|
| 226 | + if ($data->responseStatus != 200) { |
|
| 227 | + if ($this->debug == true) { |
|
| 228 | + $details = $data->responseDetails; |
|
| 229 | + if ($data->responseStatus == 403) { |
|
| 230 | + $details = ($data->responseDetails); |
|
| 231 | + } |
|
| 232 | + $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>'; |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - return; |
|
| 236 | - } |
|
| 235 | + return; |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | 238 | |
| 239 | - $transObtained = $data->responseData->translatedText; |
|
| 239 | + $transObtained = $data->responseData->translatedText; |
|
| 240 | 240 | |
| 241 | - $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
| 241 | + $this->translation = ucfirst(strtolower(trim($transObtained))); |
|
| 242 | 242 | |
| 243 | - $this->checkSave(); |
|
| 243 | + $this->checkSave(); |
|
| 244 | 244 | |
| 245 | - fclose($socket); |
|
| 246 | - return; |
|
| 245 | + fclose($socket); |
|
| 246 | + return; |
|
| 247 | 247 | |
| 248 | - } else { |
|
| 248 | + } else { |
|
| 249 | 249 | |
| 250 | - //host offline |
|
| 251 | - $this->hostDown(); |
|
| 252 | - } |
|
| 253 | - } |
|
| 250 | + //host offline |
|
| 251 | + $this->hostDown(); |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Get translation from apertium API. |