CodeBlock/bing_translator-gem — pull request #11 by Envek (2013-10-09 00:43:54+00:00)
Title: Switch from HTTP API to SOAP API.

Hello.

I've rewritten gem a bit in internals, so now it uses Bing Translator SOAP API instead of HTTP API. Interface are left intact.

Reason is that's not practically possible to send maximum allowed 10000 symbols to Bing Translator, as for HTTP API web servers are refuses to process the request with 414 "Request is too long" error. Practical limit is about 2000 bytes, and for non-latin scripts this limit become very small if count in a symbols due to URL encoding. For example, 1 cyrillic symbol becomes 2 bytes in UTF-8 and 6 bytes when URL encoded (Cyrillic letter Я becomes %D0%AF, and CJK hieroglyph 私 becomes %E7%A7%81 - 9 bytes!).

As SOAP API uses XML-formatted requests that are sent to the server with POST method - this problem is gone.

The gem gets new runtime dependency: savon gem used for working with SOAP services.

I've written tests for long texts and html input/output. All tests are passing for me. Also I've tested it on one of my sites, where some of the texts are translated with this gem. It works.

What do you think?

P.S> Thanks for awesome gem.