This module will transliterate Khinalug 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:kjj-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 = require("Module:string/char")
local export = {}
local tt = {
="b", ="p", ="w", ="f",
="d", ="t", ="c", ="z", ="s", ="č", ="ž", ="š",
="g", ="k", ="χ", ="ʔ", ="m", ="n", ="r", ="l",
="j", ="i", ="e", ="e", ="a", ="o", ="u", ="ɨ",
="B", ="P", ="W", ="F",
="D", ="T", ="C", ="Z", ="S", ="Č", ="Ž", ="Š",
="G", ="K", ="Χ", ="ʔ", ="M", ="N", ="R", ="L",
="J", ="I", ="E", ="E", ="A", ="O", ="U", ="Ɨ"};
local tetraTrigraphs = {
= 'qː',
= 'kx',
= 'Qː',
= 'Kx',
}
local digraphs = {
= 'pː',
= 'ṗ',
= 'wː',
= 'tː',
= 'ṭ',
= 'cː',
= 'c̣',
= 'ǯ',
= 'čː',
= 'č̣',
= 'kː',
= 'ḳ',
= 'ɣ',
= 'x',
= 'qː',
= 'q',
= 'q̇',
= 'ʁ',
= 'ʕ',
= 'ħ',
= 'h',
= 'ü',
= 'ö',
= 'ä',
= 'Pː',
= 'Ṗ',
= 'Wː',
= 'Tː',
= 'Ṭ',
= 'Cː',
= 'C̣',
= 'Ǯ',
= 'Čː',
= 'Č̣',
= 'Kː',
= 'Ḳ',
= 'Ɣ',
= 'X',
= 'Qː',
= 'Q',
= 'Q̇',
= 'ʁ',
= 'ʕ',
= 'Ħ',
= 'H',
= 'Ü',
= 'Ö',
= 'Ä',
}
function export.tr(text, lang, sc)
local str_gsub = string.gsub
local UTF8char = '*'
-- Convert uppercase palochka to lowercase. Lowercase is found in tables
-- above.
text = str_gsub(text, u(0x4C0), u(0x4CF))
for grapheme, replacement in pairs(tetraTrigraphs) do
text = str_gsub(text, grapheme, replacement)
end
for digraph, replacement in pairs(digraphs) do
text = str_gsub(text, digraph, replacement)
end
text = str_gsub(text, UTF8char, tt)
return text
end
return export