Comments (21)
I can't reproduce this on RHEL 6, ruby 1.8.7p352, bing_translator 2.0.0, nokogiri 1.5.5 -- except for the peer certificate warning.
Can you provide any more detail about your environment? What ruby version, what distro/os?
from bing_translator-gem.
I'm receiving the same error.
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux] via RVM and Ubuntu 12.04.
nokogiri 1.5.5
from bing_translator-gem.
Authentication seems to be failing:
irb(main):006:0> t.send(:get_access_token)
=> {"error"=>"invalid_client", "error_description"=>"ACS50012: Authentication failed. \r\nTrace ID: 66446f52-7d09-41c3-b84b-13d741f18366\r\nTimestamp: 2012-07-22 19:09:04Z", "expires_at"=>2012-07-22 19:09:03 +0000}
from bing_translator-gem.
@vova4kin I was able to resolve my problem by changing the Client secret for the app by going to https://datamarket.azure.com/developer/applications/edit/#{app_name}
from bing_translator-gem.
Hm, I've been using the same client secret for a few months and couldn't reproduce this. :(
@crm114 Thanks for looking into this and sending #3.
I'll leave this open to see if changing the client secret works for @vova4kin. If it does/if I don't hear anything, I'll close this out in a few days.
Thanks guys.
from bing_translator-gem.
@crm114 thank you! there was really strange issue with token.
Looks like for new accounts you need to edit token once after automatically assigned
from bing_translator-gem.
Sorry to bring up an old issue. I'm having the problem: "Undefined namespace prefix: //xmlns:string"
Oddly, it worked great for me one day, then started acting up the next day. I'm using ruby 1.9.3p125, nokogiri 1.5.9. I also tried with nokogiri 1.5.5 since that was mentioned in this thread, but no luck. I tried bing_translator 3.0.0 and also tried pulling the latest from github.
It does seem to pull the @access_token fine. After attempting the translation, if I inspect my "translator" instance, there is an access_token.
I'm not sure what @vova4kin means by editing the token. I tried logging in to Azure and edited my application, but still no luck.
Any ideas what I've missed? Thanks!
from bing_translator-gem.
Nevermind. It looks like my over-eager testing used up my character quota on the service.
from bing_translator-gem.
We should probably handle that case and raise something more informative. I'll look into this.
from bing_translator-gem.
I'm having this issue from time to time and I still have plenty of remaining characters (like 1M+). The basic example (spanish = translator.translate 'Hello. This will be translated!', :from => 'en', :to => 'es'
) worked 5 minutes ago and now it doesn't work anymore.
from bing_translator-gem.
Really weird, I haven't been able to reproduce this yet. I will keep trying.
from bing_translator-gem.
I'm using bing_translator 3.2.0 and nokogiri 1.5.9 with Ruby 1.9.3p194 on Ubuntu 12.10. #detect
works but #translate
returns:
Nokogiri::XML::XPath::SyntaxError: Undefined namespace prefix: //xmlns:string
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in `evaluate'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in `block in xpath'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:150:in `map'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:150:in `xpath'
from /var/lib/gems/1.9.1/gems/bing_translator-3.2.0/lib/bing_translator.rb:45:in `translate'
from (irb):68
from /usr/bin/irb:12:in `<main>'
And I just generated a new token as said previously. translator.send(:get_access_token)
seems to work fine.
from bing_translator-gem.
Ok it was a kind of bug on Microsoft/Azure side. I reset my Microsoft account with a now token (again) and now everything seems fine.
I don't know why but I was able to use the online api address (with HTTP auth) but something was wrong with the client_secret
and I couldn't get a OAuth token through the API (I had to create my own wrapper around to find out).
New secret and it's working again.
from bing_translator-gem.
Hi, I had the same error returned for certain requests, reproducibly, but not all. Since it occurs when passing the result that comes back from the translation API, I added a line to save the response body, and saw that the reason was "Error 414 - URL too long". This probably means that the amount of text that can be sent in a GET request was exceeded.
That explains why I had the problem intermittently - I was sending text of varying size!
Maybe that was the case for some of you, too, or it was another error that was not passed on by the Ruby gem.
The Ruby gem should really return the actual error instead of a secondary one. Also, I think a POST request can be used for a higher text size limit, but I haven't tried yet.
from bing_translator-gem.
@hanaguma Are you able to post one of the failing/long requests?
I think you're right, if we can POST instead, that's better - and you're right about the error. If I can get something that consistently reproduces I'll look into the error thing right away. The POST thing will be slightly more, but not terribly, complex.
from bing_translator-gem.
I'm having this issue too. The response body was:
<html><body><h1>Argument Exception</h1><p>Method: Translate()</p><p>Parameter: from</p><p>Message: 'from' must be a valid language
Parameter name: from</p><code></code><p>message id=2241.V2_Rest.Translate.1CA05878</p></body></html>
I was using the sample without a "from" parameter to test autodetection.
from bing_translator-gem.
It seems that there's a disparity between languages supported for autodetection and languages supported for the actual translation in the Bing API.
Following:
translator.detect 'Dobar dan'
will detect the sentence (correctly) to be in croatian, however translating this sentence via
translator.translate 'Dobar dan', :to => :en
will fail with the above response.
from bing_translator-gem.
Huh, that's interesting and sounds like a bug upstream. I'll look into making this throw a more reasonable and descriptive exception, though.
from bing_translator-gem.
I've released 3.3.0 which makes the exception more descriptive.
from bing_translator-gem.
Actually Bing Translator can detect (almost?) all the languages but can only translate a few ones.
We can have the full list with translator.supported_language_codes
:
["ar", "bg", "ca", "zh-CHS", "zh-CHT", "cs", "da", "nl", "en", "et", "fi", "fr", "de", "el", "ht",
"he", "hi", "mww", "hu", "id", "it", "ja", "tlh", "tlh-QON", "ko", "lv", "lt", "ms", "no", "fa",
"pl", "pt", "ro", "ru", "sk", "sl", "es", "sv", "th", "tr", "uk", "ur", "vi"]
:hr
(croatian) is none of them. Moreover when I'm translating tweets with only hashtags, Bing detects :eu
which is not in the list either.
from bing_translator-gem.
Going to close this for now, if it still happens with the 4.2.0 release, feel free to re-open. :)
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
- \r \n are not preserved HOT 10
- 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.