Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.remeinium.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Installation

Install the package via your preferred package manager:
npm install @siyabasa/singlish
# or
pnpm add @siyabasa/singlish
# or
yarn add @siyabasa/singlish
Note: The official npm package name is @siyabasa/singlish.

Basic Usage

Simple Text Conversion

For simple, stateless conversion of a string (e.g., processing a document or a chat message):
import { convertSinglishToSinhala } from '@siyabasa/singlish';

const text = 'mama gedhara yanawaa';
const sinhala = convertSinglishToSinhala(text);

console.log(sinhala); // "මම ගෙදර යනවා"

Real-time Input (React)

For interactive text input, use the useSinglishConverter hook. It handles cursor position, buffer management, and state updates automatically.
import { useSinglishConverter } from '@siyabasa/singlish';

export default function InputField() {
  const { inputProps, toggle, enabled } = useSinglishConverter({
    enabled: true, // Start with Singlish enabled
  });

  return (
    <div>
        <textarea
            {...inputProps}
            placeholder="Type here (e.g. 'kohomadha')..."
            rows={5}
        />
        <button onClick={toggle}>
            {enabled ? 'Disable Singlish' : 'Enable Singlish'}
        </button>
    </div>
  );
}

Next Steps