Module:Sarb-translit
Appearance
- පහත දැක්වෙන උපදෙස්, Module:Sarb-translit/documentation හි පිහිටා ඇත. Module:Sarb-translit/documentation]]. [සංස්කරණය] Categories were auto-generated by Module:module categorization. [edit]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
This module will transliterate text in the Ancient South Arabian අක්ෂරක්රමය. It is used to transliterate Minaean, Old South Arabian, Harami, Hadrami, Qatabanian, and Sabaean.
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:Sarb-translit/testcases.
Functions
tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When the transliteration fails, returns
nil
.
local export = {}
local correspondences = {
["𐩠"] = "h", ["𐩡"] = "l", ["𐩢"] = "ḥ", ["𐩣"] = "m", ["𐩤"] = "q",
["𐩥"]= "w", ["𐩦"] = "s²", ["𐩧"] = "r", ["𐩨"] = "b", ["𐩩"] = "t",
["𐩪"] = "s¹", ["𐩫"] = "k", ["𐩬"] = "n", ["𐩭"] = "ḫ", ["𐩮"] = "ṣ",
["𐩯"] = "s³", ["𐩰"] = "f", ["𐩱"] = "ʾ", ["𐩲"] = "ʿ", ["𐩳"] = "ḍ",
["𐩴"] = "g", ["𐩵"] = "d", ["𐩶"] = "ġ", ["𐩷"] = "ṭ", ["𐩸"] = "z",
["𐩹"] = "ḏ", ["𐩺"] = "y", ["𐩻"] = "ṯ", ["𐩼"] = "ẓ",
["𐩽"] = " ",
}
local numbers = {
["𐩽"] = "1",
["𐩭"] = "5",
["𐩲"] = "10",
["𐩾"] = "50",
["𐩣"] = "100",
["𐩱"] = "1000",
}
function export.tr(text, lang, sc)
-- Interpret numbers.
-- Will not work for thousands!
text = text:gsub(
"𐩿(..-)𐩿",
function (number)
local value = 0
for digit in mw.ustring.gmatch(number, ".") do
value = value + numbers[digit] or error("The character " .. digit .. " in " .. number .. " does not have a numeric value.")
end
return value
end)
text = mw.ustring.gsub(text, ".", correspondences)
return text
end
return export