Module:ky-translit
Appearance
- The following documentation is located at Module:ky-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox (diff)
This module will transliterate Kyrgyz language text per WT:KY 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:ky-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 tt = {
["ү"]="ü",['Ү']='Ü', ["т"]="t",['Т']='T', ["р"]="r",['Р']='R', ["ф"]="f",['Ф']='F', ["ө"]="ö",['Ө']='Ö',
["ю"]="yu",['Ю']='Yu', ["ш"]="ş",['Ш']='Ş', ["ь"]="",['Ь']='', ["ъ"]="",['Ъ']='', ["н"]="n",['Н']='N',
["п"]="p",['П']='P', ["й"]="y",['Й']='Y', ["л"]="l",['Л']='L', ["з"]="z",['З']='Z', ["е"]="e",['Е']='E',
["г"]="g",['Г']='G', ["б"]="b",['Б']='B', ["у"]="u",['У']='U', ["с"]="s",['С']='S', ["х"]="h",['Х']='H',
["ч"]="c",['Ч']='C', ["щ"]="şc",['Щ']='Şc', ["я"]="ya",['Я']='Ya', ["ы"]="ı",['Ы']='I', ["э"]="e",['Э']='E',
["м"]="m",['М']='M', ["о"]="o",['О']='O', ["и"]="i",['И']='İ', ["ё"]="yo",['Ё']='Yo', ["ж"]="j",['Ж']='J',
["к"]="k",['К']='K', ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["ц"]="ts",['Ц']='Ts', ["а"]="a",['А']='A',
["ң"]="ŋ",['Ң']='Ŋ'
};
function export.tr(text, lang, sc)
if sc == "Arab" then
return nil
end
text = mw.ustring.gsub(
text,
"([АОӨҮУЫЕЯЁЮИЕаоөүуыэяёюиеъь%A][́̀]?)([Ее])",
function(a,e)
return a .. ( e == 'е' and 'ye' or 'Ye' )
end
)
:gsub("^Е",'Ye')
:gsub("^е",'ye');
return (mw.ustring.gsub(text, '.', tt))
end
return export