This module will transliterate Yakut language text per WT:SAH 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:sah-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.local export = {}
local tab = {
='A', ='a', ='B', ='b', ='G', ='g', ='Ğ', ='ğ',
='D', ='d', ='İ', ='i', ='Y', ='y', ='K', ='k',
='L', ='l', ='M', ='m', ='N', ='n', ='Ñ', ='ñ',
='O', ='o', ='Ö', ='ö', ='P', ='p', ='R', ='r',
='S', ='s', ='H', ='h', ='T', ='t', ='U', ='u',
='Ü', ='ü', ='Q', ='q', ='C', ='c', ='I', ='ı',
='E', ='e',
-- non-native letters
='V', ='v', ='E', ='e', ='O', ='o', ='Zh', ='zh',
='Z', ='z', ='F', ='f', ='Ts', ='ts', ='Sh', ='sh',
='Shc', ='shc', ='', ='', ="", ="", ='U', ='u',
='A', ='a',
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, 'Дь', 'J')
text = mw.ustring.gsub(text, 'дь', 'j')
text = mw.ustring.gsub(text, 'НЬ', 'NY')
text = mw.ustring.gsub(text, 'Нь', 'Ny')
text = mw.ustring.gsub(text, 'нь', 'ny')
-- soft vowels after a vowel or at the beginning of a word become j-
text = mw.ustring.gsub(text, "(?)()", "%1y%2")
text = mw.ustring.gsub(text, "^()", "Y%1")
text = mw.ustring.gsub(text, "^()", "y%1")
return (mw.ustring.gsub(text,'.',tab))
end
return export