Jump to content

Module:pgl-translit

From Wiktionary, the free dictionary

This module will transliterate Primitive Irish 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:pgl-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 = {
	[" "] = " ",
	["·"] = ".",
	
	["ᚁ"] = "b", -- beith
	["ᚂ"] = "l", -- luis
	["ᚃ"] = "v", -- fearn
	["ᚄ"] = "s", -- saille
	["ᚅ"] = "n", -- nuin
	
	["ᚆ"] = "h", -- uath
	["ᚇ"] = "d", -- dair
	["ᚈ"] = "t", -- tinne
	["ᚉ"] = "c", -- coll
	["ᚊ"] = "q", -- ceirt
	
	["ᚋ"] = "m", -- muin
	["ᚌ"] = "g", -- gort
	["ᚍ"] = "ŋ", -- ngétal
	["ᚎ"] = "z", -- straif
	["ᚏ"] = "r", -- ruis
	
	["ᚐ"] = "a", -- ailm
	["ᚑ"] = "o", -- onn
	["ᚒ"] = "u", -- úr
	["ᚓ"] = "e", -- edad
	["ᚔ"] = "i", -- idad
	
	["ᚕ"] = "k", -- Or "ea"
	["ᚖ"] = "oi",
	["ᚗ"] = "ui",
	["ᚘ"] = "p", -- Or "ia"
	["ᚙ"] = "x", -- Or "ae"
	["ᚚ"] = "p", -- peithboc "soft B"
	
	["᚛"] = "",
	["᚜"] = "",
}

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

return export