How long will Discourse Translator with Google API take effect after enabled?
Can you elaborate on the question? Have you got it configured and itâs not working?
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.
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, .
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 ?
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.
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;
- Registered an account on https://community.aseprite.org/ using https://temp-mail.org/en/
- Visited this thread which is in Spanish (my primarily language is English)
- The post, when Iâm logged in, has a (functional!) button for the translation
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.
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"
}
]
}
}
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?
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).
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.