Skip to content

About

Browser extension: Zhuyin (Bopomofo), Pinyin and Japanese furigana on any web page, offline. Polyphones read by word. Chrome + Firefox.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ruby Everywhere

Zhuyin (Bopomofo), Pinyin and Japanese furigana on any web page. Offline.

A browser extension for Chrome and Firefox that adds reading aids above or beside Chinese characters and Japanese kanji, for children learning to read Chinese in Taiwan, and for anyone learning Chinese or Japanese.

繁體中文說明 · 日本語

Zhuyin to the right of each character Furigana over kanji, okurigana left bare Pinyin over Simplified Chinese

What it does

  • Zhuyin set vertically to the right of each character, the way Taiwanese school books print it, or above the line. Pinyin with tone marks.
  • Polyphones are read by word, not by character: 銀行 is yínháng, 行走 is xíngzǒu, 長大 is zhǎngdà, 音樂 is yīnyuè and 快樂 is kuàilè. The text is segmented with a 190,000-word dictionary.
  • Taiwan or mainland pronunciation: Traditional text gets Taiwan (MOE-style) readings (垃圾 ㄌㄜˋ ㄙㄜˋ), Simplified text mainland ones (lājī). Detected per paragraph, or pick one.
  • Furigana in hiragana or katakana over kanji only: 食(た)べる, お見舞(みま)い. Japanese is analysed in the browser with kuromoji.js and IPADIC.
  • Chinese or Japanese? Decided per paragraph from kana, lang attributes and the rest of the page; you can force either language per site.
  • On per site, or everywhere. Shortcut: Alt+Shift+R. Adjustable ruby size.
  • Leaves pages working: links, form fields, code blocks, editors and text that already has ruby are left alone. Copying text gives the original text, without readings. Pages built with React and similar frameworks keep working, and text they change is annotated again.

Privacy

Everything runs on your computer. The dictionaries ship inside the extension; it makes no network requests, has no analytics, and page text is only ever passed to the extension's own background script.

Permissions: storage (your settings), activeTab (to know which site the popup is for), and a content script on all sites so it can annotate the sites you turn it on for. It does nothing on a site until you turn it on.

Install

Store listings are not up yet. Until then, from a release:

  • Chrome / Edge: unzip ruby-everywhere-*-chrome.zip, open chrome://extensions, turn on Developer mode, Load unpacked, pick the folder.
  • Firefox: open about:debugging#/runtime/this-firefox, Load Temporary Add-on, pick ruby-everywhere-*-firefox.zip (until the next restart).

Then click the toolbar icon and switch on Annotate this site.

Accuracy

  • Chinese readings come from a word dictionary, so a polyphone is right when its word is in the dictionary and the segmentation picks it. Unknown words fall back to each character's most common reading.
  • Taiwan readings follow McBopomofo's data, which reflects common usage in Taiwan. A few words differ from the MOE dictionary (血液 is given as ㄒㄧㄝˇ ㄧㄝˋ; MOE also lists ㄒㄩㄝˋ). 一 and 不 are shown in their base tone, as dictionaries print them, not with tone sandhi.
  • Neutral tones follow CC-CEDICT where the sources disagree (兒子 ㄦˊ ˙ㄗ, 覺得 ㄐㄩㄝˊ ˙ㄉㄜ).
  • Japanese readings are IPADIC's. Proper names it does not know get no furigana, and counters keep their plain reading (一ヶ月 shows いち・かげつ, not いっかげつ).
  • Kanji-only text with no kana and no lang attribute (a short heading) is taken to be in the page's main language.

Found a wrong reading? Please open an issue with the sentence.

Data and licenses

The extension's code is MIT. The dictionary data keeps its own licenses; see THIRD_PARTY_NOTICES.md for the full texts.

Data Used for License
McBopomofo (小麥注音) word list, readings and counts, originally from libtabe Taiwan readings, word segmentation MIT; libtabe BSD-3-Clause
CC-CEDICT Mainland readings, Simplified forms, choosing between readings CC BY-SA 4.0
Unihan Default character readings, Simplified/Traditional detection Unicode License v3
kuromoji.js with mecab-ipadic Japanese analysis and readings Apache-2.0; IPADIC (NAIST/ICOT)

Because they include CC-CEDICT data, the built tables data/zh-tw.txt and data/zh-cn.txt are CC BY-SA 4.0. The Ministry of Education dictionaries (重編國語辭典, 國語辭典簡編本) are CC BY-ND, which does not allow derived data, so they are not used.

Development

npm install
npm test              # unit tests (Node's test runner + jsdom)
npm run build         # dist/chrome and dist/firefox
npm run package       # also dist/*.zip
npx playwright install chromium
npm run test:e2e      # loads dist/chrome into Chromium

npm run test:e2e uses Playwright's Chromium; set RBE_CHANNEL=msedge to use an installed Edge instead (branded Chrome no longer loads unpacked extensions from the command line).

The tables in data/ are committed. To rebuild them from the sources:

npm run fetch-sources   # downloads into .cache/src
npm run build-data

Layout: src/lib/zh (segmentation, Zhuyin/Pinyin), src/lib/ja (kuromoji, furigana alignment), src/lib/dom.js (finding text, rendering, undo), src/content.js, src/background.js, src/popup/.

License

MIT © Wei-Lun Li. Data files: see above.


繁體中文

在任何網頁的中文字旁加上注音或拼音,日文漢字加上振假名。完全離線。

給正在學認字的小朋友、學中文和學日文的人用的瀏覽器擴充功能(Chrome、Firefox)。

  • 注音可以放在字的右側(直式,和國語課本一樣)或上方;也可以改成拼音。
  • 多音字依詞判讀:銀行(ㄏㄤˊ)、行走(ㄒㄧㄥˊ)、長大(ㄓㄤˇ)、音樂(ㄩㄝˋ)、 快樂(ㄌㄜˋ)。用約 19 萬詞的詞庫斷詞,不是逐字查預設讀音。
  • 臺灣/大陸讀音:繁體字用臺灣讀音(垃圾 ㄌㄜˋ ㄙㄜˋ),簡體字用大陸讀音, 每段自動判斷,也可以手動指定。
  • 日文振假名只標在漢字上,送假名不標:食(た)べる、お見舞(みま)い。
  • 每個網站分別開關,或全部開啟。快捷鍵 Alt+Shift+R。 注音大小可調。
  • 不破壞網頁:連結、輸入框、程式碼、編輯器和原本就有注音的文字都不會動; 複製文字時不會帶到注音。
  • 隱私:字典都在擴充功能裡,不連網、不追蹤,網頁文字不會離開你的瀏覽器。

讀音資料來自小麥注音(MIT)、CC-CEDICT(CC BY-SA 4.0)和 Unicode Unihan。 教育部辭典的授權是 CC BY-ND(禁止改作),所以沒有使用。讀音錯誤歡迎開 issue 回報。

日本語

どんなウェブページでも、漢字にふりがなを表示します。オフラインで動作します。

  • ふりがなは漢字の上だけに付き、送り仮名には付きません(食(た)べる、お見舞(みま)い)。 ひらがな・カタカナを選べます。
  • 形態素解析は kuromoji.js(IPADIC)でブラウザ内で行い、文章を外部に送信しません。
  • 中国語には注音(ボポモフォ)やピンインを表示します。
  • サイトごとにオン・オフでき、ショートカットは Alt+Shift+R。

About

Browser extension: Zhuyin (Bopomofo), Pinyin and Japanese furigana on any web page, offline. Polyphones read by word. Chrome + Firefox.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages