Module:kru-Tols-translit

From Linguifex
Jump to navigation Jump to search

This module will transliterate Kurux language text. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:kru-Tols-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local m_str_utils = require("Module:string utilities")

local gsub = m_str_utils.gsub
local sub = m_str_utils.sub
local U = m_str_utils.char

local export = {}

local tt = {
-- vowels
 ["𑶰"] = "i", ["𑶱"] = "e", ["𑶲"] = "u", ["𑶳"] = "o", ["𑶴"] = "a", ["𑶵"] = "ā",

-- consonants
 ["𑶶"] = "p", ["𑶷"] = "ph", ["𑶸"] = "b", ["𑶹"] = "bh", ["𑶺"] = "m",
 ["𑶻"] = "t", ["𑶼"] = "th", ["𑶽"] = "d", ["𑶾"] = "dh", ["𑶿"] = "n",
 ["𑷀"] = "ṭ", ["𑷁"] = "ṭh", ["𑷂"] = "ḍ", ["𑷃"] = "ḍh", ["𑷄"] = "ṇ",
 ["𑷅"] = "c", ["𑷆"] = "ch", ["𑷇"] = "j", ["𑷈"] = "jh", ["𑷉"] = "ñ",
 ["𑷊"] = "k", ["𑷋"] = "kh", ["𑷌"] = "g", ["𑷍"] = "gh", ["𑷎"] = "ṅ",
 ["𑷏"] = "y", ["𑷐"] = "r", ["𑷑"] = "l", ["𑷒"] = "v", ["𑷓"] = "n̤",
 ["𑷔"] = "s", ["𑷕"] = "h", ["𑷖"] = "x", ["𑷗"] = "ṛ", ["𑷘"] = "ṛh",

-- diacritics
 ["𑷙"] = "̄", ["𑷚"] ="ʻ",

-- numerals
 ["𑷠"] = "0", ["𑷡"] = "1",  ["𑷢"] = "2", ["𑷣"] = "3", ["𑷤"] = "4",
 ["𑷥"] = "5", ["𑷦"] = "6",  ["𑷧"] = "7", ["𑷨"] = "8", ["𑷩"] = "9"
}

-- transliterates any words or phrases
function export.tr(text, lang, sc)

	text = gsub(text, ".", tt)

	return text
end

return export