(Alan Tan) #62

hmm It looks like your client id is incorrect?


It was working fine. Didn’t change it. Just recently tried to translate a thread, then i realized that there is something wrong.

Edit: I already double confirmed that my ID & secret are correct.

(Alan Tan) #64

You can verify that you are subscribed to the Translator API, by going to your My Data page on Windows Azure Marketplace. It may be that you have reached the maximum monthly volume limit and need to upgrade your subscription level.

Issue link

Try checking if you’ve reach the limit? :smile:


2,000,000 characters left… Something is not right here. It’s a problem from Azure side.

(Alan Tan) #66

I have a feeling the subscription is not setup correctly. Hmm try subscribing again? You can use a simpler client-id as well :slight_smile:


So, let me repeat this again. It was working fine 2 weeks ago when i installed it, suddenly it stopped working.

I’ve done the simpler client-id as well, still not working. Does the server has to be restarted for the changes to take effect?

(Sam Saffron) #68

I am seeing a ton of this in the logs @tgxworld :

Job exception: Request URL Too Long

Request URL Too Long
HTTP Error 414. The request URL is too long.

/var/www/discourse/plugins/discourse-translator/services/discourse_translator/microsoft.rb:121:in `result'
/var/www/discourse/plugins/discourse-translator/services/discourse_translator/microsoft.rb:78:in `detect'
/var/www/discourse/plugins/discourse-translator/plugin.rb:65:in `block in execute'
/var/www/discourse/lib/distributed_mutex.rb:21:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:5:in `synchronize'
/var/www/discourse/plugins/discourse-translator/plugin.rb:64:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Something plugin side feels broken, are you using GET when you should be using POST or something?

(Alan Tan) #69

Nope the server does not have to be restarted. :slightly_smiling:

(Tobias Eigen) #70

This is actually normal at the moment. It’s Microsoft complaining about trying to translate too much text. My logs are full of it… See above.

(Sam Saffron) #71

Microsoft have non GET endpoint which should at least return a correct error message. We will be moving to it this week.

(Aryan Raj) #72

I have setup Discourse by following Beginners Guide to Install Discourse on Ubuntu for Development. And I added Discourse Data Explorer plugin by

cd plugins && git clone https://github.com/discourse/discourse-data-explorer.git

and enabling plugin from admin panel. It worked.

Same thing does not work with Discourse Translator plugin. I have setup with the microsoft account and was able to get response using postman (POST /translator/translate.json).

But the button is not getting added to post-menu bar.
When I comment out this line, the button gets added to the post-menu but on click it shows this

By looking at the network tab it seems to be working correctly

I have spent a lot of time debugging and got a lot to learn about the codebase of discourse :smiley:
But still I am not able to fix it :disappointed: Could you tell me where am I going wrong?

(Aryan Raj) #73

@tgxworld Could you help?

(Alan Tan) #74

If you’re running this in development, make sure you have sidekiq running :slight_smile:

(Aryan Raj) #75

Thanks @tgxworld, it worked :thumbsup:
Now I am able to get button for all those posts which do not have same locale as me, but I am still getting
The error seems to be in this line.

return new PostCooked({ cookedText });

The function creates new PostCooked and passes cookedText as a parameter, but in PostCooked class, it uses this.attrs.cooked instead of cookedText

const $html = $(<div class='cooked'>${this.attrs.cooked}</div>);

Probable fix should be cooked function should be changed to :

cooked(cooked) {
  return new PostCooked({ cooked });

It that correct or have I gone somewhere wrong?
I would like to add PR if it is fine :smiley:

Edit: Should this be reported as a bug?

(Alan Tan) #76

Feel free to submit a PR :slight_smile:

Thanks for the Google Translate Adapter. I’ll review it soon.

(Aryan Raj) #77

I was going to mention about the Google Translate Adaptor

I have added PR for the fix on PostCooked

(Alan Tan) #78

Sorry for the delay. I’ve just pushed a new version to fix the length limits issue.

Right now, we’ll just give up and notify the user if the post is too long to be translated. Ideally, we’ll want to be truncating HTML but I’ll leave that for another day.

(Pad Pors) #79

the plugin is great & thanks :smiley:
hope these are not duplicates, as i couldn’t read the threads yet;

  • this only translates from english to other languages, am i right? since when i tried to translate the persian language in the en-locale, i got a simple error:
    "the translator is unable to translate this language."
    any way i can solve this problem hopefully?

  • within a post, if the first characters are in the other languages rather than the locale, it detects the foreign language and shows the translator-button. otherwise not.

  • is the 2-million characters-budget used even when you don’t push the translator button?

(Tobias Eigen) #80

A feature request. Allow not logged in users to access the translate button, to translate to the locale detected in their Web browser. I can see how this might become burdensome, so offer it as an admin configurable setting.

(Jeff Atwood) #81

Maybe. Most of these translation services start charging above a certain request volume, so you are opening yourself up to expenses incurred by people who don’t even bother to log in but jam on the translate button.