Module:dlg-translit
Appearance
- The following documentation is located at Module:dlg-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Dolgan language text per WT:DLG 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:dlg-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', ["а"]='a', ["Б"]='B', ["б"]='b', ["Г"]='G', ["г"]='g', ["Ҕ"]='Ǧ', ["ҕ"]='ǧ',
["Д"]='D', ["д"]='d', ["И"]='I', ["и"]='i', ["Й"]='J', ["й"]='j', ["К"]='K', ["к"]='k',
["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n', ["Ӈ"]='Ŋ', ["ӈ"]='ŋ',
["О"]='O', ["о"]='o', ["Ө"]='Ö', ["ө"]='ö', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r',
["С"]='S', ["с"]='s', ["Һ"]='H', ["һ"]='h', ["Т"]='T', ["т"]='t', ["У"]='U', ["у"]='u',
["Ү"]='Ü', ["ү"]='ü', ["Х"]='X', ["х"]='x', ["Ч"]='Č', ["ч"]='č', ["Ш"]='Š', ["ш"]='š',
["Ы"]='Y', ["ы"]='y', ["Э"]='E', ["э"]='e',
-- non-native letters
["В"]='V', ["в"]='v', ["Е"]='Je', ["е"]='je', ["Ё"]='Jo', ["ё"]='jo', ["Ж"]='Ž', ["ж"]='ž',
["З"]='Z', ["з"]='z', ["Ф"]='F', ["ф"]='f', ["Ц"]='C', ["ц"]='c', ["Щ"]='Ŝ', ["щ"]='ŝ',
['Ъ']='ʺ', ['ъ']='ʺ', ["Ь"]="’", ["ь"]="’", ["Ю"]='Ju', ["ю"]='ju', ["Я"]='Ja', ["я"]='ja',
}
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, 'нь', 'ń')
return (mw.ustring.gsub(text,'.',tab))
end
return export