Module:Geor-translit: Difference between revisions
Jump to navigation
Jump to search
m Protected "Module:Geor-translit": (bot) automatically protect highly visible templates/modules (reference score: 2000+ >= 1000) ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)) |
m 1 revision imported |
| (One intermediate revision by the same user not shown) | |
(No difference)
| |
Latest revision as of 12:44, 21 April 2026
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Georgian script. It is used to transliterate Udi.
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:Geor-translit/testcases.
Functions
tr(text, lang, sc)- Transliterates a given piece of
textwritten 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 = {}
-- Keep synchronized with [[Module:sva-translit]] and [[Module:Geok-translit]]
local tt = {
["ა"]="a", ["ბ"]="b", ["გ"]="g", ["დ"]="d", ["ე"]="e", ["ვ"]="v", ["ზ"]="z", ["ჱ"]="ē",
["თ"]="t", ["ი"]="i", ["კ"]="ḳ", ["ლ"]="l", ["მ"]="m", ["ნ"]="n", ["ჲ"]="y", ["ო"]="o",
["პ"]="ṗ", ["ჟ"]="ž", ["რ"]="r", ["ს"]="s", ["ტ"]="ṭ", ["ჳ"]="wi", ["უ"]="u", ["ფ"]="p",
["ქ"]="k", ["ღ"]="ɣ", ["ყ"]="q̇", ["შ"]="š", ["ჩ"]="č", ["ც"]="c",
["ძ"]="ʒ", ["წ"]="c̣", ["ჭ"]="č̣", ["ხ"]="x", ["ჴ"]="q", ["ჯ"]="ǯ", ["ჰ"]="h", ["ჵ"]="'", ["ჶ"]="f", ["ჷ"]="ə", ["ჸ"]="ʾ", ["ჺ"]="ʿ", ["ʻ"]="ˢ",
};
function export.tr(text, lang, sc)
-- Transliterating vowel nasalization in Bats
text = gsub(text, 'ჼ', '̃')
text = gsub(text, '<sup>ნ</sup>', '̃')
-- 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