Microsoft Translator API not working in Chrome Extension

257 views
Skip to first unread message

Rachel D

unread,
Mar 25, 2021, 4:44:28 PM3/25/21
to Chromium Extensions
Hi,

I am new to Chrome Extensions, and I have encountered a problem. I have posted my question on Stack Overflow, link here: https://stackoverflow.com/q/66600079/15382444

I’m just not sure what I’m doing wrong. Is it that I can’t do what I want to do in a chrome extension?

Many thanks in advance for any help,

Rachel.



Jackie Han

unread,
Mar 26, 2021, 2:56:44 AM3/26/21
to Rachel D, Chromium Extensions
Hi Rachel,

I have a self-use only translation extension, that supports many translate engines including MS Translator API. That api certainly can work in chrome extension, no problem, because it is a general REST service, and you added host url in "permissions" field of manifest.json.


Some suggestions,

First, you should do a basic test, in any extension page(not content script) fetch that api.

In manifest.json, For me, I add a permison "https://api.cognitive.microsofttranslator.com/*". I see yours is "api-eur.", maybe you should add "/*" after your hostname (I forget whether it must be).

405000: The request method is not supported for the requested resource.
Maybe, you should check your Azure service dashboard, the resource is enabled?


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/7dead607-042a-4526-8ead-7496f5d6e9d8n%40chromium.org.

Jackie Han

unread,
Mar 26, 2021, 3:12:11 AM3/26/21
to Rachel D, Chromium Extensions
Another bug(maybe not only one bug) in your code, post body is an array, not an object.

    const postData = [{"Text": text}];
    const body = JSON.stringify(postData);

henrick lundqvist

unread,
Mar 26, 2021, 3:44:38 AM3/26/21
to Rachel D, Jackie Han, Chromium Extensions
thanks for the answer.I'm really really bad at computers, almost completely analog you could say.  I bought the service with e-commerce from alidropship which promised more than they kept so now I stand here myself, I have at the time of writing been working for two and a half days in a row but I am so far behind in data habit so it will be  just a big annoying thing of all, especially when I have ADHD and do not understand everything then it itches all over my body, I know what code is and have done everything I can to not start with it so I feel like a turtle  on back greetings


From: chromium-...@chromium.org <chromium-...@chromium.org> on behalf of Jackie Han <han.g...@gmail.com>
Sent: Friday, March 26, 2021 8:11:43 AM
To: Rachel D <dup...@tcd.ie>
Cc: Chromium Extensions <chromium-...@chromium.org>
Subject: Re: [crx] Microsoft Translator API not working in Chrome Extension
 
Reply all
Reply to author
Forward
0 new messages