Index: trunk/extensions/Translate/utils/TranslationHelpers.php |
— | — | @@ -218,13 +218,16 @@ |
219 | 219 | global $wgProxyKey, $wgGoogleApiKey, $wgMemc; |
220 | 220 | |
221 | 221 | $code = $this->targetLanguage; |
222 | | - $definition = $this->getDefinition(); |
| 222 | + $definition = trim( strval( $this->getDefinition() ) ) ; |
223 | 223 | |
224 | 224 | $memckey = wfMemckey( 'translate-tmsug-badcodes' ); |
225 | 225 | $unsupported = $wgMemc->get( $memckey ); |
226 | 226 | |
227 | 227 | if ( isset( $unsupported[$code] ) ) return null; |
228 | | - if ( trim( strval( $definition ) ) === '' ) return null; |
| 228 | + if ( $definition === '' ) return null; |
| 229 | + /* There is 5000 *character* limit, but encoding needs to be taken into |
| 230 | + * account. Not sure if this applies also to post method. */ |
| 231 | + if ( strlen( rawurlencode( $definition ) ) > 4900 ) return null; |
229 | 232 | |
230 | 233 | $path = 'http://ajax.googleapis.com/ajax/services/language/translate'; |
231 | 234 | $options = array(); |