How long will Discourse Translator with Google API take effect after enabled?

How long will Discourse Translator with Google API take effect after enabled?

1 Like

Can you elaborate on the question? Have you got it configured and it’s not working?

1 Like

Yes, I enabled, but there is no translate icon.

Make sure to view the content using an account whose locale is set differently from the content being viewed. A test account is useful for this; make sure you note how to change your account’s locale back if you experiment with it. :slight_smile:

1 Like

Hello @maiki

Change in Preferences > Interface > Interface language, right ?

How can I check whether the google translator api works on discourse?

Can I use the commands below to check whether google translator api works works?

./launcher enter app
rails c
DiscourseTranslator::Google.detect(Post.last)

Yes, that’s the setting to change. And then the translate button should appear for the language if it is a supported language in both Discourse and Google Translate. The button looks like a stylized globe, :globe_with_meridians:.

Hello @maiki

Yes, I did this. But still can’t find the Translate button.

How can I verify whether the Google Translate work on Discourse server ?

Hello @HAWK @maiki

Any update ?

How can I verify whether the Google Translate work on Discourse server ?

I can guarantee that it does! We’ve given you as much advice as we can above. If you’re still having issues you’re going to need to post more information.

2 Likes

Hello @HAWK

Just want to know how the verify whether google api works on Discourse server. Does the commands below are correct?

./launcher enter app
rails c
DiscourseTranslator::Google.detect(Post.last)

If you wouldn’t mind, please repeat a process I’ve just performed.

Here’s what I did;

Here’s what it looks like

You haven’t provided us a link to your forum, so you’re our only source of information. You say that it doesn’t work, but we haven’t yet ruled out your web browser, its settings, and its extensions. Getting confirmation that Discourse Translator has worked for you anywhere at all would be helpful.

You can check the logs in Discourse and your Google account. Error messages will often have direction on fixing an issue that is occurring.

It looks like you are trying to troubleshoot the API connection with the rails console; I don’t personally know if that method works.

@numbqq, please check your Discourse settings and ensure you’ve filled them out correctly, and also check your Google Cloud Translate account, which will have troubleshooting guides as well as showing usage, which you can use to determine if your site is connected. :slight_smile:

Here is the translator settings. My account language setting to English. Test account language setting to Chinese.

My account language setting to English.

Test account language setting to Chinese.

Test account create a topic with Chinese, but my account can’t find the translator icon.

Test Google translator API on Discourse server, and it works.

# export API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXX
# TEXT="My%20name%20is%20Steve"
# curl "https://translation.googleapis.com/language/translate/v2?target=es&key=${API_KEY}&q=${TEXT}"
{
  "data": {
    "translations": [
      {
        "translatedText": "Mi nombre es Steve",
        "detectedSourceLanguage": "en"
      }
    ]
  }
}

1 Like

It’s important to to test from two accounts where the locale is set differently, not just the content of the text.

First account: locale is English (US), and posts in English (US).
Second account: locale is Chinese, and when viewing the English (US) topic, should see the translate button.

Does that make sense?

1 Like

Hello @maiki

You can check the pics I post above.

My account locale is English.
My test account locale is Chinese.

I use my English account to view the post of test Chinese locale account, but I can’t find any translator icon.

Why is 50% of the post in English? That’s atypical, and will confuse the plugin when it tries to determine which language the post is written in. Please try writing posts in one language only.

I also really wish you would try this, as we have a single person testing with a single browser, so we need to determine if the issue is exclusive to your site, or affects all forums using the plugin (for you).

1 Like

Okay, I created a new topic wich one language, but still no luck.

Yes, for this forum, it works.

Hello @maiki

Any suggestions about this?

Okay, I moved to Microsoft Translator and it works well, so this means my setting on Discourse is correct.
I’m not sure what’s going wrong with Google Translator.

Hrm.

That would seem to point to the API key? I wonder if perhaps you copied and pasted it, and a space was included as the first or last character? That would cause it not to match what Google expects.

What I generally do to check whether that has happened is pasting into Firefox’s search bar, highlighting everything there using Ctrl A, then if there isn’t a space at either end, using Ctrl C to copy it and paste it elsewhere (in this case, Discourse).

There’s nothing particularly special about Firefox’s search bar, though; the important bit is having things constrained to a single line where you can easily see both ends.