This module will transliterate text in the Old Italic script. It is used to transliterate Etruscan, North Picene, Oscan, South Picene, Camunic, Faliscan, Lemnian, Lepontic, Raetic, Umbrian, and Venetic.
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:Ital-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 = {}
-- Standard transcription
local common_rules = {
= 'a',
= 'b',
= 'c',
= 'd',
= 'e',
= 'v',
= 'z',
= 'h',
= 'θ',
= 'i',
= 'k',
= 'l',
= 'm',
= 'n',
= 'š',
= 'o',
= 'p',
= 'ś',
= 'q',
= 'r',
= 's',
= 't',
= 'u',
= 'x',
= 'φ',
= 'χ',
= 'f',
= 'ř',
= 'ç',
= 'í',
= 'ú',
= 'ś',
-- Numerals
= 'Ⅰ',
= 'Ⅴ',
= 'Ⅹ',
= 'Ⅼ',
-- Punctuation
= ' ',
= ' ',
= ' ',
}
local lang_rules = {
-- Etruscan
= {
= 'Ⅽ',
},
-- Old Latin
= {
= 'f',
},
-- Noric
= {
= 'g',
= 'd',
= 'g',
},
-- North Picene
= {
= 'g',
},
-- Oscan
= {
= 'g',
},
-- South Picene
= {
= 'g',
= 'í',
},
-- Camunic
= {
= 'ś',
= 'g',
= 'b',
= 's',
= 'þþ',
= 'þ',
},
-- Faliscan
= {
= 'f', -- looks more like an up-arrow, but this is how it should be encoded
},
-- Raetic
= {
= 'þ',
= '?',
},
-- Umbrian
= {
= 's',
},
-- Venetic
= {
= 'j',
= 'd',
= 'b',
= 'g',
},
}
function export.tr(text, lang, sc)
-- If the script is not Ital, do not transliterate
if sc ~= "Ital" then
return
end
-- Transliterate language-specific exceptions
if lang == "xve" then
text = mw.ustring.gsub(text, '𐌇𐌅', 'f')
end
if lang_rules then
text = mw.ustring.gsub(text, '.', lang_rules)
end
-- Transliterate remaining characters
text = mw.ustring.gsub(text, '.', common_rules)
return text
end
return export