Module:Phnx-translit
Appearance
- පහත දැක්වෙන උපදෙස්, Module:Phnx-translit/documentation හි පිහිටා ඇත. Module:Phnx-translit/documentation]]. [සංස්කරණය] Categories were auto-generated by Module:module categorization. [edit]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
This module will transliterate text in the Phoenician අක්ෂරක්රමය. It is used to transliterate Moabite, Phoenician, Ammonite, Edomite, and Punic.
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:Phnx-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 = {}
-- Beware! Phnx is rtl
local tt = {
['𐤀'] = 'ʾ', ['𐤁'] = 'b', ['𐤂'] = 'g', ['𐤃'] = 'd', ['𐤄'] = 'h',
['𐤅'] = 'w', ['𐤆'] = 'z', ['𐤇'] = 'ḥ', ['𐤈'] = 'ṭ', ['𐤉'] = 'y',
['𐤊'] = 'k', ['𐤋'] = 'l', ['𐤌'] = 'm', ['𐤍'] = 'n', ['𐤎'] = 's',
['𐤏'] = 'ʿ', ['𐤐'] = 'p', ['𐤑'] = 'ṣ', ['𐤒'] = 'q', ['𐤓'] = 'r',
['𐤔'] = 'š', ['𐤕'] = 't',
['𐤖'] = '[1]', ['𐤗'] = '[10]', ['𐤘'] = '[20]', ['𐤙'] = '[100]',
['𐤚'] = '[2]', ['𐤛'] = '[3]', ['𐤟'] = ' ',
}
function export.tr(text, lang, sc)
if type(text) == 'table' then -- called directly from a template
text = text.args[1]
end
return (text:gsub('[%z\1-\127\194-\244][\128-\191]*', tt)) -- UTF-8 character pattern
end
return export