I’m sharing Sinhala Transliterator, an open-source Java library I built to convert Sinhala script into Latin characters using predefined mapping rules.
If you’re building a Java application that works with Sinhala text, this library provides a simple way to add transliteration.
What does it do?
Transliteration represents text in another writing system. It does not translate the meaning into English.
For example:
සිංහල → siṁhala
The library includes mappings for Sinhala vowels, consonants, and diacritics.
Add it to your project
Add this dependency to your Maven pom.xml:
<dependency>
<groupId>io.github.iroshperera</groupId>
<artifactId>sinhala-transliterator</artifactId>
<version>1.1.0</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode
Try it in Java
import com.webmotech.transliterator.SinhalaToLatinTransliterator;
public class Main {
public static void main(String[] args) {
String input = "සිංහල";
String result =
SinhalaToLatinTransliterator.transliterate(input);
System.out.println(result);
}
}
Enter fullscreen mode Exit fullscreen mode
Expected output, as shown in the project README:
siṁhala
Enter fullscreen mode Exit fullscreen mode
Where could you use it?
Potential uses include displaying Latin-script versions alongside Sinhala text and experimenting with Sinhala text-processing tools.
Because the conversion uses predefined rules, test it with your application’s actual text samples to check whether the output matches your needs.
Feedback and contributions
The project is available under the Apache License 2.0.
I’d welcome feedback on transliteration accuracy, edge cases, and documentation. If you find an unexpected result, please open a GitHub issue with the input, actual output, and expected output.
👉 Explore Sinhala Transliterator on GitHub
Have you worked with Sinhala text in Java? What challenges did you encounter?