Modul:lzz-translit
- Berikut merupakan pendokumenan yang dijana oleh Modul:pendokumenan/functions/translit. [sunting]
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
Modul ini akan mentransliterasi Bahasa Laz teks.
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:lzz-translit/testcases.
Functions
suntingtr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. - When the transliteration fails, returns
nil
.
local m_str_utils = require("Module:string utilities")
local codepoint = m_str_utils.codepoint
local gsub = m_str_utils.gsub
local u = m_str_utils.char
local upper = m_str_utils.upper
local export = {}
local tt = {
["ა"]="a", ["ბ"]="b", ["გ"]="g", ["დ"]="d", ["ე"]="e", ["ვ"]="v", ["ზ"]="z",
["თ"]="t", ["ი"]="i", ["კ"]="ǩ", ["ლ"]="l", ["მ"]="m", ["ნ"]="n", ["ჲ"]="y", ["ო"]="o",
["პ"]="p̌", ["ჟ"]="j", ["რ"]="r", ["ს"]="s", ["ტ"]="ť", ["უ"]="u", ["ფ"]="p",
["ქ"]="k", ["ღ"]="ğ", ["ყ"]="q", ["შ"]="ş", ["ჩ"]="ç", ["ც"]="ʒ",
["ძ"]="ż", ["წ"]="ǯ", ["ჭ"]="ç̌", ["ხ"]="x", ["ჯ"]="c", ["ჰ"]="h", ["ჶ"]="f",
};
function export.tr(text, lang, sc)
-- Transliterate uppercase characters from the Georgian Extended block as
-- the uppercase version of the transliteration of the lowercase characters
-- from the Georgian block.
-- U+10D0: start of Georgian block
-- U+1C90: start of Georgian Extended block
text = gsub(
text,
'[' .. u(0x1C90) .. '-' .. u(0x1CBF) .. ']',
function (char)
local translit = tt[u(codepoint(char) - 0x1C90 + 0x10D0 )]
return translit and upper(translit)
end)
text = gsub(text, '.', tt)
return text
end
return export