{"id":16883173,"url":"https://github.com/wilsonwu/translation-google","last_synced_at":"2026-03-16T18:33:40.308Z","repository":{"id":57379159,"uuid":"247106521","full_name":"wilsonwu/translation-google","owner":"wilsonwu","description":"A Google Translate component for Nodejs.","archived":false,"fork":false,"pushed_at":"2024-03-12T14:53:22.000Z","size":20,"stargazers_count":46,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-22T15:45:58.607Z","etag":null,"topics":["china","free","google","google-translate","google-translate-api","language","translate","translate-google","translation-google"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/wilsonwu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-13T15:43:43.000Z","updated_at":"2024-11-07T17:28:32.000Z","dependencies_parsed_at":"2024-06-18T19:59:50.115Z","dependency_job_id":"f5a459d2-3195-4bf0-8f0d-be1160f12bf2","html_url":"https://github.com/wilsonwu/translation-google","commit_stats":{"total_commits":8,"total_committers":3,"mean_commits":"2.6666666666666665","dds":0.25,"last_synced_commit":"45230da3a81ea5b498da29ca12bc8714f05616c4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonwu/translation-google","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Ftranslation-google","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Ftranslation-google/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Ftranslation-google/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Ftranslation-google/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonwu","download_url":"https://codeload.github.com/wilsonwu/translation-google/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonwu%2Ftranslation-google/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266507366,"owners_count":23940055,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["china","free","google","google-translate","google-translate-api","language","translate","translate-google","translation-google"],"created_at":"2024-10-13T16:10:40.067Z","updated_at":"2026-03-16T18:33:40.270Z","avatar_url":"https://github.com/wilsonwu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# translation-google \n\u003ca href=\"https://www.npmjs.com/package/translation-google\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/translation-google.svg\" alt=\"Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/translation-google\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/translation-google.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/translation-google\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/translation-google.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\nA Google Translate API:\n**WARNING: There is IP banned risk from Google Translate when you use this way to do translation.**\n\n\n## Features \n\n- Translate all languages that Google Translate supports.\n- Support different area (Support Chinese user, in China Mainland could set the suffix to `'cn'` to make it work)\n\n## Live Demo with Nodejs\n[![Edit translation-google-demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/youthful-napier-2bi1c?fontsize=14\u0026hidenavigation=1\u0026theme=dark)\n\n## Install \n\n```\nnpm install translation-google\n```\n\n## Usage\n\nFrom automatic language detection to English:\n\n``` js\nvar translate = require('translation-google');\n\ntranslate('This is Google Translate', {to: 'zh-cn'}).then(res =\u003e {\n    console.log(res.text);\n    //=\u003e 这是Google翻译\n    console.log(res.from.language.iso);\n    //=\u003e en\n}).catch(err =\u003e {\n    console.error(err);\n});\n```\n\nFor Chinese user, try this:\n\n``` js\nvar translate = require('translation-google');\n\ntranslate.suffix = 'cn'; // also can be 'fr', 'de' and so on, default is 'com'\n\ntranslate('This is Google Translate', {to: 'zh-cn'}).then(res =\u003e {\n    console.log(res.text);\n    //=\u003e 这是Google翻译\n    console.log(res.from.language.iso);\n    //=\u003e en\n}).catch(err =\u003e {\n    console.error(err);\n});\n```\n\nSometimes, the API will not use the auto corrected text in the translation:\n\n``` js\ntranslate('This is Google Translat', {from: 'en', to: 'zh-cn'}).then(res =\u003e {\n    console.log(res);\n    console.log(res.text);\n    //=\u003e 这是Google翻译\n    console.log(res.from.text.autoCorrected);\n    //=\u003e false\n    console.log(res.from.text.value);\n    //=\u003e This is Google [Translate]\n    console.log(res.from.text.didYouMean);\n    //=\u003e true\n}).catch(err =\u003e {\n    console.error(err);\n});\n```\n\n## API\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` *(booelan)* – `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('This is Google Translat').then(res =\u003e {\n    console.log(res.from.text.value);\n    //=\u003e This is [Google Translate]\n}).catch(err =\u003e {\n    console.error(err);\n});\n```\nOtherwise, it will be an empty `string` (`''`).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonwu%2Ftranslation-google","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonwu%2Ftranslation-google","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonwu%2Ftranslation-google/lists"}