local export = {}
-- mapping Latin syllables to Sundanese script (abugida)
local tt = {}
tt = {
-- consonant + inherent 'a'
= "ᮊ", = "ᮌ", = "ᮍ", = "ᮎ", = "ᮏ", = "ᮑ",
= "ᮒ", = "ᮓ", = "ᮔ", = "ᮕ", = "ᮘ", = "ᮙ",
= "ᮚ", = "ᮛ", = "ᮜ", = "ᮝ", = "ᮞ", = "ᮠ",
= "ᮖ", = "ᮋ", = "ᮗ", = "ᮟ", = "ᮐ", = "ᮮ", = "ᮯ",
-- consonant + vowel diacritics
= "ᮊᮤ", = "ᮊᮥ", = "ᮊᮦ", = "ᮊᮨ", = "ᮊᮧ", = "ᮊᮩ",
= "ᮌᮤ", = "ᮌᮥ", = "ᮌᮦ", = "ᮌᮨ", = "ᮌᮧ", = "ᮌᮩ",
= "ᮍᮤ", = "ᮍᮥ", = "ᮍᮦ", = "ᮍᮨ", = "ᮍᮧ", = "ᮍᮩ",
= "ᮎᮤ", = "ᮎᮥ", = "ᮎᮦ", = "ᮎᮨ", = "ᮎᮧ", = "ᮎᮩ",
= "ᮏᮤ", = "ᮏᮥ", = "ᮏᮦ", = "ᮏᮨ", = "ᮏᮧ", = "ᮏᮩ",
= "ᮑᮤ", = "ᮑᮥ", = "ᮑᮦ", = "ᮑᮨ", = "ᮑᮧ", = "ᮑᮩ",
= "ᮒᮤ", = "ᮒᮥ", = "ᮒᮦ", = "ᮒᮨ", = "ᮒᮧ", = "ᮒᮩ",
= "ᮓᮤ", = "ᮓᮥ", = "ᮓᮦ", = "ᮓᮨ", = "ᮓᮧ", = "ᮓᮩ",
= "ᮔᮤ", = "ᮔᮥ", = "ᮔᮦ", = "ᮔᮨ", = "ᮔᮧ", = "ᮔᮩ",
= "ᮕᮤ", = "ᮕᮥ", = "ᮕᮦ", = "ᮕᮨ", = "ᮕᮧ", = "ᮕᮩ",
= "ᮘᮤ", = "ᮘᮥ", = "ᮘᮦ", = "ᮘᮨ", = "ᮘᮧ", = "ᮘᮩ",
= "ᮙᮤ", = "ᮙᮥ", = "ᮙᮦ", = "ᮙᮨ", = "ᮙᮧ", = "ᮙᮩ",
= "ᮚᮤ", = "ᮚᮥ", = "ᮚᮦ", = "ᮚᮨ", = "ᮚᮧ", = "ᮚᮩ",
= "ᮛᮤ", = "ᮛᮥ", = "ᮛᮦ", = "ᮛᮨ", = "ᮛᮧ", = "ᮛᮩ",
= "ᮜᮤ", = "ᮜᮥ", = "ᮜᮦ", = "ᮜᮨ", = "ᮜᮧ", = "ᮜᮩ",
= "ᮝᮤ", = "ᮝᮥ", = "ᮝᮦ", = "ᮝᮨ", = "ᮝᮧ", = "ᮝᮩ",
= "ᮞᮤ", = "ᮞᮥ", = "ᮞᮦ", = "ᮞᮨ", = "ᮞᮧ", = "ᮞᮩ",
= "ᮠᮤ", = "ᮠᮥ", = "ᮠᮦ", = "ᮠᮨ", = "ᮠᮧ", = "ᮠᮩ",
-- extended
= "ᮖᮤ", = "ᮖᮥ", = "ᮖᮦ", = "ᮖᮨ", = "ᮖᮧ", = "ᮖᮩ",
= "ᮋᮤ", = "ᮋᮥ", = "ᮋᮦ", = "ᮋᮨ", = "ᮋᮧ", = "ᮋᮩ",
= "ᮗᮤ", = "ᮗᮥ", = "ᮗᮦ", = "ᮗᮨ", = "ᮗᮧ", = "ᮗᮩ",
= "ᮟᮤ", = "ᮟᮥ", = "ᮟᮦ", = "ᮟᮨ", = "ᮟᮧ", = "ᮟᮩ",
= "ᮐᮤ", = "ᮐᮥ", = "ᮐᮦ", = "ᮐᮨ", = "ᮐᮧ", = "ᮐᮩ",
= "ᮮᮤ", = "ᮮᮥ", = "ᮮᮦ", = "ᮮᮨ", = "ᮮᮧ", = "ᮮᮩ",
= "ᮯᮤ", = "ᮯᮥ", = "ᮯᮦ", = "ᮯᮨ", = "ᮯᮧ", = "ᮯᮩ",
-- dead consonants (no vowel, add pangkon)
= "ᮊ᮪", = "ᮌ᮪", = "ᮍ᮪", = "ᮎ᮪", = "ᮏ᮪", = "ᮑ᮪",
= "ᮒ᮪", = "ᮓ᮪", = "ᮔ᮪", = "ᮕ᮪", = "ᮘ᮪", = "ᮙ᮪",
= "ᮚ᮪", = "ᮛ᮪", = "ᮜ᮪", = "ᮝ᮪", = "ᮞ᮪", = "ᮠ᮪",
= "ᮖ᮪", = "ᮋ᮪", = "ᮗ᮪", = "ᮟ᮪", = "ᮐ᮪", = "ᮮ᮪", = "ᮯ᮪",
-- independent vowels
= "ᮃ", = "ᮄ", = "ᮅ", = "ᮆ", = "ᮈ", = "ᮇ", = "ᮉ",
}
-- transliterate Latin to Sundanese
function export.tr(text, lang, sc)
if sc == "Latn" then
-- normalize
text = mw.ustring.lower(text)
text = mw.ustring.gsub(text, "", "")
-- clusters: ng/ny + vowel/eu
text = mw.ustring.gsub(text, "ngeu", tt)
text = mw.ustring.gsub(text, "ng", tt)
text = mw.ustring.gsub(text, "nyeu", tt)
text = mw.ustring.gsub(text, "ny", tt)
-- consonant + eu
text = mw.ustring.gsub(text, "eu", tt)
-- consonant + vowel
text = mw.ustring.gsub(text, "", tt)
-- independent vowels
text = mw.ustring.gsub(text, "eu", tt)
text = mw.ustring.gsub(text, "", tt)
-- dead consonants
text = mw.ustring.gsub(text, "ng", tt)
text = mw.ustring.gsub(text, "ny", tt)
text = mw.ustring.gsub(text, "kh", tt)
text = mw.ustring.gsub(text, "sy", tt)
text = mw.ustring.gsub(text, "", tt)
end
return mw.ustring.toNFC(text)
end
return export