varnamproject / govarnam

Easily type Indic languages on computer and mobile. GoVarnam is a cross-platform transliteration library. Manglish -> Malayalam, Thanglish -> Tamil, Hinglish -> Hindi plus another 10 languages. GoVarnam is a near-Go port of libvarnam
https://varnamproject.com
Other
145 stars 11 forks source link
hindi ime input-method keyboard language linux mac malayalam tamil transliteration windows

Varnam

Varnam is an Indian language transliteration library. GoVarnam is a brand new Go port of libvarnam with some core architectural changes.

It is stable to use daily as an input method. Try out different languages here: https://varnamproject.github.io/editor/

Malayalam has really good support in Varnam. We welcome improvements of all languages in Varnam.

Installation & Usage

See instructions in website: https://varnamproject.github.io/download/

FAQ: https://varnamproject.github.io/docs/faq/


Development

Proceed through these sections one by one:

Videos

See this video to understand more about Varnam (DebConf21):

Files & Folders

Build Library

Requires minimum Go version 1.16.

This repository have 3 things :

  1. GoVarnam library
  2. GoVarnam Command Line Utility (CLI)
  3. Go bindings for GoVarnam

GoVarnam is written in Go, but to be a standard library that can be used with any other programming languages, we compile it to a C library. This is done by :

go build -buildmode "c-shared" -o libgovarnam.so

(Shortcut to doing above is make library)

The output libgovarnam.so is a shared library that can be dynamically linked in any other programming languages using its header file libgovarnam.h. Some examples :

Wait, it means we need to write another Go file to interface with GoVarnam library ! This is because we're interfacing with a C shared library and not the Go library directly. The govarnamgo acts as this interface for Go apps to use GoVarnam.

CLI (Command Line Utility)

After making libgovarnam.so you can make the CLI to use GoVarnam :

make cli

The command line utility (CLI) is written in Go, uses govarnamgo to interface with the library.

You can build both library and CLI with just make.

Language Support

Varnam uses a .vst (Varnam Symbol Table) file for language support. You can get it from it from schemes folder in a release. Place VST files in one of these locations (from high priority to least priority locations):

Now we can use varnamcli:

# Show linker the path to search for libgovarnam.so
export LD_LIBRARY_PATH=$(realpath ./):$LD_LIBRARY_PATH

./varnamcli -s ml namaskaaram

The ml above is the scheme ID. It should match with the VST filename.

You can link the library to /usr/local/lib to skip doing the export LD_LIBRARY_PATH every time:

sudo ln -s $PWD/libgovarnam.so /usr/local/lib/libgovarnam.so

Now any software can find the GoVarnam library.

Testing

You can run tests (to make sure nothing broke) with :

make test

Use Varnam Live

It's good to install an IME to test changes you make to the library live.

Changes from libvarnam