{"_id":"@dobermangood/google-translate-js","_rev":"3-8bb6bcf8d1ec86701738775421d1644d","name":"@dobermangood/google-translate-js","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@dobermangood/google-translate-js","version":"1.0.0","description":"A free and unlimited API for Google Translate that works in browser","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/DobermanGood/google-translate-js.git"},"scripts":{"build":"tsc --declaration"},"keywords":["translate","translator","google","translate","api","free","language","js"],"author":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"license":"MIT","dependencies":{"axios":"^0.19.0","querystring":"^0.2.0"},"devDependencies":{"typescript":"^3.3.3333"},"gitHead":"952687e255e8977f7b02d184a9a3cf434dcc3f3c","bugs":{"url":"https://github.com/DobermanGood/google-translate-js/issues"},"homepage":"https://github.com/DobermanGood/google-translate-js#readme","_id":"@dobermangood/google-translate-js@1.0.0","_nodeVersion":"8.10.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-hnOYP8Bi0X1bu4Ba10H3P8/A1gddvCk9NHFm6cBeJkSiyqY8cDT61N4H9Q2Sqz/7M8EzzOQj2/3Y2HXgk1IGrQ==","shasum":"4a0fa014a5ab6946f9a1b22432caececbe846a30","tarball":"https://registry.npmjs.org/@dobermangood/google-translate-js/-/google-translate-js-1.0.0.tgz","fileCount":4,"unpackedSize":10832,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJenYyNCRA9TVsSAnZWagAAeNsQAJlsZ6KlSkugJcNUrFNq\n79RUmrsgQi02xtlXH+p8pUjt6MytZWARRIIYVRUexV7dDOszK6hdmr/XVEt5\nG+6DZg8iIUehx8ndK79N7XBeoiayOIXXtl7AZd9qP4CuXDcAVWZFolNYgiEg\n1ZxBKNdFaiVFW5qpiE/KVdPOSm5jt17Ud9Qvzk/6pHRPTdsM3llyVGE9Xfh+\nSRSTH9TIsqgfM12aYvrQwS93969KOjAMFDN9Q6xQwZoOsjwS643fQ8jP9PMW\nBfLtYA9RgIa9NeBEqUsyz8/518d+IJCc/t/5n6ZOaEoVdFUqj730lIf9bXh0\nXqk+F71YdQW99fhHxDMHKplMF3/KPZBGkoqJvABxE4YlQYjvn085ed1Ne88p\nMvCST9YPx//jjmSrl60wHg2SoKH2qdk8MEFnsr6wPbjuzQhcslGgt7SmTW5J\n4vmjLtF1hxgyh9wX3zvEzJ9NA2eMusMgD1CYm/bZKrm7i61hFDSZMURbCpbT\nxsdaE7vTfdu8zs1lATikuhGxzX/xCNRpz1LNGLeYAI7MNWL8ENzr2aAZme9p\nTnwcB3F5Q4SR2n79wNm4wtUCyu0RnNsDGxEcILgbSyIHgxjbMSEYxwjJ8wC8\ndjr3H1glt+1E3uQZDDNKRPI+xsCVV81UACDLdDS378Bqnfm/mVbrSTimznS3\nerv3\r\n=64Yv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBGL4s6VhWKoppsgcdW8mauQQLai7v9+dmaqmZfHbTxAIgahYtxaypzveah3fggXo/RNdp+rGX42gkJONbBMdIn5M="}]},"maintainers":[{"name":"dobermangood","email":"mail.dobermangood@gmail.com"}],"_npmUser":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-translate-js_1.0.0_1587383436775_0.09208766726536544"},"_hasShrinkwrap":false},"1.0.1":{"name":"@dobermangood/google-translate-js","version":"1.0.1","description":"A free and unlimited API for Google Translate that works in browser","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/DobermanGood/google-translate-js.git"},"scripts":{"build":"tsc --declaration"},"keywords":["translate","translator","google","translate","api","free","language","js"],"author":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"license":"MIT","dependencies":{"axios":"^0.19.0","querystring":"^0.2.0"},"devDependencies":{"typescript":"^3.3.3333"},"gitHead":"952687e255e8977f7b02d184a9a3cf434dcc3f3c","bugs":{"url":"https://github.com/DobermanGood/google-translate-js/issues"},"homepage":"https://github.com/DobermanGood/google-translate-js#readme","_id":"@dobermangood/google-translate-js@1.0.1","_nodeVersion":"8.10.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-+6XPa8iOZawS+AIabvChlgxTV1J/7Xnyh10WJ2lrhHmZRIQ3iyPrlXCS0ypPP4ddE3FIzZs7bF13+4fJ5AWmcw==","shasum":"502b2a8d5a01518c1066426eae8a165bd5387ae3","tarball":"https://registry.npmjs.org/@dobermangood/google-translate-js/-/google-translate-js-1.0.1.tgz","fileCount":4,"unpackedSize":10776,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJenY2bCRA9TVsSAnZWagAAeiYP/R8QRAflHYrcoxFWsR1e\nLOXN0/FmF+iFhvPLrGrMLzJQbHwn1wBYvywzy3IqCXIngMNdYVESN5b69HRa\nQ1u5RQXWKN0U4eW5cSIhft+C1T59RQQKNLWUsaoE2VOxhtmhQdFFEejc2awd\nJD+KtyuN3NitRckHcxTBvFRwEpW8XcUDmvWaxpZlJzH1jUXFb6hNcYi2xh9D\n/F/ozTTfBx985HXnoE/xgJkARnPICtrLA0W/KnLRgTV01Yiwk0zTlCbPoVL9\n/7UXQFYjxtyVX/LnZ9Ye8VZKNDDjL4weXwkBhJVk5YJ+znDyU/E2VsHFt4N5\nJxuvEAtLCFMJFZSVuPmr2MRTG57Ki0pmot4Oh72Xn7tW5jJtja2ZKz9P6DWj\ntD0ZGWliFR/SnoRSNoUFwRWxnSXVVSiIZ7k30Rnw6AvjzL3CuTXTJDJ1mPU4\nR0eYkjCYIRkmPiIWUViVIym9kaehaaTuQjej9YAvDpxSYuIomnvNOi/snmZ2\nUQ+jJil38iCtuytveJjr+g7eBRVf9NtJEOp5+6f6qNc1LzZmmklm+IVTPewJ\nhK/ifX0ntMdFc6RyzSa96jBe7vaI8TUyk2HvYKmKDsPOxvKbIBiNFcGGarMu\nd3BqYGCz1zPA0Zf/gkT2MpZwmm8IsOagqJXqFe+NnvyJvKNQ8KcWXKa0RYPY\n1GZ6\r\n=e/R5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA09pM6cMP2vETB1nPBhB85ZX3ifO0+SXPa2MIryBOh9AiA9rOsSwCAZwwiNRLe/FLyINkeaP2RpkUjtFV7dmxtKPA=="}]},"maintainers":[{"name":"dobermangood","email":"mail.dobermangood@gmail.com"}],"_npmUser":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-translate-js_1.0.1_1587383706676_0.017379274503533493"},"_hasShrinkwrap":false},"1.0.2":{"name":"@dobermangood/google-translate-js","version":"1.0.2","description":"A free and unlimited API for Google Translate that works in browser","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/DobermanGood/google-translate-js.git"},"scripts":{"build":"tsc --declaration"},"keywords":["translate","translator","google","translate","api","free","language","js"],"author":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"license":"MIT","dependencies":{"axios":"^0.19.0","querystring":"^0.2.0"},"devDependencies":{"typescript":"^3.3.3333"},"gitHead":"caec2644876369b06b70a47eab3847ae9b5943a2","bugs":{"url":"https://github.com/DobermanGood/google-translate-js/issues"},"homepage":"https://github.com/DobermanGood/google-translate-js#readme","_id":"@dobermangood/google-translate-js@1.0.2","_nodeVersion":"8.10.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-SSi6wCC5ni19WJmTxzifOU1RuPotiBzZcg24XHojvRm45myUojZ4+tXcqb+YxJIdh10wBGgcXGgd6zki+kthqQ==","shasum":"a8af42a51fc082dd4add2747aa9713aae50b8753","tarball":"https://registry.npmjs.org/@dobermangood/google-translate-js/-/google-translate-js-1.0.2.tgz","fileCount":10,"unpackedSize":20194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJenZAZCRA9TVsSAnZWagAAhPcP/3IVHQIUVO2NrKX1eo6f\n6GsOnfPGVcH26zZN+s5IubHKub3ZuDR+WE7PksrGcOIyerWTW7j0dX12nMUw\n/q/ZK+1UYbYb4PofmCLihkkpKVVjcJbCjg2SyREBK5O8vN4kQkY70IesnpGN\n1+N77g44uiM8ZIZS8mHd90iEaiZ0hNu4Q7aRiIXn0V3D9FUS384mqRa+5gp5\ndLy+p21ExDDFV/Jzk1htIG/Y8CEX7wL0VKcYsB143wxJErAd+CWiob3V8VXx\nadtku0z/GFTHtfahkox3ASYc6AMCgwrDrbXusVG445l+Abl8a79AGyKPc0ur\nvVXtEV/eJc8ginzy2DoPaPRCLx1vhvHheSXdxKfgTcDMHl5SnRj1Qx+GTs4j\n2oe+7T//Gl3s/m0OfQGWGsS29erS+3ji5PBGYhxdzNuEsUXGO0VurzuWv8c9\nsMWX12YcR9ha1fQIX6TY4hVpBfuP2azdssv4CAod8hTKEl660acu2ISj+Dxa\nVagyZnsV9fq8F27tvLAZUi4Gu0LkqxD8ANetvGRBxLOGk50zKZZZVjpXtBD0\nPPUtmr9yd/qt1AQFUmQWDyE9rEbvoi+GfOJYoKOOUBFv7k8SI78Uk6HheTBr\nnpKaLxZFK4F5Yq7ZeeG6Ex1H9PCDuB//jP+O6UYNN6WaiZW9qRlgYaY/jBlw\ng/xk\r\n=80I9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnNh4D67bHe+iVH+a5w/HtyAyYocKYBtguEvG01r+72gIgQ2Jh5QmMSr8IGLZuE6w6/oTLJYOJYy7SaJ3vk9Wr7vc="}]},"maintainers":[{"name":"dobermangood","email":"mail.dobermangood@gmail.com"}],"_npmUser":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-translate-js_1.0.2_1587384345212_0.5779135372122277"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-20T11:50:36.739Z","1.0.0":"2020-04-20T11:50:36.958Z","modified":"2022-04-05T05:01:48.465Z","1.0.1":"2020-04-20T11:55:06.824Z","1.0.2":"2020-04-20T12:05:45.390Z"},"maintainers":[{"name":"dobermangood","email":"mail.dobermangood@gmail.com"}],"description":"A free and unlimited API for Google Translate that works in browser","homepage":"https://github.com/DobermanGood/google-translate-js#readme","keywords":["translate","translator","google","translate","api","free","language","js"],"repository":{"type":"git","url":"git+https://github.com/DobermanGood/google-translate-js.git"},"author":{"name":"dobermangood","email":"mail.dobermangood@gmail.com"},"bugs":{"url":"https://github.com/DobermanGood/google-translate-js/issues"},"license":"MIT","readme":"Based on [google-translate-api](https://github.com/matheuss/google-translate-api) and [google-translate-token](https://github.com/matheuss/google-translate-token)\n\n## Install\n\n```bash\nnpm i @dobermangood/google-translate-js\n```\n\nFor cross origin requests it uses [cors-anywhere\n](https://github.com/Rob--W/cors-anywhere). You can use public cors-anywhere server `https://cors-anywhere.herokuapp.com/` or set up your own. By default it does not use proxying.\n\n## Examples\n\nFor browser\n\n```javascript\nimport { setCORS } from \"google-translate-api-browser\";\n// setting up cors-anywhere server address\nconst translate = setCORS(\"http://cors-anywhere.herokuapp.com/\");\n/*\n// or\nimport translate, { setCORS } from \"google-translate-api-browser\";\nsetCORS(\"http://cors-anywhere.herokuapp.com/\");\n*/\ntranslate(\"Je ne mangé pas six jours\", { to: \"en\" })\n  .then(res => {\n    // I do not eat six days\n    console.log(res.text)\n  })\n  .catch(err => {\n    console.error(err);\n  });\n};\n```\n\nFor node\n\n```javascript\nvar { translate } = require(\"google-translate-api-browser\");\nvar readline = require(\"readline\");\n\nvar rl = readline.createInterface(process.stdin, process.stdout);\nrl.setPrompt(\"translate > \");\nrl.prompt();\n\nrl.on(\"line\", function(line) {\n  translate(line, { to: \"en\" })\n    .then(res => {\n      rl.setPrompt(line + \" > \" + res.text + \"\\ntranslate > \");\n      rl.prompt();\n    })\n    .catch(err => {\n      console.error(err);\n    });\n}).on(\"close\", function() {\n  process.exit(0);\n});\n```\n\n## API\n\n### setCORS(corsServerAddress)\n\n#### corsServerAddress\n\nType: `string`\n\nAddress of CORS server for proxying requests to google translate.\n\n### Returns a `translate` function\n\n### translate(text, options)\n\n#### text\n\nType: `string`\n\nThe text to be translated\n\n#### options\n\nType: `object`\n\n##### from\n\nType: `string` Default: `auto`\n\nThe `text` language. Must be `auto` or one of the codes/names (not case sensitive) contained in [languages.js](https://github.com/matheuss/google-translate-api/blob/master/languages.js)\n\n##### to\n\nType: `string` Default: `en`\n\nThe language in which the text should be translated. Must be one of the codes/names (not case sensitive) contained in [languages.js](https://github.com/matheuss/google-translate-api/blob/master/languages.js).\n\n##### raw\n\nType: `boolean` Default: `false`\n\nIf `true`, the returned object will have a `raw` property with the raw response (`string`) from Google Translate.\n\n### Returns an `object`:\n\n- `text` _(string)_ – The translated text.\n- `from` _(object)_\n  - `language` _(object)_\n    - `didYouMean` _(boolean)_ - `true` if the API suggest a correction in the source language\n    - `iso` _(string)_ - The [code of the language](https://github.com/matheuss/google-translate-api/blob/master/languages.js) that the API has recognized in the `text`\n  - `text` _(object)_\n    - `autoCorrected` _(boolean)_ – `true` if the API has auto corrected the `text`\n    - `value` _(string)_ – The auto corrected `text` or the `text` with suggested corrections\n    - `didYouMean` _(boolean)_ – `true` if the API has suggested corrections to the `text`\n- `raw` _(string)_ - If `options.raw` is true, the raw response from Google Translate servers. Otherwise, `''`.\n\nNote that `res.from.text` will only be returned if `from.text.autoCorrected` or `from.text.didYouMean` equals to `true`. In this case, it will have the corrections delimited with brackets (`[ ]`):\n\n```js\ntranslate(\"I spea Dutch\")\n  .then(res => {\n    console.log(res.from.text.value);\n    //=> I [speak] Dutch\n  })\n  .catch(err => {\n    console.error(err);\n  });\n```\n","readmeFilename":"README.md"}