Sunda.js

Sunda.js

Tags
Node.jsLibrary
image

Sunda.js

Sunda.js is a small library for converting or transliterating Latin script into Sundanese script (Aksara Sunda Baku). It is a complement to Carakan.js, which is a transliteration library for Javanese Script.

Check it out here:

👀 Why this library?

Sunda.js is based off of my other project, Carakan.js, which is a transliterator library for Javanese script. After researching about the Sundanese script, I found that the Sundanese writing system is similar, and even a lot simpler than the Javanese one. Then, I realized that the same algorithm could be used to transliterate Latin into it. As I see that there's no library for transliterating Latin into Sundanese script yet (and vice versa), I decided to make one.

Sunda.js is also pretty fast!

🚀 Features

Currently, Sunda.js can handle:

  • Aksara Ngalagéna
  • Aksara Ngalagéna for foreign sounds (f, q, v, x, z, kh, sy)
  • Aksara Swara
  • All Rarangkén
  • Angka
  • ...and many more

📦 Installation

NPM

npm install sunda.js

Yarn

yarn add sunda.js

⌨️ Usage

Latin → Sundanese using toSundanese()

Basic example

import { toSundanese } from "sunda.js";

let x = toSundanese("Wih, geulis euy!");
console.log(x)

// => ᮝᮤᮂ, ᮌᮩᮜᮤᮞ᮪ ᮉᮚ᮪!

Writing basic vowels

let x = toSundanese("pa pi pu pe pé peu po p");
console.log(x)

// => ᮕ ᮕᮤ ᮕᮥ ᮕᮨ ᮕᮦ ᮕᮩ ᮕᮧ ᮕ᮪

Writing various Rerangkén

let x = toSundanese("Di Klatén, ada santri kyai tebang pohon buah pir");
console.log(x)

// => ᮓᮤ ᮊᮣᮒᮦᮔ᮪, ᮃᮓ ᮞᮔ᮪ᮒᮢᮤ ᮊᮡᮄ ᮒᮨᮘᮀ ᮕᮧᮠᮧᮔ᮪ ᮘᮥᮃᮂ ᮕᮤᮁ

Writing numbers

// pipe (|) will be automatically added around numbers

let x = toSundanese("tanggal 17 bulan 8 taun 1945");
console.log(x)

// => ᮒᮀᮌᮜ᮪ |᮱᮷| ᮘᮥᮜᮔ᮪ |᮸| ᮒᮅᮔ᮪ |᮱᮹᮴᮵|

Sundanese → Latin using toLatin()

Basic example

import { toLatin } from "sunda.js";

let x = toLatin("ᮝᮤᮂ, ᮌᮩᮜᮤᮞ᮪ ᮉᮚ᮪!");
console.log(x)

// => wih, geulis euy!

Detecting rerangkén when converting back to Latin

let x = toLatin("ᮓᮤ ᮊᮣᮒᮦᮔ᮪, ᮃᮓ ᮞᮔ᮪ᮒᮢᮤ ᮊᮡᮄ ᮒᮨᮘᮀ ᮕᮧᮠᮧᮔ᮪ ᮘᮥᮃᮂ ᮕᮤᮁ");
console.log(x)

// => di klatén, ada santri kyai tebang pohon buah pir

Writing numbers

// pipe (|) will be automatically removed from around numbers

let x = toLatin("ᮒᮀᮌᮜ᮪ |᮱᮷| ᮘᮥᮜᮔ᮪ |᮸| ᮒᮅᮔ᮪ |᮱᮹᮴᮵|");
console.log(x)

// => tanggal 17 bulan 8 taun 1945

Notes

  • In Latin -> Sundanese transliteration, you can use either uppercase (Capital letters) or lowercase. The result will be the same.
  • In Sundanese -> Latin transliteration, pipe (|) immediately before and after numbers will be removed.
  • Other than pipe (|), all characters that's not Sundanese or Latin character (like dot, comma, semicolon, etc) will be output as it is.
SuperMade with Super