Comments (10)
I'll try to look into this tomorrow, but I am going to guess that this is this way in the response, not in anything we do in the gem.
Thanks for the report though, I'll check to see if we can do anything in the gem to fix this.
from bing_translator-gem.
thanks for your prompt reply. I think you might be right. I tried sending translations which included \\r\\n
for example and those were preserved. Wonder where it's getting dropped.
I noticed while running the call in console that when it shows the xml it's about to send that the formatting seems to have been applied to the code there. not sure if that's relevant, might be a function of printing a string to console.
i had a look at bing online and that service doesn't strip /r /n ... you'd think they would have similar behaviour
from bing_translator-gem.
did you manage to find anything @codeblock ?
from bing_translator-gem.
@s01us To be fully honest, I haven't had a chance to look closely at this yet. Sorry! Give me another day or two and I will see what I can do. Sorry again for the delay.
As an aside, Loomio looks really neat. :)
from bing_translator-gem.
@s01us So I don't see a way to fix this in our call to the API - it looks to me like the API call is what is stripping it. That said, we can work around it by handling newlines ourselves and just making separate API calls for each chunk, then gluing them back together.
I added this "feature"/hack in 53bf9af - can you give it a try and see if it does what you expect?
You can use it like this:
translator.translate message_en_newlines, :from => :en, :to => :es, :keep_newlines => true
I know it's ugly, but I'm not sure that we can do much better than that :(
from bing_translator-gem.
I'll have a look tomorrow (new zealand time). I did some testing with
gsub.
E.g.
Gsub('\n', '\n') before the call then
Gsub('\n', '\n') after...
This preserves formatting, but seems pretty horrid... I wonder if splitting
calls up might break the translation as well.
On 1/05/2014 6:44 pm, "Ricky Elrod" [email protected] wrote:
@s01us https://github.com/s01us So I don't see a way to fix this in our
call to the API - it looks to me like the API call is what is stripping it.
That said, we can work around it by handling newlines ourselves and just
making separate API calls for each chunk, then gluing them back together.I added this "feature"/hack in 53bf9afhttps://github.com/CodeBlock/bing_translator-gem/commit/53bf9af- can you give it a try and see if it does what you expect?
You can use it like this:
translator.translate message_en_newlines, :from => :en, :to => :es, :keep_newlines => true
I know it's ugly, but I'm not sure that we can do much better than that :(
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/15#issuecomment-41884922
.
from bing_translator-gem.
Yeah, it's a pretty ugly hack. :(
from bing_translator-gem.
@s01us I'm going to revert the hack I added here a while back, because I don't think it's worth maintaining, as it stands and we never did a release with it. I don't really have a solution to this that isn't garbage. I think you'll want to take this up with upstream (Bing), unfortunately (but I'm not sure how far you'll get with that).
from bing_translator-gem.
I'm going to close this for now, but I'm extremely open to ideas on how to solve this if you think of something.
from bing_translator-gem.
Thanks for the heads up and having a go. All stoked to be able to offer
translation of connect with this. Thanks for your work!
On 4/09/2014 5:25 pm, "Ricky Elrod" [email protected] wrote:
I'm going to close this for now, but I'm extremely open to ideas on how to
solve this if you think of somehting.—
Reply to this email directly or view it on GitHub
#15 (comment)
.
from bing_translator-gem.
Related Issues (20)
- Translate Array and Detect Array is missing HOT 2
- Is there a quota imposed by MS? HOT 3
- balance method not available HOT 4
- getaddrinfo: Name or service not known HOT 2
- SSL Error while trying to use this gem HOT 1
- undefined method `headers' for HTTP:Module (BingTranslator::Exception) HOT 2
- bad URI(is not URI?) HOT 2
- raises a nil error when detecting white spaces
- Undefined method 'encoding' for nil:NilClass HOT 5
- How to test code using the bing_translator gem? HOT 1
- Are you releasing 5.0.0? HOT 1
- The received token is of incorrect token type. : ID=0261.V2_Soap.Translate.2BE299C8 HOT 1
- Detecting fails request
- Error with rubyntlm HOT 1
- Build is failing (missing key?) HOT 3
- Returning characters used/left per month HOT 1
- Error with savon version greater than 2.11.0 HOT 1
- Abbreviations? HOT 1
- Migration to API V3 HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bing_translator-gem.