This module will transliterate Chuvan language text.
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:xcv-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 u = mw.ustring.char
local ACUTE = u(0x0301)
local MACRON = u(0x0304)
local DOTABOVE = u(0x0307)
local DIAER = u(0x0308)
local CARON = u(0x030C)
local str_gsub, ugsub = string.gsub, mw.ustring.gsub
local UTF8char = '*'
local export = {}
local tab = {
='A', ='a', ='B', ='b', ='W', ='w', ='G', ='g',
='D', ='d', ='Je', ='je', ='Jo', ='jo', ='Ž', ='ž',
='Z', ='z', ='Ï', ='ï', ='I', ='i', ='J', ='j',
='K', ='k', ='L', ='l', ='M', ='m', ='N', ='n',
='O', ='o', ='P', ='p', ='R', ='r', ='S', ='s',
='T', ='t', ='U', ='u', ='F', ='f', ='Q', ='q',
='C', ='c', ='Č', ='č', ='Š', ='š', ='Ś', ='ś',
='ʺ', ='ʺ', ='Y', ='y', ='ʹ', ='ʹ', ='E', ='e',
='Ju', ='ju', ='ja', ='ja', ='Ě', ='ě',
}
local other = {
{ 'Аа', 'Ā' }, { 'аа', 'ā' }, --long "а"
{ 'Ее', 'Jē'}, { 'ее', 'jē'}, --long "е"
{ 'Ии', 'Ī' }, { 'ии', 'ī' }, --long "и"
{ 'Оо', 'Ō' }, { 'оо', 'ō' }, --long "о"
{ 'Уу', 'Ū' }, { 'уу', 'ū' }, --long "у"
{ 'Ээ', 'Ē' }, { 'ээ', 'ē' }, --long "э"
{ 'Ъ%-', '%-' }, { 'ъ%-', '%-' }, --final "ъ"
{ 'Ъ ', ' ' }, { 'ъ ', ' ' }, --final "ъ"
{ 'Ъ$', '' }, { 'ъ$', '' }, --final "ъ"
{ '()Е', '%1E'}, --post-consonantal E
{ '()е', '%1e'}, --post-consonantal e
{ '()Ее', '%1Ē'}, --post-consonantal long E
{ '()ее', '%1ē'}, --post-consonantal long e
}
function export.tr(text, lang, sc)
for i, replacement in ipairs(other) do
text = str_gsub(text, unpack(replacement))
end
return (str_gsub(text, UTF8char, tab))
end
return export