Module:Narb-translit

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module will transliterate text in the Old North Arabian script. It is used to transliterate Dadanitic, Dumaitic, Hasaitic, Hismaic, Safaitic, Taymanitic, Thamudic, and Ancient North Arabian. 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:Narb-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 export = {}

local chars = {
	["𐪏"] = "s³", ["𐪙"] = "ḏ", ["𐪍"] = "ẖ", ["𐪊"] = "s¹", ["𐪆"] = "s²", 
	["𐪛"] = "ṯ", ["𐪑"] = "ʾ", ["𐪒"] = "ʿ", ["𐪈"] = "b", ["𐪕"] = "d", 
	["𐪓"] = "ḍ", ["𐪐"] = "f", ["𐪔"] = "g", ["𐪖"] = "ġ", ["𐪀"] = "h",
	["𐪂"] = "ḥ", ["𐪋"] = "k", ["𐪁"] = "l", ["𐪃"] = "m", ["𐪌"] = "n",
	["𐪄"] = "q", ["𐪇"] = "r", ["𐪎"] = "ṣ", ["𐪉"] = "t", ["𐪗"] = "ṭ",
	["𐪅"] = "w", ["𐪚"] = "y", ["𐪘"] = "z", ["𐪜"] = "ẓ",
}

function export.tr(text, lang, sc)
	return (mw.ustring.gsub(text, '.', chars))
end

return export