{"id":16721085,"url":"https://github.com/khalyomede/translate","last_synced_at":"2026-04-16T19:06:16.504Z","repository":{"id":42819006,"uuid":"267976331","full_name":"khalyomede/translate","owner":"khalyomede","description":"Translate a string using the free translate.googleapis.com endpoint (no API key required).","archived":false,"fork":false,"pushed_at":"2023-01-06T07:24:04.000Z","size":1510,"stargazers_count":1,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T01:35:16.226Z","etag":null,"topics":["free","google","javascript","nodejs","npm","translate","typescript","unlimited"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/@khalyomede/translate","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khalyomede.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-29T23:44:13.000Z","updated_at":"2020-08-26T13:11:19.000Z","dependencies_parsed_at":"2023-02-05T15:01:06.076Z","dependency_job_id":null,"html_url":"https://github.com/khalyomede/translate","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Ftranslate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Ftranslate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Ftranslate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Ftranslate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalyomede","download_url":"https://codeload.github.com/khalyomede/translate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294459,"owners_count":20915337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["free","google","javascript","nodejs","npm","translate","typescript","unlimited"],"created_at":"2024-10-12T22:28:42.114Z","updated_at":"2026-04-16T19:06:16.460Z","avatar_url":"https://github.com/khalyomede.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @khalyomede/translate\n\nTranslate a string using the free translate.googleapis.com endpoint (no API key required).\n\n[![npm](https://img.shields.io/npm/v/@khalyomede/translate)](https://www.npmjs.com/package/@khalyomede/translate) [![NPM](https://img.shields.io/npm/l/@khalyomede/translate)](https://github.com/khalyomede/translate/blob/master/LICENSE) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/@khalyomede/translate) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@khalyomede/translate) ![npm type definitions](https://img.shields.io/npm/types/@khalyomede/translate)\n\n## Summary\n\n- [About](#about)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## About\n\nI want to build a small web app to translate a term into another (exactly like the Google Translate widget we can use when searching \"XYZ in english\").\n\nThe only packages on NPM I found are not working or use an API requiring an API key, which I do not want to use (because it asks for my credit card).\n\nThis package is using a public URL, which is not the same endpoint used in classic Google API. This URL has the huge advantage of not requiring any API key. The disadvantage is that it is not official (but used by several public translation services), so the result of the URL call might change (and I'll make sure when it happens to update it). It seems that the result has not changes in ages, but nothing is sure, so for huge scale project, you would not rely on this library, but rather using the official Google API.\n\n## Requirements\n\n- Node installed\n- NPM or Yarn installed\n\n## Installation\n\nIn your main project folder, add this package to your dependencies.\n\n### Using NPM\n\n```bash\nnpm install @khalyomede/translate\n```\n\n### Using Yarn\n\n```bash\nyarn add @khalyomede/translate\n```\n\n## Usage\n\n- [1. Using NodeJS](#1-using-nodejs)\n- [2. Using TypeScript](#2-using-typescript)\n- [3. Using the browser](#3-using-the-browser)\n\n### 1. Using NodeJS\n\nIn this example, we will simply translate the term \"Hello\" in French.\n\n```javascript\nconst translate = require(\"@khalyomede/translate\");\n\nconst main = async () =\u003e {\n  const translation = await translate(\"Hello\", { from: \"en\", to: \"fr\" });\n\n  console.log(\"Hello in french is \", translation);\n};\n\nmain();\n```\n\n### 2. Using TypeScript\n\nThis is the same example as above, but with typing support.\n\n```typescript\nimport translate from \"@khalyomede/translate\";\n\nconst translation: string = await translate(\"Hello\", [ from: \"en\", to: \"fr\" ]);\n\nconsole.log(\"Hello in french is \", translation);\n```\n\n### 3. Using the browser\n\nTo work in the browser, you need to add a script tag to download Axios. Here is an example:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"https://unpkg.com/@khalyomede/translate@0.1.0/dist/index.min.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n      translate(\"Hello\", { from: \"en\", to: \"fr\" }).then(function (translation) {\n        console.log(\"Hello in french is \", translation);\n      });\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Ftranslate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalyomede%2Ftranslate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Ftranslate/lists"}