Module:uum-translit
Appearance
- The following documentation is located at Module:uum-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Urum language text per WT:UUM TR.
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:uum-translit/testcases.
Functions
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", ["Е"] ="E", ["Ж"] ="Ž", ["З"] ="Z", ["И"] ="I", ["Й"] ="J",
["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["О"]="O", ["Ӧ"]="Ö", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T",
["У"]="U", ["Ӱ"]="Ü", ["Ф"]="F", ["Х"]="H", ["Ч"]="Č", ["Ш"]="Š", ["Ґ"]="Ǧ", ["Ы"]="Y", ["Э"]="E",
['а']='a', ['б']='b', ['в']='v', ['г']='g', ['д']='d', ['е']='e', ['ж']='ž', ['з']='z', ['и']='i', ['й']='j',
['к']='k', ['л']='l', ['м']='m', ['н']='n', ['о']='o', ['ӧ']='ö', ['п']='p', ['р']='r', ['с']='s', ['т']='t',
['у']='u', ['ӱ']='ü', ['ф']='f', ['х']='h', ['ч']='č', ['ш']='š', ['ґ']='ǧ', ['ы']='y', ['э']='e',
['дж']= 'dž' , ['Дж']= 'Dž',
}
local iotated = {
["Е"] = "Je",
["е"] = "je",
}
function export.tr(text, lang, sc)
local ugsub = mw.ustring.gsub
-- е after a vowel or at the beginning of a word becomes je
text = ugsub(text, "([АОӨУҮЫЯЁЮИЪЬаоөуүыяёюиъь%A][́̀]?)е", "%1je")
--text = mw.ustring.gsub(text, "([АОӨУҮЫЕЯЁЮИЕЪЬаоөуүыэяёюиеъь%A][́̀]?)е", "%1je")
text = ugsub(text, "^[Ее]", iotated)
text = ugsub(text, "([^Ѐ-ӿ])([Ее])", function(a, b)
return a .. iotated[b]
end)
return (ugsub(text, '.', tab))
end
return export