This module will transliterate Lak language text per WT:LBE 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:lbe-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", ="f", ="w", ="m",
="d", ="t", ="y", ="n", ="z", ="c",
="s", ="ž", ="š", ="š:",
="l", ="č", ="r", ="g", ="k", ="x",
="ʼ", ="a", ="e", ="i", ="o", ="u",
="e", ="uˤ", ="aˤ",
="B", ="P", ="F", ="W", ="M",
="D", ="T", ="Y", ="N", ="Z", ="C",
="S", ="Ž", ="Š", ="Š:",
="L", ="Č", ="R", ="G", ="K", ="X",
="ʼ", ="A", ="E", ="I", ="O", ="U",
="E", ="Uˤ", ="Aˤ"};
local tetragraphs = {
= 'x̂:',
= 'X̂:',
}
local digraphs = {
= 'p:',
= 'pʼ',
= 't:',
= 'ä',
= 'oˤ',
= 'P:',
= 'Pʼ',
= 'T:',
= 'Ä',
= 'Oˤ',
= 'cʼ',
= 'c:',
= 'tʼ',
= 's:',
= 'č:',
= 'čʼ',
= 'qʼ',
= 'k:',
= 'kʼ',
= 'x̂',
= 'q',
= 'q:',
= 'ğ',
= 'x:',
= 'ħ',
= 'h',
= 'Cʼ',
= 'C:',
= 'Tʼ',
= 'S:',
= 'Č:',
= 'Čʼ',
= 'Qʼ',
= 'K:',
= 'Kʼ',
= 'X̂',
= 'Q',
= 'Q:',
= 'Ğ',
= 'X:',
= 'Ħ',
= 'H',
}
function export.tr(text, lang, sc)
local str_gsub = string.gsub
local UTF8_char = '*'
-- Convert capital to lowercase palochka. Lowercase is found in tables
-- above.
text = str_gsub(text, u(0x4C0), u(0x4CF))
for tetragraph, replacement in pairs(tetragraphs) do
text = str_gsub(text, tetragraph, replacement)
end
for digraph, replacement in pairs(digraphs) do
text = str_gsub(text, digraph, replacement)
end
text = str_gsub(text, UTF8_char, tt)
return text
end
return export