Why a Dedicated Editor?
Burushaski and Urdu are spoken by millions of people across the northern areas of Pakistan, India and the diaspora. Both languages use scripts that require Unicode support: Urdu is written in a modified Arabic script, while Burushaski is normally rendered in the Arabicbased script (though a Latin transliteration also exists). A generic text editor often fails to provide the specific typographic features, keyboard layouts, and languageaware tools that writers, scholars, and developers need.
Unicode The Foundation
Unicode assigns a unique code point to every character in every writing system, making it possible to store, display, and exchange text without ambiguity. For Urdu the relevant range is U+0600U+06FF (Arabic Presentation Forms) with additional letters in the Extended Arabic block. Burushaski uses most of the same range, plus a few characters from the Arabic Supplement block.
By building the editor on top of Unicode, we ensure that documents remain portable across operating systems, browsers, and devices. The editor can also correctly handle bidirectional (bidi) text, which is essential for righttoleft scripts.
Key Features of the Editor
1. LanguageSpecific Keyboard Support
Users can switch between an Urdu keyboard layout (UrdPakistan) and a Burushaski layout that maps the extra letters , , etc. The editor loads layout definitions from JSON files, allowing easy addition of new variants.
2. RealTime Shaping and Ligature Rendering
Arabicscript characters change shape depending on their position (initial, medial, final, isolated). The editor leverages the browsers native shaping engine (via the font-feature-settings CSS property) and, for older browsers, integrates the Arbortext shaping library.
3. SpellChecking & Dictionaries
Opensource Hunspell dictionaries for Urdu and a communitymaintained Burushaski word list are bundled. The spellchecker highlights errors in real time and offers suggestions in a context menu.
4. RighttoLeft Text Flow
The editor automatically switches the directionality attribute (dir="rtl") when the first strong character belongs to the Urdu or Burushaski script. Users can override this with a toolbar button.
5. Export & Import Options
Documents can be saved as plain UTF8text (*.txt), Rich Text Format (*.rtf), or as HTML snippets with proper lang attributes:
<p lang="ur"> </p><p lang="bsk"> .</p> Technical Architecture
FrontEnd Stack
- HTML5 & CSS3 provides the structure and styling, including
directionandunicode-bidiproperties. - JavaScript (ES2022) drives the editor logic, event handling, and language services.
- ContentEditable the core editable area; enhanced with
execCommandfallbacks. - Web Workers perform spellchecking without blocking the UI.
- Opensource Libraries:
quilllightweight richtext base (custom modules for bidi support).simple-keyboardonscreen virtual keyboards for both scripts.unicodebidihelper functions for handling mixed direction text.
BackEnd (Optional)
For collaborative editing or serverside storage, a Node.js API can be added. It receives UTF8 payloads, validates the Unicode ranges, and stores the content in a MongoDB collection with language tags.
Implementation Snippets
Loading a Keyboard Layout
async function loadLayout(lang) { const resp = await fetch(`./layouts/${lang}.json`); const layout = await resp.json(); keyboard.setOptions({layoutName: layout.name, layout: layout.mapping});} Detecting Script Direction
function getDirection(text) { const rtlChar = /[\u0600-\u06FF]/; return rtlChar.test(text) ? 'rtl' : 'ltr';}editor.addEventListener('input', e => { const dir = getDirection(e.target.innerText); e.target.style.direction = dir;}); Challenges & Solutions
- Bidirectional Mixing When Urdu and Latin text appear together, the cursor may jump unexpectedly. Solution: use the
unicode-bidi: plaintextCSS rule and keep the caret logic in a Web Worker that calculates visual order. - Ligature Gaps in Older Browsers Some browsers lack full shaping support. Solution: ship a fallback shaping engine (e.g.,
arabicshaping.js) that runs only when needed. - Limited Burushaski Resources Few digital dictionaries exist. Solution: partner with local universities to crowdsource a word list and release it under a permissive license.
Benefits for Users
Consistency: Documents retain their correct script regardless of platform.
Productivity: Integrated keyboard and spellcheck cut down on manual corrections.
Accessibility: Righttoleft layout conforms to WCAG 1.4.10 (Reflow) for screenreaders.
Getting Started
- Clone the repository from GitHub.
- Run
npm installto fetch dependencies. - Open
index.htmlin a modern browser. - Select Urdu or Burushaski from the language dropdown to load the appropriate keyboard and dictionary.
Future Enhancements
- Voice input support for both languages using Web Speech API.
- Integration with cloud storage (Google Drive, OneDrive) for seamless syncing.
- Advanced typography: contextual alternates, historic letter forms, and calligraphic ligatures.
By embracing Unicode and focusing on the unique requirements of Burushaski and Urdu, this editor empowers writers, educators, and developers to create, share, and preserve content in two of the regions most vibrant languages.
