Module:xchc-translit: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 60: | Line 60: | ||
local tt_lepik= { | local tt_lepik= { | ||
[B .. M] = DA, [M] = A, [B] = D, | [B .. M] = DA, [M] = A, [B] = D, [A .. D] = D .. A, | ||
[" | ["[ЬІ]"]="Y", ["[ьі]"]="y", | ||
["Э"]='E', ["э"]='e', | ["Э"]='E', ["э"]='e', | ||
["О"]='O', ["о"]='o', | ["О"]='O', ["о"]='o', | ||
["Е" .. D]='Yo', ["е" .. D]='yo', | |||
["А"]='A', ["а"]='a', | ["А"]='A', ["а"]='a', | ||
["Б"]='B', ["б"]='b', | ["Б"]='B', ["б"]='b', | ||
Line 73: | Line 72: | ||
["Дз"]='Dc', ["дз"]='dc', ["Дж"]='Dz', ["дж"]='dz', | ["Дз"]='Dc', ["дз"]='dc', ["Дж"]='Dz', ["дж"]='dz', | ||
["Д"]='D', ["д"]='d', | ["Д"]='D', ["д"]='d', | ||
["Е"]=' | ["Е"]='Ye', ["е"]='ye', | ||
["Ж"]='Ž', ["ж"]='ž', | ["Ж"]='Ž', ["ж"]='ž', | ||
["З"]='Z', ["з"]='z', | ["З"]='Z', ["з"]='z', | ||
["И" .. D]='J', ["и" .. D]='j', ["И"]=' | ["И" .. D]='J', ["и" .. D]='j', ["И"]='Yi', ["и"]='yi', | ||
["К"]='K', ["к"]='k', | ["К"]='K', ["к"]='k', | ||
["Л"]='L', ["л"]='l', | ["Л"]='L', ["л"]='l', | ||
Line 82: | Line 81: | ||
["Н"]='N', ["н"]='n', | ["Н"]='N', ["н"]='n', | ||
["Ӈ"]='Ng', ["ӈ"]='ng', | ["Ӈ"]='Ng', ["ӈ"]='ng', | ||
["О" .. D]='A' .. D, ["о" .. D]='a' .. D, | |||
["О"]='O', ["о"]='o', | ["О"]='O', ["о"]='o', | ||
["Ө"]='O' .. D, ["ө"]='o' .. D, | |||
["П"]='P', ["п"]='p', | ["П"]='P', ["п"]='p', | ||
["Р"]='R', ["р"]='r', | ["Р"]='R', ["р"]='r', | ||
Line 89: | Line 89: | ||
["Т"]='T', ["т"]='t', | ["Т"]='T', ["т"]='t', | ||
["У"]='U', ["у"]='u', | ["У"]='U', ["у"]='u', | ||
["Ү"]='U' .. D, ["ү"]='u' .. D, | |||
["Ф"]='F', ["ф"]='f', | ["Ф"]='F', ["ф"]='f', | ||
["ХӀ"]='H', ["хӀ"]='h', ["Х"]='Ch', ["х"]='ch', | ["ХӀ"]='H', ["хӀ"]='h', ["Х"]='Ch', ["х"]='ch', | ||
Line 96: | Line 96: | ||
["Ш"]='Š', ["ш"]='š', | ["Ш"]='Š', ["ш"]='š', | ||
["Ы"]='I', ["ы"]='i', | ["Ы"]='I', ["ы"]='i', | ||
["Ю"]=' | ["Ю"]='Yu', ["ю"]='yu', | ||
["Я"]=' | ["Я"]='Ya', ["я"]='ya', | ||
["[Ъъ]"]="'", | ["[Ъъ]"]="'", | ||
[D .. A] = DA, | |||
}; | }; | ||
Revision as of 17:29, 2 October 2023
- The following documentation is located at Module:xchc-translit/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local u = mw.ustring.char
local M = u(0x0304) -- COMBINING MACRON
local B = u(0x0306) -- COMBINING BREVE
local D = u(0x0308) -- COMBINING DIAERESIS
local A = u(0x0301) -- COMBINING ACUTE
local DA = u(0x030B) -- COMBINING DOUBLE ACUTE
local export = {}
local tt = { -- Unofficial transliteration loosely based on ISO 9
["І"]='J', ["і"]='j',
["Э"]='E', ["э"]='e',
["О"]='O', ["о"]='o',
["Е" .. M .. D]='Jō', ["е" .. M .. D]='jō', ["Ё"]='Jo', ["ё"]='jo',
["А" .. M]='Ā', ["а" .. M]='ā', ["А"]='A', ["а"]='a',
["Б"]='B', ["б"]='b',
["В"]='V', ["в"]='v',
["Г"]='G', ["г"]='g',
["Ғ"]='Ǧ', ["ғ"]='ǧ',
["Д"]='D', ["д"]='d',
["Е" .. M]='Jē', ["е" .. M]='jē', ["Е"]='Je', ["е"]='je',
["Ж"]='Ž', ["ж"]='ž',
["З"]='Z', ["з"]='z',
["Ӣ"]='Jī', ["ӣ"]='jī', ["И"]='Ji', ["и"]='ji',
["К"]='K', ["к"]='k',
["Л"]='L', ["л"]='l',
["М"]='M', ["м"]='m',
["Н"]='N', ["н"]='n',
["Ӈ"]='Ŋ', ["ӈ"]='ŋ',
["О" .. M]='Ō', ["о" .. M]='ō', ["О"]='O', ["о"]='o',
["Ө" .. M]='Ȫ', ["ө" .. M]='ȫ', ["Ө"]='Ö', ["ө"]='ö',
["П"]='P', ["п"]='p',
["Р"]='R', ["р"]='r',
["С"]='S', ["с"]='s',
["Т"]='T', ["т"]='t',
["Ӯ"]='Ū', ["ӯ"]='ū', ["У"]='U', ["у"]='u',
["Ү" .. M]='Ȳ', ["ү" .. M]='ȳ', ["Ү"]='Y', ["ү"]='y',
["Ф"]='F', ["ф"]='f',
["ХӀ"]='H', ["хӀ"]='h', ["Х"]='X', ["х"]='x',
["Ц"]='Ts', ["ц"]='ts',
["Ч"]='Č', ["ч"]='č',
["Ш"]='Š', ["ш"]='š',
["Ы" .. M]='Ī', ["ы" .. M]='ī', ["Ы"]='I', ["ы"]='i',
["Ю" .. M]='Jū', ["ю" .. M]='jū', ["Ю"]='Ju', ["ю"]='ju',
["Я" .. M]='Jā', ["я" .. M]='jā', ["Я"]='Ja', ["я"]='ja',
["Lь"] = "Lj", ["lь"] = "lj",
["Nь"]='Nj', ["n[ьj]"]='nj',
["[ьЬ]"]="'", ["[Ъъ]"]='"',
["Й"]='J', ["й"]='j',
};
function export.tr_tiktiki(text, lang, sc)
for pat, repl in pairs(tt) do
text = mw.ustring.gsub(text, pat, repl)
end
return text
end
local tt_lepik= {
[B .. M] = DA, [M] = A, [B] = D, [A .. D] = D .. A,
["[ЬІ]"]="Y", ["[ьі]"]="y",
["Э"]='E', ["э"]='e',
["О"]='O', ["о"]='o',
["Е" .. D]='Yo', ["е" .. D]='yo',
["А"]='A', ["а"]='a',
["Б"]='B', ["б"]='b',
["В"]='V', ["в"]='v',
["Г"]='G', ["г"]='g',
["Ғ"]='Gh', ["ғ"]='gh',
["Дз"]='Dc', ["дз"]='dc', ["Дж"]='Dz', ["дж"]='dz',
["Д"]='D', ["д"]='d',
["Е"]='Ye', ["е"]='ye',
["Ж"]='Ž', ["ж"]='ž',
["З"]='Z', ["з"]='z',
["И" .. D]='J', ["и" .. D]='j', ["И"]='Yi', ["и"]='yi',
["К"]='K', ["к"]='k',
["Л"]='L', ["л"]='l',
["М"]='M', ["м"]='m',
["Н"]='N', ["н"]='n',
["Ӈ"]='Ng', ["ӈ"]='ng',
["О" .. D]='A' .. D, ["о" .. D]='a' .. D,
["О"]='O', ["о"]='o',
["Ө"]='O' .. D, ["ө"]='o' .. D,
["П"]='P', ["п"]='p',
["Р"]='R', ["р"]='r',
["С"]='S', ["с"]='s',
["Т"]='T', ["т"]='t',
["У"]='U', ["у"]='u',
["Ү"]='U' .. D, ["ү"]='u' .. D,
["Ф"]='F', ["ф"]='f',
["ХӀ"]='H', ["хӀ"]='h', ["Х"]='Ch', ["х"]='ch',
["Ц"]='C', ["ц"]='c',
["Ч"]='Cs', ["ч"]='cs',
["Ш"]='Š', ["ш"]='š',
["Ы"]='I', ["ы"]='i',
["Ю"]='Yu', ["ю"]='yu',
["Я"]='Ya', ["я"]='ya',
["[Ъъ]"]="'",
[D .. A] = DA,
};
function export.tr(text, lang, sc)
text = mw.ustring.toNFD(text)
for pat, repl in pairs(tt_lepik) do
text = mw.ustring.gsub(text, pat, repl)
end
return mw.ustring.toNFC(text)
end
return export