Skip to content

kfet/bg-en

Repository files navigation

БГ ↔ АН Речник / BG–EN Dictionary

Installable offline PWA dictionary for Bulgarian ↔ English, powered by WikiDict data (derived from Wiktionary).

Live app: https://kfet.github.io/bg-en/

Features

  • 🔍 Instant prefix search (binary search, no server) with match highlighting
  • 🔄 Bulgarian → English and English → Bulgarian
  • 🤖 Auto-detects direction from Cyrillic vs Latin input
  • 📶 Works fully offline after first visit
  • 📲 Installable as a PWA (Add to Home Screen)
  • 🌙 Dark mode (system preference + manual toggle)
  • 📋 Copy translations to clipboard (HTTPS + HTTP fallback)
  • 🔗 Shareable search links (?q=WORD&dir=bg-en)
  • 🏷️ POS badges — 11% bg→en, 95% en→bg coverage
  • 📊 Result count badge; "Show more" toggle for polysemous words
  • ~4.1 MB one-time download (gzip), cached by service worker

Data

Source Used for Licence
WikiDict 2025-11 Translation entries (bg→en, en→bg) CC BY-SA 3.0
kaikki.org (Wiktionary extract) Bulgarian IPA, gender, inflections CC BY-SA 3.0 + GFDL
ipa-dict en_US (cmudict-ipa) Primary English IPA pronunciations MIT
kaikki.org English (Wiktionary extract) Fallback English IPA for loanwords and other cmudict gaps CC BY-SA 3.0 + GFDL
UniMorph eng English irregular plurals/verb forms CC BY-SA 3.0

All CC BY-SA 3.0 data is derived from Wiktionary. The compiled data files (public/data/*.json) are distributed under CC BY-SA 3.0; see public/data/NOTICE for full attribution.

  • bg→en: ~46,000 entries
  • en→bg: ~65,000 entries

Development

Requirements: Node 20+, Python 3.10+

# 1. Install JS dependencies
npm install

# 2. Build data files (downloads ~18 MB of WikiDict SQLite, outputs ~10 MB JSON)
npm run data          # alias for: python3 scripts/build_data.py

# 3. Run search logic tests (no browser needed)
npm test

# 4. Start dev server
npm run dev

# 5. Build for production
npm run build

Deployment

The app deploys automatically to GitHub Pages via GitHub Actions on every push to main.

To enable GitHub Pages:

  1. Go to repo Settings → Pages
  2. Set Source to GitHub Actions
  3. Push to main — the workflow will build and deploy

Architecture

  • Data pipeline: Python script → WikiDict SQLite → sorted JSON arrays
  • Search: in-memory binary search (O log n), no database in browser
  • Offline: Workbox service worker pre-caches all assets + data on first visit
  • Deploy: GitHub Actions → GitHub Pages (static, no server needed)

License

App code: MIT
Dictionary data: CC BY-SA 3.0 (WikiDict / Wiktionary / UniMorph) — see public/data/NOTICE

About

Offline Bulgarian–English / English–Bulgarian PWA dictionary (WikiDict + Wiktionary data)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors