Jump to content

Module:Lydi-translit

From Wiktionary, the free dictionary

This module will transliterate text in the Lydian script. It is used to transliterate Lydian. 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:Lydi-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 = {
	["𐤠"] = "a",
	["𐤵"] = "ã",
	["𐤡"] = "p", -- formerly b
	["𐤹"] = "c",
	["𐤣"] = "d",
	["𐤤"] = "e",
	["𐤶"] = "ẽ",
	["𐤱"] = "f",
	["𐤢"] = "g",
	["𐤦"] = "i",
	["𐤧"] = "y",
	["𐤨"] = "k",
	["𐤩"] = "l",
	["𐤷"] = "λ", -- Greek lambda
	["𐤪"] = "m",
	["𐤫"] = "n",
	["𐤸"] = "ñ", -- formerly ν, which is Greek nu, not Latin vee!
	["𐤬"] = "o",
	["𐤲"] = "q",
	["𐤭"] = "r",
	["𐤳"] = "š", -- formerly s
	["𐤮"] = "s", -- formerly ś
	["𐤯"] = "t",
	["𐤴"] = "τ", -- note: this is Greek tau
	["𐤰"] = "u",
	["𐤥"] = "w", -- formerly v
}

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

return export