GithubHelp home page GithubHelp logo

Comments (10)

relrod avatar relrod commented on July 17, 2024

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.

mixmix avatar mixmix commented on July 17, 2024

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.

mixmix avatar mixmix commented on July 17, 2024

did you manage to find anything @codeblock ?

from bing_translator-gem.

relrod avatar relrod commented on July 17, 2024

@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.

relrod avatar relrod commented on July 17, 2024

@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.

mixmix avatar mixmix commented on July 17, 2024

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.

relrod avatar relrod commented on July 17, 2024

Yeah, it's a pretty ugly hack. :(

from bing_translator-gem.

relrod avatar relrod commented on July 17, 2024

@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.

relrod avatar relrod commented on July 17, 2024

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.

mixmix avatar mixmix commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.