Module:nio-translit
Appearance
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Nganasan 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:nio-translit/testcases.
Functions
[edit]tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When the transliteration fails, returns
nil
.
local export = {}
local tab = {
["А"]="A", ["Б"]="B", ["В"]="V", ["Г"]="G", ["Д"]="D", ["Е"]="Je", ["Ё"]="Jo", ["Ж"]="Ž", ["З"]="Z", ["И"]="I", ["Й"]="J",
["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["Ӈ"]="Ŋ", ["О"]="O", ["Ө"]="Ö", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T",
["У"]="U", ["Ү"]="Ü", ["Ф"]="F", ["Х"]="X", ["Ц"]="C", ["Ч"]="Č", ["Ш"]="Š", ["Щ"]="Šč",["Ъ"]="", ["Ы"]="Ɨ", ["Ь"]="ʹ",
["Э"]="E", ["Ә"]="Ə", ["Ю"]="Ju", ["Я"]="Ja", ["І"]="I",
['а']='a', ['б']='b', ['в']='v', ['г']='g', ['д']='d', ['е']='je', ['ё']='jo', ['ж']='ž', ['з']='z', ['и']='i', ['й']='j',
['к']='k', ['л']='l', ['м']='m', ['н']='n', ["ӈ"]="ŋ", ['о']='o', ['ө']='ö', ['п']='p', ['р']='r', ['с']='s', ['т']='t',
['у']='u', ['ү']='ü', ['ф']='f', ['х']='x', ['ц']='c', ['ч']='č', ['ш']='š', ['щ']='šč',['ъ']='', ['ы']='ɨ', ['ь']='ʹ',
['э']='e', ['ә']='ə', ['ю']='ju', ['я']='ja', ["ˮ"]="ʔ", ["і"]="i",
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, "З̌", "Ð")
text = mw.ustring.gsub(text, "з̌", "ð")
text = mw.ustring.gsub(text, "([ТДНтдн])И", "%1Ji")
text = mw.ustring.gsub(text, "([ТДНтдн])и", "%1ji")
return (mw.ustring.gsub(text, '.' ,tab))
end
return export