Module:yrk-translit

Wiktionary වෙතින්

This module will transliterate Tundra Nenets භාෂාව 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:yrk-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 tab = {
	["А"]="A", ["Б"]="B", ["В"]="W", ["Г"]="G", ["Д"]="D", ["Е"]="Ye", ["Ё"]="Yo", ["Ж"]="Ž", ["З"]="Z", ["И"]="Yi", ["Й"]="Y", ["Ӑ"]="Ă",
	["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["О"]="O", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T", ["У"]="U", ["Ф"]="F", ["Ӣ"]="Yī",
	["Х"]="X", ["Ц"]="C", ["Ч"]="Ć", ["Ш"]="Š", ["Щ"]="Ś", ["Ъ"]="ʺ", ["Ы"]="I", ["Ь"]="ʹ", ["Э"]="E", ["Ю"]="Yu", ["Я"]="Ya", ["Ӈ"]="Ŋ",
	['а']='a', ['б']='b', ['в']='w', ['г']='g', ['д']='d', ['е']='ye', ['ё']='yo', ['ж']='ž', ['з']='z', ['и']='yi', ['й']='y', ["ӑ"]="ă",
	['к']='k', ['л']='l', ['м']='m', ['н']='n', ['о']='o', ['п']='p', ['р']='r', ['с']='s', ['т']='t', ['у']='u', ['ф']='f', ["ӣ"]="yī",
	['х']='x', ['ц']='c', ['ч']='ć', ['ш']='š', ['щ']='ś', ['ъ']='ʺ', ['ы']='i', ['ь']='ʹ', ['э']='e', ['ю']='yu', ['я']='ya', ["ӈ"]="ŋ",
	["ˮ"]="q", ["ʼ"]="h", ['Ӯ']='Ū', ['ӯ']='ū',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, "([БВГДЖЗЙКЛМНПРСТФХЦЧШЩЬӇбвгджзйклмнпрстфхцчшщьӈ])$", "%1°")
	text = mw.ustring.gsub(text, "([БВГДЖЗЙКЛМНПРСТФХЦЧШЩЬӇбвгджзйклмнпрстфхцчшщьӈ]) ", "%1° ")
	text = mw.ustring.gsub(text, "([БВГДЖЗЙКЛМНПРСТФХЦЧШЩЬӇбвгджзйклмнпрстфхцчшщьӈ])[ˮʼ]$", "%1")
	text = mw.ustring.gsub(text, "([БВГДЖЗЙКЛМНПРСТФХЦЧШЩЬӇбвгджзйклмнпрстфхцчшщьӈ])[ˮʼ] ", "%1 ")
	
    return (mw.ustring.gsub(text, '.' ,tab))
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:yrk-translit&oldid=163816" වෙතින් සම්ප්‍රවේශනය කෙරිණි