Make a fork of the google-translate-api package using fetch for credentials omit
This commit is contained in:
parent
33bf4d05c9
commit
caf14b616b
3 changed files with 10 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
||||||
"description": "Flashlang is a small browser extension to help you learn languages",
|
"description": "Flashlang is a small browser extension to help you learn languages",
|
||||||
"main": "webpack.config.js",
|
"main": "webpack.config.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@asmagin/google-translate-api": "^8.0.2",
|
"@asmagin/google-translate-api": "git+https://github.com/MaeIsBad/google-translate-api.git",
|
||||||
"@sveltejs/svelte-virtual-list": "^3.0.1",
|
"@sveltejs/svelte-virtual-list": "^3.0.1",
|
||||||
"svelte-feather-icons": "^4.0.0",
|
"svelte-feather-icons": "^4.0.0",
|
||||||
"svelte-select": "^4.4.7",
|
"svelte-select": "^4.4.7",
|
||||||
|
|
|
@ -18,10 +18,10 @@ export class GTranslate extends Translator {
|
||||||
toTranslate: string,
|
toTranslate: string,
|
||||||
langs: LanguagePair
|
langs: LanguagePair
|
||||||
): Promise<Translation> {
|
): Promise<Translation> {
|
||||||
const resp = await translate(toTranslate, {
|
const resp = await (translate as any)(toTranslate, {
|
||||||
from: langs.srcLang.code,
|
from: langs.srcLang.code,
|
||||||
to: langs.dstLang.code,
|
to: langs.dstLang.code,
|
||||||
});
|
}, {credentials: "omit"});
|
||||||
return {
|
return {
|
||||||
src: resp.from.text.value,
|
src: resp.from.text.value,
|
||||||
languages: langs,
|
languages: langs,
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
axios "^0.21.1"
|
axios "^0.21.1"
|
||||||
querystring "^0.2.1"
|
querystring "^0.2.1"
|
||||||
|
|
||||||
|
"@asmagin/google-translate-api@git+https://github.com/MaeIsBad/google-translate-api.git":
|
||||||
|
version "8.0.2"
|
||||||
|
resolved "git+https://github.com/MaeIsBad/google-translate-api.git#3cd4d4dabcde8a4bddab6c7dd074e92444408c1a"
|
||||||
|
dependencies:
|
||||||
|
axios "^0.21.1"
|
||||||
|
querystring "^0.2.1"
|
||||||
|
|
||||||
"@babel/code-frame@^7.0.0":
|
"@babel/code-frame@^7.0.0":
|
||||||
version "7.16.7"
|
version "7.16.7"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"
|
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"
|
||||||
|
|
Loading…
Reference in a new issue