This module will transliterate text in the Old Cyrillic script. It is used to transliterate Old Church Slavonic, Old East Slavic, and Old Novgorodian. 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:Cyrs-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local export = {}

local letters = {}
local digraphs = {}

local double_grave = mw.ustring.char(0x30F)

letters["Cyrs"] = {
	["А"]='A', ["а"]='a',
	["Б"]='B', ["б"]='b',
	["В"]='V', ["в"]='v',
	["Г"]='G', ["г"]='g',
	["Д"]='D', ["д"]='d',
	["Е"]='E', ["е"]='e', ["Є"]='E', ["є"]='e',
	["Ж"]='Ž', ["ж"]='ž',
	["Ѕ"]='Dz', ["ѕ"]='dz', ["Ꙃ"]='Dz', ["ꙃ"]='dz', ["Ꙅ"]='Dz', ["ꙅ"]='dz',
	["З"]='Z', ["з"]='z', ["Ꙁ"]='Z', ["ꙁ"]='z',
	["И"]='I', ["и"]='i', ["І"]='I', ["і"]='i', ["Ї"]='I', ["ї"]='i', ["Ѝ"]='Ì', ["ѝ"]='ì', ["Ӥ"]='I', ["ӥ"]='i', ["Ꙇ"]='I', ["ꙇ"]='i',
	["Ꙉ"]='Đ', ["ꙉ"]='đ',
	["К"]='K', ["к"]='k',
	["Л"]='L', ["л"]='l',
	["М"]='M', ["м"]='m',
	["Н"]='N', ["н"]='n',
	["О"]='O', ["о"]='o', ["Ѡ"]='O', ["ѡ"]='o', ["Ѿ"]='Otŭ', ["ѿ"]='otŭ', ["Ꙩ"]='O', ["ꙩ"]='o', ["Ꙫ"]='O', ["ꙫ"]='o', ["Ꙭ"]='O', ["ꙭ"]='o', ["ꙮ"]='o', ["Ѻ"]='O', ["ѻ"]='o', ["Ꙍ"]='O', ["ꙍ"]='o',
	["П"]='P', ["п"]='p',
	["Р"]='R', ["р"]='r',
	["С"]='S', ["с"]='s',
	["Т"]='T', ["т"]='t',
	["Ѹ"]='U', ["ѹ"]='u', ["Ꙋ"]='U', ["ꙋ"]='u', ["У"]='U', ["у"]='u',
	["Ф"]='F', ["ф"]='f',
	["Х"]='X', ["х"]='x',
	["Ц"]='C', ["ц"]='c',
	["Ч"]='Č', ["ч"]='č',
	["Ш"]='Š', ["ш"]='š',
	-- For Щ see below
	["Ъ"]='Ŭ', ["ъ"]='ŭ',
	["Ꙑ"]='Y', ["ꙑ"]='y', ["Ы"]='Y', ["ы"]='y',
	["Ь"]='Ĭ', ["ь"]='ĭ',
	["Ѣ"]='Ě', ["ѣ"]='ě',
	["Ю"]='Ju', ["ю"]='ju',
	["Ꙗ"]='Ja', ["ꙗ"]='ja', ["Я"]='Ja', ["я"]='ja',
	["Ѥ"]='Je', ["ѥ"]='je',
	["Ѧ"]='Ę', ["ѧ"]='ę', ["Ꙙ"]='Ę', ["ꙙ"]='ę',
	["Ѩ"]='Ję', ["ѩ"]='ję', ["Ꙝ"]='Ję', ["ꙝ"]='ję',
	["Ѫ"]='Ǫ', ["ѫ"]='ǫ',
	["Ѭ"]='Jǫ', ["ѭ"]='jǫ',
	["Ꙓ"]='Jě', ["ꙓ"]='jě',
	
	["Ѯ"]='Ks', ["ѯ"]='ks',
	["Ѱ"]='Ps', ["ѱ"]='ps',
	["Ѳ"]='Θ', ["ѳ"]='θ',
	["Ѵ"]='Ü', ["ѵ"]='ü', ["Ѷ"]='Ü' .. double_grave, ["ѷ"]='ü' .. double_grave,
	["Ҁ"]='Q', ["ҁ"]='q',
	-- newer letters
	["Й"]='J', ["й"]='j', -- starting from 15th century
	["Ґ"]='G', ["ґ"]='g',
	["Э"]='E', ["э"]='e',
}

digraphs["Cyrs"] = {
	["([АаꙖꙗ])ѵ"]="%1v",
	["([АаꙖꙗ])Ѵ"]="%1V",
	["О[УѴуѵ]"]="U", ["о[уѵ]"]="u",
	["Ъ[Ии]"]="Y", ["ъи"]="y",
	-- numbers
	["[:·.]а҃[.·:]"]="1", ["[:·.]в҃[.·:]"]="2", ["[:·.]г҃[.·:]"]="3", ["[:·.]д҃[.·:]"]="4",
	["[:·.]е҃[.·:]"]="5", ["[:·.]є҃[.·:]"]="5", ["[:·.]ѕ҃[.·:]"]="6", ["[:·.]ꙅ҃[.·:]"]="6", ["[:·.]з҃[.·:]"]="7", ["[:·.]ꙁ҃[.·:]"]="7", ["[:·.]и҃[.·:]"]="8", ["[:·.]ѳ҃[.·:]"]="9",
	["[:·.]і҃[.·:]"]="10", ["[:·.]а҃і[.·:]"]="11", ["[:·.]в҃і[.·:]"]="12", ["[:·.]г҃і[.·:]"]="13", ["[:·.]д҃і[.·:]"]="14",
	["[:·.]е҃і[.·:]"]="15", ["[:·.]є҃і[.·:]"]="15", ["[:·.]ѕ҃і[.·:]"]="16", ["[:·.]ꙅ҃і[.·:]"]="16", ["[:·.]з҃і[.·:]"]="17", ["[:·.]ꙁ҃і[.·:]"]="17", ["[:·.]и҃і[.·:]"]="18", ["[:·.]ѳ҃і[.·:]"]="19",
	["[:·.]к҃[.·:]"]="20", ["[:·.]к҃а[.·:]"]="21", ["[:·.]к҃в[.·:]"]="22", ["[:·.]к҃г[.·:]"]="23", ["[:·.]к҃д[.·:]"]="24",
	["[:·.]к҃е[.·:]"]="25", ["[:·.]к҃є[.·:]"]="25", ["[:·.]к҃ѕ[.·:]"]="26", ["[:·.]к҃ꙅ[.·:]"]="26", ["[:·.]к҃з[.·:]"]="27", ["[:·.]к҃ꙁ[.·:]"]="27", ["[:·.]к҃и[.·:]"]="28", ["[:·.]к҃ѳ[.·:]"]="29",
	["[:·.]л҃[.·:]"]="30", ["[:·.]л҃а[.·:]"]="31", ["[:·.]л҃в[.·:]"]="32", ["[:·.]л҃г[.·:]"]="33", ["[:·.]л҃д[.·:]"]="34",
	["[:·.]л҃е[.·:]"]="35", ["[:·.]л҃є[.·:]"]="35", ["[:·.]л҃ѕ[.·:]"]="36", ["[:·.]л҃ꙅ[.·:]"]="36", ["[:·.]л҃з[.·:]"]="37", ["[:·.]л҃ꙁ[.·:]"]="37", ["[:·.]л҃и[.·:]"]="38", ["[:·.]л҃ѳ[.·:]"]="39",
	["[:·.]м҃[.·:]"]="40", ["[:·.]м҃а[.·:]"]="41", ["[:·.]м҃в[.·:]"]="42", ["[:·.]м҃г[.·:]"]="43", ["[:·.]м҃д[.·:]"]="44",
	["[:·.]м҃е[.·:]"]="45", ["[:·.]м҃є[.·:]"]="45", ["[:·.]м҃ѕ[.·:]"]="46", ["[:·.]м҃ꙅ[.·:]"]="46", ["[:·.]м҃з[.·:]"]="47", ["[:·.]м҃ꙁ[.·:]"]="47", ["[:·.]м҃и[.·:]"]="48", ["[:·.]м҃ѳ[.·:]"]="49",
	["[:·.]н҃[.·:]"]="50", ["[:·.]н҃а[.·:]"]="51", ["[:·.]н҃в[.·:]"]="52", ["[:·.]н҃г[.·:]"]="53", ["[:·.]н҃д[.·:]"]="54",
	["[:·.]н҃е[.·:]"]="55", ["[:·.]н҃є[.·:]"]="55", ["[:·.]н҃ѕ[.·:]"]="56", ["[:·.]н҃ꙅ[.·:]"]="56", ["[:·.]н҃з[.·:]"]="57", ["[:·.]н҃ꙁ[.·:]"]="57", ["[:·.]н҃и[.·:]"]="58", ["[:·.]н҃ѳ[.·:]"]="59",
	["[:·.]ѯ҃[.·:]"]="60", ["[:·.]ѯ҃а[.·:]"]="61", ["[:·.]ѯ҃в[.·:]"]="62", ["[:·.]ѯ҃г[.·:]"]="63", ["[:·.]ѯ҃д[.·:]"]="64",
	["[:·.]ѯ҃е[.·:]"]="65", ["[:·.]ѯ҃є[.·:]"]="65", ["[:·.]ѯ҃ѕ[.·:]"]="66", ["[:·.]ѯ҃ꙅ[.·:]"]="66", ["[:·.]ѯ҃з[.·:]"]="67", ["[:·.]ѯ҃ꙁ[.·:]"]="67", ["[:·.]ѯ҃и[.·:]"]="68", ["[:·.]ѯ҃ѳ[.·:]"]="69",
	["[:·.]о҃[.·:]"]="70", ["[:·.]о҃а[.·:]"]="71", ["[:·.]о҃в[.·:]"]="72", ["[:·.]о҃г[.·:]"]="73", ["[:·.]о҃д[.·:]"]="74",
	["[:·.]о҃е[.·:]"]="75", ["[:·.]о҃є[.·:]"]="75", ["[:·.]о҃ѕ[.·:]"]="76", ["[:·.]о҃ꙅ[.·:]"]="76", ["[:·.]о҃з[.·:]"]="77", ["[:·.]о҃ꙁ[.·:]"]="77", ["[:·.]о҃и[.·:]"]="78", ["[:·.]о҃ѳ[.·:]"]="79",
	["[:·.]ѻ҃[.·:]"]="70", ["[:·.]ѻ҃а[.·:]"]="71", ["[:·.]ѻ҃в[.·:]"]="72", ["[:·.]ѻ҃г[.·:]"]="73", ["[:·.]ѻ҃д[.·:]"]="74",
	["[:·.]ѻ҃е[.·:]"]="75", ["[:·.]ѻ҃є[.·:]"]="75", ["[:·.]ѻ҃ѕ[.·:]"]="76", ["[:·.]ѻ҃ꙅ[.·:]"]="76", ["[:·.]ѻ҃з[.·:]"]="77", ["[:·.]ѻ҃ꙁ[.·:]"]="77", ["[:·.]ѻ҃и[.·:]"]="78", ["[:·.]ѻ҃ѳ[.·:]"]="79",
	["[:·.]п҃[.·:]"]="80", ["[:·.]п҃а[.·:]"]="81", ["[:·.]п҃в[.·:]"]="82", ["[:·.]п҃г[.·:]"]="83", ["[:·.]п҃д[.·:]"]="84",
	["[:·.]п҃е[.·:]"]="85", ["[:·.]п҃є[.·:]"]="85", ["[:·.]п҃ѕ[.·:]"]="86", ["[:·.]п҃ꙅ[.·:]"]="86", ["[:·.]п҃з[.·:]"]="87", ["[:·.]п҃ꙁ[.·:]"]="87", ["[:·.]п҃и[.·:]"]="88", ["[:·.]п҃ѳ[.·:]"]="89",
	["[:·.]ч҃[.·:]"]="90", ["[:·.]ч҃а[.·:]"]="91", ["[:·.]ч҃в[.·:]"]="92", ["[:·.]ч҃г[.·:]"]="93", ["[:·.]ч҃д[.·:]"]="94",
	["[:·.]ч҃е[.·:]"]="95", ["[:·.]ч҃є[.·:]"]="95", ["[:·.]ч҃ѕ[.·:]"]="96", ["[:·.]ч҃ꙅ[.·:]"]="96", ["[:·.]ч҃з[.·:]"]="97", ["[:·.]ч҃ꙁ[.·:]"]="97", ["[:·.]ч҃и[.·:]"]="98", ["[:·.]ч҃ѳ[.·:]"]="99",
	["[:·.]ҁ҃[.·:]"]="90", ["[:·.]ҁ҃а[.·:]"]="91", ["[:·.]ҁ҃в[.·:]"]="92", ["[:·.]ҁ҃г[.·:]"]="93", ["[:·.]ҁ҃д[.·:]"]="94",
	["[:·.]ҁ҃е[.·:]"]="95", ["[:·.]ҁ҃є[.·:]"]="95", ["[:·.]ҁ҃ѕ[.·:]"]="96", ["[:·.]ҁ҃ꙅ[.·:]"]="96", ["[:·.]ҁ҃з[.·:]"]="97", ["[:·.]ҁ҃ꙁ[.·:]"]="97", ["[:·.]ҁ҃и[.·:]"]="98", ["[:·.]ҁ҃ѳ[.·:]"]="99",
	["[:·.]р҃[.·:]"]="100", ["[:·.]р҃а[.·:]"]="101", ["[:·.]р҃в[.·:]"]="102", ["[:·.]р҃г[.·:]"]="103", ["[:·.]р҃д[.·:]"]="104",
	["[:·.]р҃е[.·:]"]="105", ["[:·.]р҃є[.·:]"]="105", ["[:·.]р҃ѕ[.·:]"]="106", ["[:·.]р҃ꙅ[.·:]"]="106", ["[:·.]р҃з[.·:]"]="107", ["[:·.]р҃ꙁ[.·:]"]="107", ["[:·.]р҃и[.·:]"]="108", ["[:·.]р҃ѳ[.·:]"]="109",
	["[:·.]р҃і[.·:]"]="110", ["[:·.]ра҃і[.·:]"]="111", ["[:·.]рв҃і[.·:]"]="112", ["[:·.]рг҃і[.·:]"]="113", ["[:·.]рд҃і[.·:]"]="114",
	["[:·.]ре҃і[.·:]"]="115", ["[:·.]рє҃і[.·:]"]="115", ["[:·.]рѕ҃і[.·:]"]="116", ["[:·.]рꙅ҃і[.·:]"]="116", ["[:·.]рз҃і[.·:]"]="117", ["[:·.]рꙁ҃і[.·:]"]="117", ["[:·.]ри҃і[.·:]"]="118", ["[:·.]рѳ҃і[.·:]"]="119",
	["[:·.]р҃к[.·:]"]="120", ["[:·.]рк҃а[.·:]"]="121", ["[:·.]рк҃в[.·:]"]="122", ["[:·.]рк҃г[.·:]"]="123", ["[:·.]рк҃д[.·:]"]="124",
	["[:·.]рк҃е[.·:]"]="125", ["[:·.]рк҃є[.·:]"]="125", ["[:·.]рк҃ѕ[.·:]"]="126", ["[:·.]рк҃ꙅ[.·:]"]="126", ["[:·.]рк҃з[.·:]"]="127", ["[:·.]рк҃ꙁ[.·:]"]="127", ["[:·.]рк҃и[.·:]"]="128", ["[:·.]рк҃ѳ[.·:]"]="129",
	["[:·.]р҃л[.·:]"]="130", ["[:·.]рл҃а[.·:]"]="131", ["[:·.]рл҃в[.·:]"]="132", ["[:·.]рл҃г[.·:]"]="133", ["[:·.]рл҃д[.·:]"]="134",
	["[:·.]рл҃е[.·:]"]="135", ["[:·.]рл҃є[.·:]"]="135", ["[:·.]рл҃ѕ[.·:]"]="136", ["[:·.]рл҃ꙅ[.·:]"]="136", ["[:·.]рл҃з[.·:]"]="137", ["[:·.]рл҃ꙁ[.·:]"]="137", ["[:·.]рл҃и[.·:]"]="138", ["[:·.]рл҃ѳ[.·:]"]="139",
	["[:·.]р҃м[.·:]"]="140", ["[:·.]рм҃а[.·:]"]="141", ["[:·.]рм҃в[.·:]"]="142", ["[:·.]рм҃г[.·:]"]="143", ["[:·.]рм҃д[.·:]"]="144",
	["[:·.]рм҃е[.·:]"]="145", ["[:·.]рм҃є[.·:]"]="145", ["[:·.]рм҃ѕ[.·:]"]="146", ["[:·.]рм҃ꙅ[.·:]"]="146", ["[:·.]рм҃з[.·:]"]="147", ["[:·.]рм҃ꙁ[.·:]"]="147", ["[:·.]рм҃и[.·:]"]="148", ["[:·.]рм҃ѳ[.·:]"]="149",
	["[:·.]р҃н[.·:]"]="150", ["[:·.]рн҃а[.·:]"]="151", ["[:·.]рн҃в[.·:]"]="152", ["[:·.]рн҃г[.·:]"]="153", ["[:·.]рн҃д[.·:]"]="154",
	["[:·.]рн҃е[.·:]"]="155", ["[:·.]рн҃є[.·:]"]="155", ["[:·.]рн҃ѕ[.·:]"]="156", ["[:·.]рн҃ꙅ[.·:]"]="156", ["[:·.]рн҃з[.·:]"]="157", ["[:·.]рн҃ꙁ[.·:]"]="157", ["[:·.]рн҃и[.·:]"]="158", ["[:·.]рн҃ѳ[.·:]"]="159",
	["[:·.]р҃ѯ[.·:]"]="160", ["[:·.]рѯ҃а[.·:]"]="161", ["[:·.]рѯ҃в[.·:]"]="162", ["[:·.]рѯ҃г[.·:]"]="163", ["[:·.]рѯ҃д[.·:]"]="164",
	["[:·.]рѯ҃е[.·:]"]="165", ["[:·.]рѯ҃є[.·:]"]="165", ["[:·.]рѯ҃ѕ[.·:]"]="166", ["[:·.]рѯ҃ꙅ[.·:]"]="166", ["[:·.]рѯ҃з[.·:]"]="167", ["[:·.]рѯ҃ꙁ[.·:]"]="167", ["[:·.]рѯ҃и[.·:]"]="168", ["[:·.]рѯ҃ѳ[.·:]"]="169",
	["[:·.]р҃о[.·:]"]="170", ["[:·.]ро҃а[.·:]"]="171", ["[:·.]ро҃в[.·:]"]="172", ["[:·.]ро҃г[.·:]"]="173", ["[:·.]ро҃д[.·:]"]="174",
	["[:·.]ро҃е[.·:]"]="175", ["[:·.]ро҃є[.·:]"]="175", ["[:·.]ро҃ѕ[.·:]"]="176", ["[:·.]ро҃ꙅ[.·:]"]="176", ["[:·.]ро҃з[.·:]"]="177", ["[:·.]ро҃ꙁ[.·:]"]="177", ["[:·.]ро҃и[.·:]"]="178", ["[:·.]ро҃ѳ[.·:]"]="179",
	["[:·.]р҃ѻ[.·:]"]="170", ["[:·.]рѻ҃а[.·:]"]="171", ["[:·.]рѻ҃в[.·:]"]="172", ["[:·.]рѻ҃г[.·:]"]="173", ["[:·.]рѻ҃д[.·:]"]="174",
	["[:·.]рѻ҃е[.·:]"]="175", ["[:·.]рѻ҃є[.·:]"]="175", ["[:·.]рѻ҃ѕ[.·:]"]="176", ["[:·.]рѻ҃ꙅ[.·:]"]="176", ["[:·.]рѻ҃з[.·:]"]="177", ["[:·.]рѻ҃ꙁ[.·:]"]="177", ["[:·.]рѻ҃и[.·:]"]="178", ["[:·.]рѻ҃ѳ[.·:]"]="179",
	["[:·.]р҃п[.·:]"]="180", ["[:·.]рп҃а[.·:]"]="181", ["[:·.]рп҃в[.·:]"]="182", ["[:·.]рп҃г[.·:]"]="183", ["[:·.]рп҃д[.·:]"]="184",
	["[:·.]рп҃е[.·:]"]="185", ["[:·.]рп҃є[.·:]"]="185", ["[:·.]рп҃ѕ[.·:]"]="186", ["[:·.]рп҃ꙅ[.·:]"]="186", ["[:·.]рп҃з[.·:]"]="187", ["[:·.]рп҃ꙁ[.·:]"]="187", ["[:·.]рп҃и[.·:]"]="188", ["[:·.]рп҃ѳ[.·:]"]="189",
	["[:·.]р҃ч[.·:]"]="190", ["[:·.]рч҃а[.·:]"]="191", ["[:·.]рч҃в[.·:]"]="192", ["[:·.]рч҃г[.·:]"]="193", ["[:·.]рч҃д[.·:]"]="194",
	["[:·.]рч҃е[.·:]"]="195", ["[:·.]рч҃є[.·:]"]="195", ["[:·.]рч҃ѕ[.·:]"]="196", ["[:·.]рч҃ꙅ[.·:]"]="196", ["[:·.]рч҃з[.·:]"]="197", ["[:·.]рч҃ꙁ[.·:]"]="197", ["[:·.]рч҃и[.·:]"]="198", ["[:·.]рч҃ѳ[.·:]"]="199",
	["[:·.]р҃ҁ[.·:]"]="190", ["[:·.]рҁ҃а[.·:]"]="191", ["[:·.]рҁ҃в[.·:]"]="192", ["[:·.]рҁ҃г[.·:]"]="193", ["[:·.]рҁ҃д[.·:]"]="194",
	["[:·.]рҁ҃е[.·:]"]="195", ["[:·.]рҁ҃є[.·:]"]="195", ["[:·.]рҁ҃ѕ[.·:]"]="196", ["[:·.]рҁ҃ꙅ[.·:]"]="196", ["[:·.]рҁ҃з[.·:]"]="197", ["[:·.]рҁ҃ꙁ[.·:]"]="197", ["[:·.]рҁ҃и[.·:]"]="198", ["[:·.]рҁ҃ѳ[.·:]"]="199",
	["[:·.]с҃[.·:]"]="200",
	["[:·.]т҃[.·:]"]="300",
	["[:·.]у҃[.·:]"]="400", ["[:·.]ѵ҃[.·:]"]="400",
	["[:·.]ф҃[.·:]"]="500",
	["[:·.]х҃[.·:]"]="600",
	["[:·.]ѱ҃[.·:]"]="700",
	["[:·.]ѡ҃[.·:]"]="800", ["[:·.]ѿ҃[.·:]"]="800",
	["[:·.]ц҃[.·:]"]="900", ["[:·.]ѧ҃[.·:]"]="900",
	["[:·.]҂а[.·:]"]="1000",
	["[:·.]҂в[.·:]"]="2000",
	["[:·.]҂г[.·:]"]="3000",
	["[:·.]҂д[.·:]"]="4000",
	["[:·.]҂е[.·:]"]="5000", ["[:·.]҂є[.·:]"]="5000",
	["[:·.]҂ѕ[.·:]"]="6000", ["[:·.]҂ꙅ[.·:]"]="6000",
	["[:·.]҂з[.·:]"]="7000",
	["[:·.]҂и[.·:]"]="8000",
	["[:·.]҂ѳ[.·:]"]="9000",
	["[:·.]҂і[.·:]"]="10,000",
	["[:·.]҂к[.·:]"]="20,000",
	["[:·.]҂л[.·:]"]="30,000",
	["[:·.]҂м[.·:]"]="40,000",
	["[:·.]҂н[.·:]"]="50,000",
	["[:·.]҂ѯ[.·:]"]="60,000",
	["[:·.]҂о[.·:]"]="70,000", ["[:·.]҂ѻ[.·:]"]="70,000",
	["[:·.]҂п[.·:]"]="80,000",
	["[:·.]҂ч[.·:]"]="90,000", ["[:·.]҂ҁ[.·:]"]="90,000",
	["[:·.]҂р[.·:]"]="100,000",
	["[:·.]҂с[.·:]"]="200,000",
	["[:·.]҂т[.·:]"]="300,000",
	["[:·.]҂у[.·:]"]="400,000", ["[:·.]҂ѵ[.·:]"]="400,000",
	["[:·.]҂ф[.·:]"]="500,000",
	["[:·.]҂х[.·:]"]="600,000",
	["[:·.]҂ѱ[.·:]"]="700,000",
	["[:·.]҂ѡ[.·:]"]="800,000", ["[:·.]҂ѿ[.·:]"]="800,000",
	["[:·.]҂ц[.·:]"]="900,000", ["[:·.]҂ѧ[.·:]"]="900,000",
	["[:·.]҂҂а[.·:]"]="1,000,000",
}

function export.tr(text, lang, sc)
	if not sc then
		sc = require("Module:languages").getByCode(lang):findBestScript(text):getCode()
	end
	
	-- Щ was pronounced differently in Old Church Slavonic
	if lang == "cu" then
		letters["Cyrs"]["Щ"]='Št'
		letters["Cyrs"]["щ"]='št'
	else
		letters["Cyrs"]["Щ"]='Šč'
		letters["Cyrs"]["щ"]='šč'
	end
	
	-- Ѿ was pronounced differently in Old Novgorodian
	if lang == "zle-ono" then
		letters["Cyrs"]["Ѿ"]='Ote'
		letters["Cyrs"]["ѿ"]='ote'
	else
		letters["Cyrs"]["Ѿ"]='Otŭ'
		letters["Cyrs"]["ѿ"]='otŭ'
	end
	
	-- Transliterate the kamora as prime
	text = string.gsub(text, "\210\132", "ʹ")
	-- Transliterate the titlo as colon
	text = string.gsub(text, mw.ustring.char(0x0483), ":")
	
	if sc == "Cyrs" then
		for key, repl in pairs(digraphs[sc]) do
			text = mw.ustring.gsub(text, key, repl)
		end
		
		-- pattern for one non-ASCII character
		text = string.gsub(text, '[\194-\244][\128-\191]+', letters[sc])
	end

	return text
end

return export