{"id":25580377,"url":"https://github.com/tderflinger/libretranslate-ts","last_synced_at":"2025-04-12T17:12:11.951Z","repository":{"id":222993348,"uuid":"756421247","full_name":"tderflinger/libretranslate-ts","owner":"tderflinger","description":"TypeScript library for the LibreTranslate API. With TypeScript type definitions. Can also be used with JavaScript.","archived":false,"fork":false,"pushed_at":"2025-03-13T17:04:07.000Z","size":233,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T17:12:04.190Z","etag":null,"topics":["api","javascript","libretranslate","sdk","translation","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tderflinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-02-12T16:24:45.000Z","updated_at":"2025-03-13T17:04:10.000Z","dependencies_parsed_at":"2024-06-08T15:43:17.469Z","dependency_job_id":"dc7a1652-71f5-49e2-9d96-5f7022900949","html_url":"https://github.com/tderflinger/libretranslate-ts","commit_stats":null,"previous_names":["tderflinger/libretranslate-js","tderflinger/libretranslate-ts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tderflinger%2Flibretranslate-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tderflinger%2Flibretranslate-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tderflinger%2Flibretranslate-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tderflinger%2Flibretranslate-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tderflinger","download_url":"https://codeload.github.com/tderflinger/libretranslate-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248602312,"owners_count":21131616,"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":["api","javascript","libretranslate","sdk","translation","typescript"],"created_at":"2025-02-21T04:15:49.818Z","updated_at":"2025-04-12T17:12:11.933Z","avatar_url":"https://github.com/tderflinger.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](./doc/logo.svg)\n# libretranslate-ts\n\n[[Español]](./doc/README_es.md)  [[Română]](./doc/README_ro.md)\n\nA simple and easy to use TypeScript library for [LibreTranslate](https://libretranslate.com/).\nCan also be used with JavaScript.\n\nLibreTranslate is a free and open source translation application that also offers an API.\nThis library connects to the API.\n\nIf you are looking for instructions on how to deploy your own LibreTranslate instance you can find them [here](https://github.com/LibreTranslate/LibreTranslate).\n\n## Installation\n\n```bash\nnpm i libretranslate-ts --save\n```\n\n## Example Usage\n\nIn this example, I connect to a LibreTranslate instance on `localhost:5000`.\nWhen your instance is different, you need to change this.\n\napp.mjs\n```typescript\nimport { libreTranslate } from \"libretranslate-ts\";\n\nconst LIBRETRANSLATE_ENDPOINT = \"http://localhost:5000\";\n\nlibreTranslate.setApiEndpoint(LIBRETRANSLATE_ENDPOINT);\nlibreTranslate.setApiKey(\"\");\nconst resultDetect = await libreTranslate.detect(\"Hola, cómo estás?\");\nconsole.log(\"Detected language: \", resultDetect);\nconst result = await libreTranslate.translate(\n    \"There is a tiger in the house nearby the barn.\",\n    \"en\",\n    \"es\"\n);\n\nif (result?.status \u003e= 400) {\n    console.log(\"Status: \", result?.status);\n    console.error(\"Error: \", result?.error);\n    process.exit(1);\n}\n\nconsole.log(result?.translatedText);\n```\n\n## Bugs\n\nPlease file any issues and enhancement ideas under the \"Issues\" tab.\n\n## Roadmap\n\n- Add possibility to translate whole files\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftderflinger%2Flibretranslate-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftderflinger%2Flibretranslate-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftderflinger%2Flibretranslate-ts/lists"}