Pergi ke kandungan

Modul:Cher-translit

Daripada Wikikamus

This module will transliterate text in the Tulisan Cherokee. It is also used to transliterate Cherokee. 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:Cher-translit/testcases.

Functions

[sunting]
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 transliteration fails, returns nil.

local export = {}
 
local chars = {
	["Ꭰ"]="a",
	["Ꭱ"]="e",
	["Ꭲ"]="i",
	["Ꭳ"]="o",
	["Ꭴ"]="u",
	["Ꭵ"]="v",
	
	["Ꭶ"]="ga",
	["Ꭷ"]="ka",
	["Ꭸ"]="ge",
	["Ꭹ"]="gi",
	["Ꭺ"]="go",
	["Ꭻ"]="gu",
	["Ꭼ"]="gv",
	
	["Ꭽ"]="ha",
	["Ꭾ"]="he",
	["Ꭿ"]="hi",
	["Ꮀ"]="ho",
	["Ꮁ"]="hu",
	["Ꮂ"]="hv",
	
	["Ꮃ"]="la",
	["Ꮄ"]="le",
	["Ꮅ"]="li",
	["Ꮆ"]="lo",
	["Ꮇ"]="lu",
	["Ꮈ"]="lv",
	
	["Ꮉ"]="ma",
	["Ꮊ"]="me",
	["Ꮋ"]="mi",
	["Ꮌ"]="mo",
	["Ꮍ"]="mu",
	
	["Ꮎ"]="na",
	["Ꮏ"]="hna",
	["Ꮐ"]="nah",
	["Ꮑ"]="ne",
	["Ꮒ"]="ni",
	["Ꮓ"]="no",
	["Ꮔ"]="nu",
	["Ꮕ"]="nv",
	
	["Ꮖ"]="qua",
	["Ꮗ"]="que",
	["Ꮘ"]="qui",
	["Ꮙ"]="quo",
	["Ꮚ"]="quu",
	["Ꮛ"]="quv",
	
	["Ꮝ"]="s",
	["Ꮜ"]="sa",
	["Ꮞ"]="se",
	["Ꮟ"]="si",
	["Ꮠ"]="so",
	["Ꮡ"]="su",
	["Ꮢ"]="sv",
	
	["Ꮣ"]="da",
	["Ꮤ"]="ta",
	["Ꮥ"]="de",
	["Ꮦ"]="te",
	["Ꮧ"]="di",
	["Ꮨ"]="ti",
	["Ꮩ"]="do",
	["Ꮪ"]="du",
	["Ꮫ"]="dv",
	
	["Ꮬ"]="dla",
	["Ꮭ"]="tla",
	["Ꮮ"]="tle",
	["Ꮯ"]="tli",
	["Ꮰ"]="tlo",
	["Ꮱ"]="tlu",
	["Ꮲ"]="tlv",
	
	["Ꮳ"]="tsa",
	["Ꮴ"]="tse",
	["Ꮵ"]="tsi",
	["Ꮶ"]="tso",
	["Ꮷ"]="tsu",
	["Ꮸ"]="tsv",
	
	["Ꮹ"]="wa",
	["Ꮺ"]="we",
	["Ꮻ"]="wi",
	["Ꮼ"]="wo",
	["Ꮽ"]="wu",
	["Ꮾ"]="wv",
	
	["Ꮿ"]="ya",
	["Ᏸ"]="ye",
	["Ᏹ"]="yi",
	["Ᏺ"]="yo",
	["Ᏻ"]="yu",
	["Ᏼ"]="yv",
}

function export.tr(text)
	for key, repl in pairs(chars) do
		text = mw.ustring.gsub(text, key, repl)
	end
	
	return text
end

return export