PocketBabel is a frontend-only English/Chinese translation app built with @huggingface/transformers. It runs entirely in the browser, targets Cloudflare Pages, and is designed to keep working offline after model download.
- English -> Chinese and Chinese -> English only
- No backend inference service
- Works on desktop and mobile browsers
- PWA shell with offline reuse after model download
- Built for a simple, self-explanatory translation workflow
PocketBabel is an early v1-focused project. The current product scope is intentionally narrow:
- English -> Chinese with
Xenova/opus-mt-en-zh - Chinese -> English with
Xenova/opus-mt-zh-en - No accounts, sync, OCR, speech, or multi-language support
The detailed product guardrails live in AGENTS.md.
npm install
npm run devDefault local URL:
http://localhost:5173
npm test
npm run build- Open the app while online.
- Download a direction once, or run a successful translation for that direction.
- Re-open the app later on the same browser profile.
- Use the downloaded direction offline.
Expected behavior:
- Downloaded directions continue to translate offline.
- Undownloaded directions fail with a visible error instead of pretending to work.
PocketBabel is a static site. It does not require Pages Functions or Workers.
- Framework preset:
None - Build command:
npm run build - Build output directory:
dist - Root directory:
/
Preview deploy:
npm run pages:deployProduction deploy:
npm run pages:deploy:productionIf your Pages project name is not pocketbabel, update the scripts in package.json.
- Hashed files under
/assets/are immutable index.html,manifest.webmanifest, andsw.jsareno-cache- Cache policy is defined in public/_headers
- The first model download is relatively large
- Browser support depends on Web Workers, IndexedDB, and Cache Storage
- Model files are cached by browser-managed storage used by
transformers.js, notlocalStorage
See CONTRIBUTING.md before opening a pull request.
See SECURITY.md for vulnerability reporting guidance.
This repository is licensed under the GNU AGPL v3. See LICENSE.
