Simplifying Thaana and Dhivehi with Dhivehi-Tools

Share
Simplifying Thaana and Dhivehi with Dhivehi-Tools

Building digital platforms in the Maldives comes with a unique set of localization challenges. From handling the right-to-left (RTL) mechanics of the Thaana script to converting between Latin representation (Maldivian Latin) and native fonts, developers frequently find themselves reinventing the wheel.

If you have ever wrestled with dynamic Thaana text input, struggled with character encoding, or needed a seamless way to clean up user-submitted Maldivian text, a solution is here to make your life much easier:Dhivehi-Tools.

What is Dhivehi-Tools?

Dhivehi-Tools is an open-source JavaScript/TypeScript utility library specifically engineered to handle the complexities of working with the Maldivian language in web and mobile applications. Whether you are building a React Native mobile application, a Next.js web portal, or a lightweight Node.js backend parser, this package strips away the boilerplate math of string-mapping and replaces it with intuitive helper functions.

Core Features Every Maldivian Developer Needs

The library focuses on solving the most common friction points in Dhivehi development:

  • Bidirectional Transliteration: Easily convert strings from Maldivian Latin ("dhivehi") to pure Thaana ("ދިވެހި") and back. This is incredibly useful for mapping URL slugs, building search indexing algorithms, or matching unformatted user inputs.
  • Smart Input Formatting: Automatically intercept and format user entries, helping you switch text directions or swap characters dynamically so users get a native RTL experience without layout breaks.
  • Character Validation & Cleaning: Strip out incompatible characters, fix broken vowels (fili), and ensure that database strings stay sanitized and consistent.

Getting Started is Easy

Integrating the package into an active project takes less than a minute. You can install it straight from GitHub or your preferred package manager package.

Bash

npm install github:siyamex/Dhivehi-Tools
# or using bun
bun add github:siyamex/Dhivehi-Tools

Once installed, implementing features like converting standard Latin text inputs into elegant Thaana characters is as straightforward as importing a function:

JavaScript

import { latinToThana } from 'dhivehi-tools';

const input = "maruhabaa";
const thaanaOutput = latinToThana(input);

console.log(thaanaOutput); // Output: މަރުޙަބާ

Why Use an Open-Source Utility Instead of Custom RegEx?

Most developers starting a Dhivehi-supported project begin by writing a few quick Regular Expressions to handle character replacements. However, edge cases quickly pile up—handling unique vowel placements, combining characters, special symbols, and keeping proper font mapping consistent across browsers.

By utilizing a centralized utility library, you ensure:

  1. Performance: The data maps are optimized for quick string lookups.
  2. Reliability: Built with real-world application needs in mind, reducing bugs associated with mixed-character input fields.
  3. Community Improvement: As open-source software, any fixed edge-case benefits everyone who uses the library.

Contributed & Maintained by the Community

The ultimate goal of tools like this is to establish a rock-solid ecosystem for Maldivian digital products. If you run into a unique grammatical rule, need an extra validation filter, or want to expand its capabilities for specific framework components, contributions are highly encouraged.

Check out the repository, star it to follow updates, or open an issue/pull request today!

👉 Explore the code on GitHub:siyamex/Dhivehi-Tools