{"_id":"@abc15018045126/translators","name":"@abc15018045126/translators","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.5":{"name":"@abc15018045126/translators","version":"0.1.5","description":"A high-performance, multi-engine translation SDK (Google & Bing) with built-in caching and Manifest V3 compatibility.","author":{"name":"abc15018045126","email":"abc15018045126@gmail.com"},"license":"MIT","keywords":["translate","google-translate","bing-translate","sdk","chrome-extension","manifest-v3"],"repository":{"type":"git","url":"git+https://github.com/abc15018045126/translators.git"},"bugs":{"url":"https://github.com/abc15018045126/translators/issues"},"homepage":"https://github.com/abc15018045126/translators#readme","main":"dist/translators.umd.js","unpkg":"dist/translators.iife.js","module":"./dist/translators.es.js","types":"./dist/types/index.d.ts","scripts":{"dev":"vite build --watch","build":"vite build && tsc --emitDeclarationOnly","test":"jest","prepublishOnly":"npm run build"},"dependencies":{"undici":"^6.20.1"},"devDependencies":{"@types/chrome":"^0.0.190","@types/jest":"^28.1.3","jest":"^28.1.1","jest-chrome":"^0.7.2","jest-environment-jsdom":"^28.1.1","node-fetch":"^2.6.7","ts-jest":"^28.0.5","typescript":"^4.7.4","vite":"^2.9.13"},"peerDependencies":{"axios":"^0.27.2"},"publishConfig":{"access":"public"},"_id":"@abc15018045126/translators@0.1.5","gitHead":"f157ef5c18eea68b21abd7bd15785aea3f65ce1e","_nodeVersion":"24.14.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-sEjhIaOTnjoLGNkDqXb0nWmu5cjUEJBJQBQBNkdzVx8j3addzHgfNvHRI8fIGI9v/EEWf3ORalFxGNa0a7DZfw==","shasum":"8e9bb55b4b1165a1d8c3a57bddb10135151119f7","tarball":"https://registry.npmjs.org/@abc15018045126/translators/-/translators-0.1.5.tgz","fileCount":15,"unpackedSize":127381,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDcX+/X3N0fi41nM42aaXTgyTmWiuNBMR6fxeYkd7REugIgOV/fqP0he7IU9RpqGm+vWKiJ9TzvsOGxn5/sc6wxEHg="}]},"_npmUser":{"name":"xuwenjiesmith","email":"abc15018045126@gmail.com"},"directories":{},"maintainers":[{"name":"xuwenjiesmith","email":"abc15018045126@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/translators_0.1.5_1776305969525_0.4272317308688909"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-16T02:19:29.405Z","0.1.5":"2026-04-16T02:19:29.680Z","modified":"2026-04-16T02:19:29.931Z"},"maintainers":[{"name":"xuwenjiesmith","email":"abc15018045126@gmail.com"}],"description":"A high-performance, multi-engine translation SDK (Google & Bing) with built-in caching and Manifest V3 compatibility.","homepage":"https://github.com/abc15018045126/translators#readme","keywords":["translate","google-translate","bing-translate","sdk","chrome-extension","manifest-v3"],"repository":{"type":"git","url":"git+https://github.com/abc15018045126/translators.git"},"author":{"name":"abc15018045126","email":"abc15018045126@gmail.com"},"bugs":{"url":"https://github.com/abc15018045126/translators/issues"},"license":"MIT","readme":"# @abc15018045126/translators\n\n🚀 A high-performance, multi-engine translation SDK for Google & Bing, specifically designed for Manifest V3 and high-concurrency environments.\n\n[中文文档](README_zh.md)\n\n## Features\n\n- **Three Engine Modes**: Use Google, Bing, or the powerful **Hybrid** mode.\n- **Hybrid Strategy**: Highly configurable. Translate main text with Google while fetching rich dictionary data and examples from Bing.\n- **Concurrency Control**: Built-in request deduplication (In-flight deduplication) and concurrency locks to save bandwidth and prevent redundant token updates.\n- **Full Platform Compatibility**: Native support for Chrome Extension (MV3), Node.js (18+), Webview, and modern browsers.\n- **Smart Caching**: Zero-config LRU cache system for lightning-fast results on repeated queries.\n\n## Installation\n\n```bash\nnpm install @abc15018045126/translators\n```\n\n## Core Usage\n\n### 1. Google Mode (GoogleTranslator)\nThe classic choice with auto-detection, pronunciation, and automatic TKK update logic.\n\n```javascript\nimport { GoogleTranslator } from '@abc15018045126/translators';\n\nconst google = new GoogleTranslator();\nconst res = await google.translate(\"Stay hungry, stay foolish\", \"auto\", \"zh-CN\");\nconsole.log(res.mainMeaning); // \"求知若渴，虚心若愚\"\n```\n\n### 2. Bing Mode (BingTranslator)\nA stable alternative that often provides more detailed examples and dictionary definitions in certain regions.\n\n```javascript\nimport { BingTranslator } from '@abc15018045126/translators';\n\nconst bing = new BingTranslator();\nconst res = await bing.translate(\"Magic\", \"en\", \"zh-CN\");\nconsole.log(res.detailedMeanings); // Detailed POS definitions and synonyms\n```\n\n### 3. Hybrid Mode (HybridTranslator) —— Recommended\nThe highlight of this SDK. It allows you to combine the best of both worlds.\n\n```javascript\nimport { HybridTranslator } from '@abc15018045126/translators';\n\nconst hybrid = new HybridTranslator();\n\n// In default config, it intelligently allocates request components\nconst res = await hybrid.translate(\"Integrity\", \"auto\", \"zh-CN\");\n\nconsole.log(res.mainMeaning); // From Google (usually)\nconsole.log(res.examples);    // From Bing (usually)\n```\n\n## Advanced Features\n\n### Warm-Up (Optional)\nReduce first-request latency by pre-fetching necessary tokens:\n```javascript\nawait translator.warmUp();\n```\n\n### Pronunciation\nPlay high-quality audio for any text:\n```javascript\nawait google.pronounce(\"Hello\", \"en\", \"normal\");\n```\n\n## Credits\n\nThis SDK's core scraping and translation logic is based on the [Meapri/EdgeTranslate-v3](https://github.com/Meapri/EdgeTranslate-v3) project. We've modernized the codebase, added MV3 support, and implemented performance optimizations.\n\n## License\n\n[MIT](LICENSE) © abc15018045126\n","readmeFilename":"README.md","_rev":"1-75fa8977f5141b42e5f86f8049ef00af"}