Module:Transliterator: Difference between revisions

From Linguifex
Jump to navigation Jump to search
mNo edit summary
No edit summary
Tag: Reverted
Line 1: Line 1:
local gsub = mw.ustring.gsub
local p = {}
local p = {}
function p.aurebeshlatn( frame )
function p.aurebeshlatn( frame )
local patterns = {
["a"] = {"AE", 18}, ["á"] = {"A", 22}, ["b"] = {"B", 21},
["ch"] = {"CH", 22}, ["c"] = {"C", 13}, ["d"] = {"D", 18},
["f"] = {"F", 21}, ["ng"] = {"NG", 17}, ["g"] = {"G", 20},
["kh"] = {"KH", 15}, ["sh"] = {"SH", 24}, ["th"] = {"TH", 19},
["h"] = {"H", 21}, ["i"] = {"E", 20}, ["í"] = {"I", 8},
["j"] = {"J", 19}, ["k"] = {"K", 20}, ["l"] = {"L", 13},
["m"] = {"M", 12}, ["n"] = {"N", 21}, ["o"] = {"O", 19},
["ó"] = {"EO", 21}, ["p"] = {"P", 13}, ["q"] = {"Q", 17},
["r"] = {"R", 16}, ["s"] = {"S", 20}, ["t"] = {"T", 21},
["u"] = {"U", 19}, ["ú"] = {"OO", 13}, ["v"] = {"V", 16},
["w"] = {"W", 21}, ["x"] = {"X", 17}, ["y"] = {"Y", 21},
["z"] = {"Z", 18}, ["-"] = {"-", 14},
}
local function aurebeshimgs(letter,size)
return "[[File:Aurebesh-" .. letter .. ".svg|" .. tostring(size) .. "px]]"
end
local word = frame.args[1]  
local word = frame.args[1]  
local a = string.gsub( word, "a", "ឆ" )
local aa = string.gsub( a, "á", "ឹ" )
local b = string.gsub( aa, "b", "េ" )
local ch = string.gsub( b, "ch", "➽" )
local c = string.gsub( ch, "c", "⇇" )
local d = string.gsub( c, "d", "⥣" )
local f = string.gsub( d, "f", "⬇︎" )
local ng = string.gsub( f, "ng", "⇲" )
local g = string.gsub( ng, "g", "↹" )
local kh = string.gsub( g, "kh", "↨" )
local sh = string.gsub( kh, "sh", "រ" )
local th = string.gsub( sh, "th", "⥺" )
local h = string.gsub( th, "h", "ត" )
local i = string.gsub( h, "i", "យ" )
local ii = string.gsub( i, "í", "ុ" )
local j = string.gsub( ii, "j", "ិ" )
local k = string.gsub( j, "k", "ោ" )
local l = string.gsub( k, "l", "ផ" )
local m = string.gsub( l, "m", "ៀ" )
local n = string.gsub( m, "n", "ឪ" )
local o = string.gsub( n, "o", "ា" )
local oo = string.gsub( o, "ó", "ស" )
local p = string.gsub( oo, "p", "ដ" )
local q = string.gsub( p, "q", "ថ" )
local r = string.gsub( q, "r", "ង" )
local s = string.gsub( r, "s", "Ӝ" )
local t = string.gsub( s, "t", "ហ" )
local u = string.gsub( t, "u", "្" )
local uu = string.gsub( u, "ú", "ᑓ" )
local v = string.gsub( uu, "v", "א" )
local w = string.gsub( v, "w", "ב" )
local x = string.gsub( w, "x", "ក" )
local y = string.gsub( x, "y", "ג" )
local z = string.gsub( y, "z", "ד" )
local dash = string.gsub( z, "-", "@" )
local aimg = string.gsub( dash, "ឆ", "[[File:Aurebesh-AE.svg|18px]]" )
for letter, info in ipairs(patterns) do
local aaimg = string.gsub( aimg, "ឹ", "[[File:Aurebesh-A.svg|22px]]" )
word = word:gsub(letter, aurebeshimgs(info[1], info[2]))
local bimg = string.gsub( aaimg, "េ", "[[File:Aurebesh-B.svg|21px]]" )
end
local chimg = string.gsub( bimg, "➽", "[[File:Aurebesh-CH.svg|22px]]" )
local cimg = string.gsub( chimg, "⇇", "[[File:Aurebesh-C.svg|13px]]" )
local dimg = string.gsub( cimg, "⥣", "[[File:Aurebesh-D.svg|18px]]" )
local fimg = string.gsub( dimg, "⬇︎", "[[File:Aurebesh-F.svg|21px]]" )
local ngimg = string.gsub( fimg, "⇲", "[[File:Aurebesh-NG.svg|17px]]" )
local gimg = string.gsub( ngimg, "↹", "[[File:Aurebesh-G.svg|20px]]" )
local khimg = string.gsub( gimg, "↨", "[[File:Aurebesh-KH.svg|15px]]" )
local shimg = string.gsub( khimg, "រ", "[[File:Aurebesh-SH.svg|24px]]" )
local thimg = string.gsub( shimg, "⥺", "[[File:Aurebesh-TH.svg|19px]]" )
local himg = string.gsub( thimg, "ត", "[[File:Aurebesh-H.svg|21px]]")
local iimg = string.gsub( himg, "យ", "[[File:Aurebesh-E.svg|20px]]" )
local iiimg = string.gsub( iimg,  "ុ", "[[File:Aurebesh-I.svg|8px]]" )
local jimg = string.gsub( iiimg,  "ិ", "[[File:Aurebesh-J.svg|19px]]" )
local kimg = string.gsub( jimg, "ោ", "[[File:Aurebesh-K.svg|20px]]" )
local limg = string.gsub( kimg, "ផ", "[[File:Aurebesh-L.svg|13px]]" )
local mimg = string.gsub( limg, "ៀ", "[[File:Aurebesh-M.svg|12px]]" )
local nimg = string.gsub( mimg, "ឪ", "[[File:Aurebesh-N.svg|21px]]" )
local oimg = string.gsub( nimg, "ា", "[[File:Aurebesh-O.svg|19px]]" )
local ooimg = string.gsub( oimg, "ស", "[[File:Aurebesh-EO.svg|21px]]" )
local pimg = string.gsub( ooimg, "ដ", "[[File:Aurebesh-P.svg|13px]]" )
local qimg = string.gsub( pimg, "ថ", "[[File:Aurebesh-Q.svg|17px]]" )
local rimg = string.gsub( qimg, "ង", "[[File:Aurebesh-R.svg|16px]]" )
local simg = string.gsub( rimg, "Ӝ", "[[File:Aurebesh-S.svg|20px]]" )
local timg = string.gsub( simg, "ហ", "[[File:Aurebesh-T.svg|21px]]" )
local uimg = string.gsub( timg, "្", "[[File:Aurebesh-U.svg|19px]]" )
local uuimg = string.gsub( uimg, "ᑓ", "[[File:Aurebesh-OO.svg|13px]]" )
local vimg = string.gsub( uuimg, "א", "[[File:Aurebesh-V.svg|16px]]" )
local wimg = string.gsub( vimg, "ב", "[[File:Aurebesh-W.svg|21px]]" )
local ximg = string.gsub( wimg, "ក", "[[File:Aurebesh-X.svg|17px]]" )
local yimg = string.gsub( ximg, "ג", "[[File:Aurebesh-Y.svg|21px]]" )
local zimg = string.gsub( yimg, "ד", "[[File:Aurebesh-Z.svg|18px]]" )
local dshimg = string.gsub( zimg, "@", "[[File:Aurebesh--.svg|14px]]")
return dshimg
return word
end
end



Revision as of 12:02, 28 November 2023



local gsub = mw.ustring.gsub

local p = {}

function p.aurebeshlatn( frame )
	local patterns = {
		["a"] = {"AE", 18}, ["á"] = {"A", 22}, ["b"] = {"B", 21},
		["ch"] = {"CH", 22}, ["c"] = {"C", 13}, ["d"] = {"D", 18},
		["f"] = {"F", 21}, ["ng"] = {"NG", 17}, ["g"] = {"G", 20},
		["kh"] = {"KH", 15}, ["sh"] = {"SH", 24}, ["th"] = {"TH", 19},
		["h"] = {"H", 21}, ["i"] = {"E", 20}, ["í"] = {"I", 8},
		["j"] = {"J", 19}, ["k"] = {"K", 20}, ["l"] = {"L", 13},
		["m"] = {"M", 12}, ["n"] = {"N", 21}, ["o"] = {"O", 19},
		["ó"] = {"EO", 21}, ["p"] = {"P", 13}, ["q"] = {"Q", 17},
		["r"] = {"R", 16}, ["s"] = {"S", 20}, ["t"] = {"T", 21},
		["u"] = {"U", 19}, ["ú"] = {"OO", 13}, ["v"] = {"V", 16},
		["w"] = {"W", 21}, ["x"] = {"X", 17}, ["y"] = {"Y", 21},
		["z"] = {"Z", 18}, ["-"] = {"-", 14}, 
	}
	
	local function aurebeshimgs(letter,size)
		return "[[File:Aurebesh-" .. letter .. ".svg|" .. tostring(size) .. "px]]"
	end
	
	local word = frame.args[1] 
	
	for letter, info in ipairs(patterns) do
		word = word:gsub(letter, aurebeshimgs(info[1], info[2]))
	end
	
	return word
end

function p.aureaure( frame )
	local word = frame.args[1]
end

function p.qdtcyrl( frame )
	local word = frame.args[1] 
	local a = string.gsub( word, "а", "a" )
	local aa = string.gsub( a, "А", "A" )
	local b = string.gsub( aa, "б", "b" )
	local bb = string.gsub( b, "Б", "B" )
	local v = string.gsub( bb, "в", "v" )
	local vv = string.gsub( v, "В", "V" )
	local g = string.gsub( vv, "г", "g" )
	local gg = string.gsub( g, "Г", "G" )
	local d = string.gsub( gg, "д", "d" )
	local dd = string.gsub( d, "Д", "D" )
	local je = string.gsub( dd, "е", "ê" )
	local jeje = string.gsub( je, "Е", "Ê" )
	local jo = string.gsub( jeje, "ё", "ĕ" )
	local jojo = string.gsub( jo, "Ё", "Ĕ" )
	local zh = string.gsub( jojo, "ж", "ž" )
	local zhzh = string.gsub( zh, "Ж", "Ž" )
end

function p.qrqcyrl( frame )
	local word = frame.args[1]
	local a = string.gsub( word, "а", "a" )
	local aa = string.gsub( a, "А", "A" )
	local b = string.gsub( aa, "б", "b" )
	local bb = string.gsub( b, "Б", "B" )
	local v = string.gsub( bb, "в", "v" )
	local vv = string.gsub( v, "В", "V" )
	local g = string.gsub( vv, "г", "g" )
	local gg = string.gsub( g, "Г", "G" )
	local d = string.gsub( gg, "д", "d" )
	local dd = string.gsub( d, "Д", "D" )
	local je = string.gsub( dd, "е", "e" )
	local jeje = string.gsub( je, "Е", "E" )
	local jo = string.gsub( jeje, "ё", "ô" )
	local jojo = string.gsub( jo, "Ё", "Ô" )
	local zh = string.gsub( jojo, "ж", "ž" )
	local zhzh = string.gsub( zh, "Ж", "Ž" )
	local z = string.gsub( zhzh, "з", "z" )
	local zz = string.gsub( z, "З", "Z" )
	local i = string.gsub( zz, "и", "i" )
	local ii = string.gsub( i, "И", "I" )
	local j = string.gsub( ii, "й", "j" )
	local jj = string.gsub( j, "Й", "J" )
	local k = string.gsub( jj, "к", "k" )
	local kk = string.gsub( k, "К", "K" )
	local l = string.gsub( kk, "л", "l" )
	local ll = string.gsub( l, "Л", "L" )
	local m = string.gsub( ll, "м", "m" )
	local mm = string.gsub( m, "М", "M" )
	local n = string.gsub( mm, "н", "n" )
	local nn = string.gsub( n, "Н", "N" )
	local o = string.gsub( nn, "о", "o" )
	local oo = string.gsub( o, "О", "O" )
	local p = string.gsub( oo, "п", "p" )
	local pp = string.gsub( p, "П", "P" )
	local r = string.gsub( pp, "р", "r" )
	local rr = string.gsub( r, "Р", "R" )
	local s = string.gsub( rr, "с", "s" )
	local ss = string.gsub( s, "С", "S" )
	local t = string.gsub( ss, "т", "t" )
	local tt = string.gsub( t, "Т", "T" )
	local u = string.gsub( tt, "у", "u" )
	local uu = string.gsub( u, "У", "U" )
	local f = string.gsub( uu, "ф", "f" )
	local ff = string.gsub( f, "Ф", "F" )
	local x = string.gsub( ff, "х", "x" )
	local xx = string.gsub( x, "Х", "X" )
	local c = string.gsub( xx, "ц", "c" )
	local cc = string.gsub( c, "Ц", "C" )
	local ch = string.gsub( cc, "ч", "č" )
	local chch = string.gsub( ch, "Ч", "Č" )
	local sh = string.gsub( chch, "ш", "š" )
	local shsh = string.gsub( sh, "Ш", "Š" )
	local nsh = string.gsub( shsh, "щ", "nš" )
	local nshc = string.gsub( nsh, "Щ", "NŠ" )
	local y = string.gsub( nshc, "ы", "y" )
	local yy = string.gsub( y, "Ы", "Y" )
	local apostr = string.gsub( yy, "ъ", "j" )
	local apostrc = string.gsub( apostr, "Ъ", "J" )
	local papostr = string.gsub( apostrc, "'", "j" )
	local prime = string.gsub( papostr, "ь", "′" )
	local primec = string.gsub( prime, "Ь", "′" )
	local e = string.gsub( primec, "э", "ɛ" )
	local ee = string.gsub( e, "Э", "Ɛ" )
	local ju = string.gsub( ee, "ю", "û" )
	local juju = string.gsub( ju, "Ю", "Û" )
	local ja = string.gsub( juju, "я", "â" )
	local jaja = string.gsub( ja, "Я", "Â" )
	local ji = string.gsub( jaja, "і", "î" )
	local jiji = string.gsub( ji, "І", "Î" )
	local ng = string.gsub( jiji, "ҥ", "ŋ" )
	local ngng = string.gsub( ng, "Ҥ", "Ŋ" )
	local oe = string.gsub( ngng, "ө", "ô" )
	local oeoe = string.gsub( oe, "Ө", "Ô" )
	local jy = string.gsub( oeoe, "ѣ", "ŷ" )
	local jyjy = string.gsub( jy, "Ѣ", "Ŷ" )
	
	return jyjy
end
return p