Module:gon-Gong-translit
Appearance
- The following documentation is located at Module:gon-Gong-translit/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
Gunjala Gondi transliteration module.
This module will transliterate Gondi 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:gon-Gong-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
.
Testcases
[edit]Module:gon-Gong-translit/testcases:
All tests passed. (refresh)
Text | Expected | Actual | Comments | |
---|---|---|---|---|
𑵭𑶂𑶌 | vaḍī | vaḍī | ṛ represented by 𑶂 <ḍ> |
local export = {}
local gsub = mw.ustring.gsub
local consonants = {
['𑵱'] = 'k', ['𑵲'] = 'kh', ['𑵶'] = 'g', ['𑵷'] = 'gh', ['𑶄']='ṅ',
['𑵻'] = 'c', ['𑵼'] = 'ch', ['𑶀'] = 'j', ['𑶁'] = 'jh',
['𑵽'] = 'ṭ', ['𑵾'] = 'ṭh', ['𑶂'] = 'ḍ', ['𑶃'] = 'ḍh',
['𑵳'] = 't', ['𑵴'] = 'th', ['𑵸'] = 'd', ['𑵹'] = 'dh', ['𑵺']='n',
['𑶅'] = 'p', ['𑶆'] = 'ph', ['𑵮'] = 'b', ['𑵯'] = 'bh' , ['𑵰']='m',
['𑵬'] = 'y', ['𑶈'] = 'r', ['𑵵'] = 'l', ['𑵭'] = 'v', ['𑵿'] = 'ḷ', ['𑶉'] = 's', ['𑶇'] = 'h',
}
local diacritics = {
['𑶊'] = 'ā', ['𑶋'] = 'i', ['𑶌'] = 'ī',['𑶍'] = 'u', ['𑶎'] = 'ū',
['𑶐'] = 'ē', ['𑶑'] = 'ai', ['𑶓'] = 'ō', ['𑶔'] = 'au', ['𑶗'] = '',
}
local tt = {
-- vowels
['𑵠'] = 'a', ['𑵡'] ='ā' , ['𑵢'] ='i' , ['𑵣'] = 'ī' , ['𑵤'] = 'u' , ['𑵥'] = 'ū' ,
['𑵧'] = 'ē', ['𑵨'] ='ai', ['𑵪'] ='ō', ['𑵫'] = 'au',
-- other symbols
['𑶕'] = 'ṁ',-- anusvara
['𑶖'] = 'ḥ' , -- visarga
['𑶘'] = 'ōm' , -- om
-- digits
['𑶠'] = '0', ['𑶡'] = '1', ['𑶢'] = '2', ['𑶣'] = '3', ['𑶤'] = '4',
['𑶥'] = '5', ['𑶦'] = '6', ['𑶧'] = '7', ['𑶨'] = '8', ['𑶩'] = '9',
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = gsub(
text,
'([𑵬𑵭𑵮𑵯𑵰𑵱𑵲𑵳𑵴𑵵𑵶𑵷𑵸𑵹𑵺𑵻𑵼𑵽𑵾𑵿𑶀𑶁𑶂𑶃𑶄𑶅𑶆𑶇𑶈𑶉])'..
'([𑶊𑶋𑶌𑶍𑶎𑶐𑶑𑶓𑶔]?)',
function(c, d)
if d == "" then
return consonants[c] ..'a'
else
return consonants[c] .. diacritics[d]
end
end)
text = gsub(text,'.', tt)
-- anusvara
text = gsub(text,'ṁ([kgṅ])','ṅ%1')
text = gsub(text,'ṁ([cjñ])','ñ%1')
text = gsub(text,'ṁ([ṭḍṇ])','ṇ%1')
text = gsub(text,'ṁ([tdn])','n%1')
text = gsub(text,'ṁ([pbm])','m%1')
return text
end
return export