Module:tyv-translit
Jump to navigation
Jump to search
- The following documentation is located at Module:tyv-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Tuvan language text per WT:TYV 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:tyv-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", ["Ё"]="Yo", ["Ж"]="J", ["З"]="Z", ["И"]="İ", ["Й"]="Y",
["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["Ң"]="Ñ", ["О"]="O", ["Ө"]="Ö", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T",
["У"]="U", ["Ү"]="Ü", ["Ф"]="F", ["Х"]="X", ["Ц"]="Ts", ["Ч"]="Ç", ["Ш"]="Ş", ["Щ"]="Şş", ["Ъ"]="ʺ", ["Ы"]="I", ["Ь"]="ʹ",
["Э"]="E", ["Ю"]="Yu", ["Я"]="Ya",
['а']='a', ['б']='b', ['в']='v', ['г']='g', ['д']='d', ['е']='e', ['ё']='yo', ['ж']='j', ['з']='z', ['и']='i', ['й']='y',
['к']='k', ['л']='l', ['м']='m', ['н']='n', ['ң']='ñ', ['о']='o', ['ө']='ö', ['п']='p', ['р']='r', ['с']='s', ['т']='t',
['у']='u', ['ү']='ü', ['ф']='f',
['х']='x', ['ц']='ts', ['ч']='ç', ['ш']='ş', ['щ']='şş', ['ъ']='ʺ', ['ы']='ı', ['ь']='ʹ', ['э']='e', ['ю']='yu', ['я']='ya',
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, 'Аъ', 'À')
text = mw.ustring.gsub(text, 'аъ', 'à')
text = mw.ustring.gsub(text, 'Эъ', 'È')
text = mw.ustring.gsub(text, 'эъ', 'è')
text = mw.ustring.gsub(text, 'Оъ', 'Ò')
text = mw.ustring.gsub(text, 'оъ', 'ò')
text = mw.ustring.gsub(text, 'Үъ', 'Ǜ')
text = mw.ustring.gsub(text, 'үъ', 'ǜ')
text = mw.ustring.gsub(text, 'Уъ', 'Ỳ')
text = mw.ustring.gsub(text, 'уъ', 'ỳ')
text = mw.ustring.gsub(text, 'Иъ', 'İ̀')
text = mw.ustring.gsub(text, 'иъ', 'i̇̀')
text = mw.ustring.gsub(text, 'Ыъ', 'Ì')
text = mw.ustring.gsub(text, 'ыъ', 'ì')
text = mw.ustring.gsub(text, 'Өъ', 'Ö̀')
text = mw.ustring.gsub(text, 'өъ', 'ö̀')
-- Ё needs converting if is decomposed
text = text:gsub("ё","ё"):gsub("Ё","Ё")
return (mw.ustring.gsub(text,'.',tab))
end
return export