This module will transliterate text in the Armenian script per WT:ARMN TR. It is used to transliterate Middle Armenian, Armenian, Northern Kurdish, Kipchak, Lomavren, Udi, and Old Armenian.
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:Armn-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 export = {}
local gsub = require("Module:string utilities").gsub
local mapping = {
="a", ="b", ="g", ="d", ="e", ="z",="ē", ="ə",
="tʻ", ="ž", ="i", ="l", ="x", ="c", ="k", ="h",
="j", ="ġ", ="č", ="m", ="y", ="n", ="š", ="o",
="čʻ", ="p", ="ǰ", ="ṙ", ="s", ="v", ="t", ="r",
="cʻ", ="w", ="pʻ", ="kʻ", ="ew", ="ō", ="f",
="A", ="B", ="G", ="D", ="E", ="Z", ="Ē", ="Ə",
="Tʻ", ="Ž", ="I", ="L", ="X", ="C", ="K", ="H",
="J", ="Ġ", ="Č", ="M", ="Y", ="N", ="Š", ="O",
="Čʻ", ="P", ="J̌", ="Ṙ", ="S", ="V", ="T", ="R",
="Cʻ", ="W", ="Pʻ", ="Kʻ", ="Ō", ="F", ="mn", ="me",
="mi", ="vn", ="mx", ="ä", ="hª",
-- punctuation
=",", =".", =";", ="́", ="<sup>!</sup>", ="<sup>?</sup>",
=".", ="-", ="’", ='“', ='”', ='ʻ'
}
local replacements = {
-- desirable, but doesn't work: = 'ʸ',
= 'hª', --keep synchronized with ֈ
= 'q',
'] = 'U',
= 'u',
'] = 'Ú',
= 'ú',
'] = 'U<sup>!</sup>',
= 'u<sup>!</sup>',
'] = 'U<sup>?</sup>',
= 'u<sup>?</sup>',
= 'ü',
'] = 'Ü',
= 'ö',
= 'Ö',
}
function export.tr(text, lang, sc)
if sc and sc ~= "Armn" then
return nil
end
if lang == "xcl" then
mapping="ł"
mapping="Ł"
end
for regex, replacement in pairs(replacements) do
text = gsub(text, regex, replacement)
end
text = gsub(text, '.', mapping)
return text
end
return export