Module:Ital-translit
Jump to navigation
Jump to search
- The following documentation is located at Module:Ital-translit/documentation. [edit]
- Useful links: subpage list โข links โข transclusions โข testcases โข sandbox
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.
Functions
tr(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 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',
['๐'] = 'ล',
['๐'] = 'รง',
['๐'] = 'รญ',
['๐'] = 'รบ',
['๐'] = 'k',
-- Numerals
['๐ '] = 'โ
',
['๐ก'] = 'โ
ค',
['๐ข'] = 'โ
ฉ',
['๐ฃ'] = 'โ
ฌ',
-- Punctuation
['ยท'] = ' ',
['โ'] = ' ',
['โ'] = ' ',
}
local lang_rules = {
-- Etruscan
['ett'] = {
['๐'] = 'โ
ญ',
},
-- Old Latin
['itc-ola'] = {
['๐
'] = 'f',
},
-- Noric
['nrc'] = {
['๐'] = 'g',
['๐'] = 'd',
['๐'] = 'g',
},
-- North Picene
['nrp'] = {
['๐'] = 'g',
},
-- Oscan
['osc'] = {
['๐'] = 'g',
},
-- South Picene
['spx'] = {
['๐'] = 'g',
['๐'] = 'รญ',
},
-- Camunic
['xcc'] = {
['๐'] = 'ล',
['๐'] = 'g',
['๐'] = 'b',
['๐'] = 's',
['๐'] = 'รพรพ',
['๐ฃ'] = 'รพ',
},
-- Faliscan
['xfa'] = {
['๐
'] = 'f', -- looks more like an up-arrow, but this is how it should be encoded
},
-- Raetic
['xrr'] = {
['๐'] = 'รพ',
['๐'] = '?',
},
-- Umbrian
['xum'] = {
['๐'] = 's',
},
-- Venetic
['xve'] = {
['๐'] = '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[lang] then
text = mw.ustring.gsub(text, '.', lang_rules[lang])
end
-- Transliterate remaining characters
text = mw.ustring.gsub(text, '.', common_rules)
return text
end
return export