Skip to content

ptarjan/ingglish

Repository files navigation

Ingglish

CI

Phonetic English spelling translator. Words are spelled exactly as they sound - no exceptions!

Try it live → · Spelling Guide

Overview

Ingglish translates English text into a consistent, phonetic spelling system where each sound has exactly one representation. Using the CMU Pronouncing Dictionary (134,000+ words), it eliminates the irregularities and exceptions that make English spelling notoriously difficult.

Features

  • Bidirectional translation - Translate English → Ingglish and back (see limitations for homophones)
  • IPA support - Output in International Phonetic Alphabet with proper stress markers
  • URL translator - Translate entire web pages with fullscreen viewing
  • Word correspondence - Interactive hover to see original/translated word pairs
  • Contraction support - Handles "wouldn't", "can't", "you're", etc.
  • Case preservation - Maintains capitalization patterns
  • DOM translation - Translate web pages in-place with hover tooltips

Packages

This is a monorepo containing:

  • @ingglish/core - Core text translation library (Node.js & Browser)
  • @ingglish/dom - DOM translation utilities (Browser only)
  • @ingglish/website - React website for text and URL translation
  • @ingglish/extension - Chrome extension for translating any webpage
  • @ingglish/cors-proxy - Cloudflare Worker CORS proxy for URL translation

Installation

npm (recommended)

# Core library (text translation)
npm install @ingglish/core

# DOM utilities (browser translation with tooltips)
npm install @ingglish/dom

From source

# Clone and install
git clone https://github.com/ptarjan/ingglish.git
cd ingglish
npm install

# Build all packages
npm run build

Usage

Core Library

import { translate, reverseTranslate } from '@ingglish/core';

// Translate English → Ingglish (async, auto-loads dictionary)
const ingglish = await translate('Hello, world!');
console.log(ingglish); // "Huloh, werld!"

// Translate English → IPA
const ipa = await translate('Hello, world!', 'ipa');
console.log(ipa); // "/həˈloʊ, wɝld!/"

// Translate Ingglish → English (async, loads dictionary + word frequencies)
const english = await reverseTranslate('huloh, werld!');
console.log(english); // "hello, world!"

// Translate IPA → English
const fromIpa = await reverseTranslate('/həˈloʊ, wɝld!/', 'ipa');
console.log(fromIpa); // "hello, world!"

DOM Translation (Browser)

import { translateDOM, observeAndTranslate } from '@ingglish/dom';

// Translate DOM elements with tooltips
await translateDOM(document.body, {
  showTooltips: true,
  chunked: true, // Smooth rendering for large pages
});

// Auto-translate dynamic content (SPAs)
const stop = observeAndTranslate(document.body);
// Later: stop() to disconnect observer

Website

npm run dev -w @ingglish/website

Then open http://localhost:3000

Chrome Extension

npm run build -w @ingglish/extension

Then load packages/extension/dist as an unpacked extension in Chrome (chrome://extensions > Developer mode > Load unpacked).

Phoneme Mapping

Each sound maps to exactly one spelling:

Sound Ingglish Examples
Long "e" ee bee, see
Long "i" ai my, time
Long "o" oh go, show
Voiced "th" dh the, this
Unvoiced "th" th think, bath
Short "u" u but, cup
"o" sound o hot, rock
"aw" sound aw thought, law
"er" sound er bird, her

See docs/phoneme-mapping.md for the complete mapping.

Examples

English Ingglish IPA
hello huloh /həˈloʊ/
world werld /wɝld/
beautiful byuutuful /ˈbjutəfəl/
through thruu /θɹu/
though dhoh /ðoʊ/
thought thawt /θɔt/
the dhu /ðə/
English Ingglish /ˈɪŋɡlɪʃ/

About the name: "Ingglish" is simply how you spell "English" in Ingglish! When speaking, you can distinguish them by stressing the first syllable and pausing briefly between the two g's: ING·glish vs. English.

Limitations

Homophones

English has many words that sound identical but are spelled differently (homophones). Since Ingglish is purely phonetic, these words merge into a single spelling:

English Ingglish
to, too, two tuu
their, there, they're dhair
sea, see see
eye, I ai

Forward translation (English → Ingglish) works perfectly - the correct pronunciation is preserved.

Reverse translation (Ingglish → English) uses word frequency to pick the most common word, which may not be what you intended. For example:

  • kyuu reverses to "q" (not "queue" or "cue")
  • ail could be "aisle", "I'll", or "isle" (ambiguous)

This is an inherent trade-off of phonetic spelling - we gain consistency but lose the ability to distinguish homophones in writing.

Numbers

Numbers remain as digits (e.g., "123" stays "123"). If you want phonetic numbers, spell them out first: "one hundred twenty three" → "wun hundred twentee three".

Development

npm test                           # Run all tests
npm run build                      # Build all packages
npm run dev -w @ingglish/website   # Run website dev server

See Contributing Guide for detailed development workflow, testing guidelines, and code style.

CLI Scripts

cd packages/core

# Translate text (shows word-by-word breakdown)
npm run translate -- "Hello world"

# Reverse translate
npm run translate -- -r "huloh werld"

# Debug round-trip issues
npm run debug:roundtrip -- "beautiful"

See Performance Guide for profiling and benchmarking scripts.

How Unknown Words Are Handled

For words not in the CMU dictionary, Ingglish uses a multi-step fallback strategy:

  1. Custom pronunciations - Known tech terms and brand names (e.g., "GitHub" → "git-hub")
  2. Initialisms - Spell out as letters (e.g., "URL" → "you-are-ell", "API" → "ay-pee-ai")
  3. Compound splitting - Split on common boundaries (e.g., "github" → "git" + "hub")
  4. Stemming - Find known base word + suffix (e.g., "running" → "run" + "ing")
  5. Neural G2P - Use grapheme-to-phoneme neural network for complex words
  6. Rule-based G2P - Fall back to letter-to-sound conversion rules

Deployment

Deploy the website with one click:

Deploy with Vercel Deploy to Netlify

See Deployment Guide for detailed instructions on deploying the website, Chrome extension, and CORS proxy.

Documentation

Design

Reference

License

MIT

About

What if English spelling made sense?

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •