Module:Transliterator: Difference between revisions
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] | ||
for letter, info in ipairs(patterns) do | |||
word = word:gsub(letter, aurebeshimgs(info[1], info[2])) | |||
end | |||
return | return word | ||
end | end | ||
Revision as of 12:02, 28 November 2023
- The following documentation is located at Module:Transliterator/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
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