This module will transliterate Lezgi language text per WT:LEZ TR.
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:lez-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 gsub = string.gsub
local u = require("Module:string utilities").char
local export = {}
local tt = {
="b", ="p", ="f", ="v", ="m",
="d", ="t", ="j", ="n", ="z", ="c",
="s", ="ž", ="š", ="šč",
="l", ="č", ="r", ="g", ="k", ="χ",
="ʾ", ="a", ="e", ="y", ="i", ="o", ="u",
="ë", ="’", ="è", ="ju", ="ä",
="B", ="P", ="F", ="V", ="M",
="D", ="T", ="J", ="N", ="Z", ="C",
="S", ="Ž", ="Š", ="Šč",
="L", ="Č", ="R", ="G", ="K", ="Χ",
="ʾ", ="A", ="E", ="Y", ="I", ="O", ="U",
="Ë", ="’", ="È", ="Ju", ="Ä"};
local trigraphs = {
= 'q°',
= 'Q°',
= 'q̄°',
= 'Q̄°',
= 'q̇°',
= 'Q̇°',
= 'ġ°',
= 'Ġ°',
= 't̄°',
= 't̄°',
= 'c̄°',
= 'C̄°',
= 'k̄°',
= 'K̄°',
= 'ṭ°',
= 'Ṭ°',
= 'c̣°',
= 'C̣°',
= 'ḳ°',
= 'Ḳ°',
}
local digraphs = {
= 't°',
= 'T°',
= 'z°',
= 'Z°',
= 'χ°',
= 'Χ°',
= 'c°',
= 'C°',
= 's°',
= 'S°',
= 'p̄',
= 'ṗ',
= 't̄',
= 'P̄',
= 'Ṗ',
= 'T̄',
= 'c̣',
= 'c̄',
= 'ṭ',
= 'č̄',
= 'č̣',
= 'q̇',
= 'k̄',
= 'ḳ',
= 'q',
= 'q̄',
= 'ġ',
= 'h',
= 'C̣',
= 'C̄',
= 'Ṭ',
= 'Č̄',
= 'Č̣',
= 'Q̇',
= 'K̄',
= 'Ḳ',
= 'Q',
= 'Q̄',
= 'Ġ',
= 'H',
= 'ü',
= 'Ü',
= 'x',
= 'X',
= 'g°',
= 'G°',
= 'k°',
= 'K°',
}
function export.tr(text, lang, sc)
-- Convert capital to lowercase palochka. Lowercase is found in tables
-- above.
text = gsub(text, u(0x4C0), u(0x4CF))
for digraph, replacement in pairs(digraphs) do
text = gsub(text, digraph, replacement)
end
for trigraph, replacement in pairs(trigraphs) do
text = gsub(text, trigraph, replacement)
end
text = gsub(text, ".*", tt)
return text
end
return export