Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

فہم / Feham

A hover-to-read Urdu dictionary for Chrome, in the spirit of rikaikun for Japanese. Point at an Urdu word on any page and a tooltip shows its transliteration, English meaning, and dictionary entry.

Image

Install

  1. Go to chrome://extensions
  2. Turn on Developer mode (top right)
  3. Load unpacked → select this folder

Use

Action
Hover an Urdu word tooltip with transliteration + meaning
C copy the Urdu word
K full dictionary entry (all senses, Urdu back-translations)
Esc dismiss

The toolbar popup has an on/off switch, a Hold Shift to look up mode for when you want to read without tooltips constantly appearing, and an Urdu font picker — Nastaliq (default) or Naskh, previewed live in the picker itself.

The font applies to Feham's own tooltip and detail panel; page text is left alone. Both faces are bundled, so nothing is fetched at runtime. Changing it takes effect immediately in open tabs.

How it works

Urdu is space-separated, so unlike Japanese there's no segmentation problem — the word under the cursor is found with caretRangeFromPoint, then expanded to the surrounding run of Arabic-script characters.

There's no good scrapeable Urdu↔English dictionary online, so lookups go to Google's public translate_a/single endpoint. It's undocumented and returns a positional array, but it carries more than a plain translation:

field used for
dt=t the machine translation
dt=bd dictionary entries grouped by part of speech, with Urdu back-translations
dt=rm romanization (محبتmuhabbat)
dt=at alternative translations

The dictionary and alternatives matter more than the raw translation. Bare nouns come back with a spurious article (کتاب → "The book") and particles come back transliterated rather than translated (کے → "K"), so pickPrimary() in background.js prefers the cleaner source: کتابbook, کےof the.

Layout

file
content.js word detection, tooltip, highlight — all UI in a shadow root
background.js lookups, response parsing, caching
popup.html/js settings
fonts/ Noto Nastaliq Urdu + Noto Naskh Arabic, bundled so tooltips render without a network fetch

Two things worth knowing if you edit this:

Network calls live in the service worker. In MV3 a content script's fetch is subject to the host page's CSP, so looking a word up directly from content.js fails on any site with a strict connect-src. The service worker has the extension's own host permissions, so it always works.

The highlight never touches the page DOM. It's drawn as overlay rectangles positioned over the word's client rects. Wrapping the word in a <span> (what the first version did) mutates the page, which breaks React/Vue re-renders and clobbers the user's own text selection.

Lookups are cached in chrome.storage.local for 30 days, capped at 1000 words, and in-flight requests are de-duplicated — without that, hovering across a paragraph will get you rate-limited by Google.

Permissions

storage only, plus host access to translate.googleapis.com. Nothing is sent anywhere except the single word you hover — see PRIVACY.md.

Packaging

store/ holds the Chrome Web Store submission material: screenshots at the required 1280×800, plus listing.md with the description, permission justifications and privacy answers ready to paste into the dashboard.

To rebuild the upload package:

zip -r feham-<version>.zip manifest.json background.js content.js \
    popup.html popup.js icons fonts

store/ and the zip itself are deliberately left out of the package.

Credits

Bundled fonts are Noto Nastaliq Urdu and Noto Naskh Arabic, © The Noto Project Authors, used under the SIL Open Font License 1.1 — see fonts/OFL.txt.

About

Urdu dictionary Chrome extension

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages