Getting Started

Getting Started

This is a Typer that helps you write in Amharic in your application. It provides a simple way to convert English letters to Amharic letter using predefined transcription rules.

Installation

You can install the package via npm:

npm install amharic-converter --save

Or can also install the package via yarn:

yarn add amharic-converter

Usage

To enable the conversion of English text to Amharic in real-time, you need to create a state variable that will hold the Amharic text. Additionally, you should implement an event handler that updates the state variable whenever the input text changes.

First you need to Import the convertToAmharic function from the amharic-converter package.

import { convertToAmharic } from 'amharic-converter';

Then, we need to create a state variable called amharicText (or anything you want), using the useState hook, we need to initialize it with an empty string. handleInputChange function is responsible for updating the state variable whenever the input text changes. It extracts the English text from the events target value, passes it to the convertToAmharic function to obtain the corresponding Amharic text, and sets the amharicText state with the converted text.

// Create a state variable to hold the Amharic text
const [amharicText, setAmharicText] = useState('');

// Define an event handler to update the state when the input changes
const handleInputChange = (event) => {
    const englishText = event.target.value;
    const amharicResult = convertToAmharic(englishText, {
       includeNumbers: false, 
       enhance: false, 
});
// amharicResult.correctText to access the Corrected spelling 
// amharicResult.suggestions to access possibly the next words 
// amharicResult.convertedText to access the amharic text 
    setAmharicText(amharicResult.convertedText);
};

To integrate this functionality into your application, you can use the amharicText state variable to display the converted Amharic text within an input element. Here is an example of how you can achieve this in JSX.

<input
 type="text"
 value={amharicText}
 onChange={handleInputChange}
>

In the above code, the value attribute of the input element is bound to the amharicText state variable, ensuring that it reflects the current converted Amharic text. The onChange event is connected to the handleInputChange function, so any changes to the input will trigger the conversion and update the state accordingly.

Features 🎸 🚀 👽:

Customizability:

Users can easily customize the appearance and behavior of the converter by passing custom props to the loader component...

Enhancements:

The library includes advanced features such as predictive next word suggestions and spelling correction. These enhancements improve the user experience and accuracy of the converted text.

Light Weight

This library is lightweight and does not require any additional dependencies.