Module:Tfng-translit
- පහත දැක්වෙන උපදෙස්, Module:documentation/functions/translit මගින් ජනනය කොට ඇත. [සංස්කරණය කරන්න]
- ප්රයෝජනවත් සබැඳි: උප පිටු ලැයිස්තුව • සබැඳි • transclusions • testcases • sandbox
This module will transliterate text in the Tifinagh අක්ෂරක්රමය. It is used to transliterate Ghomara, Tarifit, Tashelhit, Tachawit, Central Atlas Tamazight, සහ Moroccan Amazigh.
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:Tfng-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 = {}
local tt = {}
tt["Tfng"] = {
["common"] = {
["ⴰ"] = "a",
["ⴱ"] = "b",
["ⴲ"] = "ḇ",
["ⴳ"] = "g",
["ⴴ"] = "g",
["ⴵ"] = "ǧ",
["ⴶ"] = "ǧ",
["ⴷ"] = "d",
["ⴸ"] = "ḏ",
["ⴹ"] = "ḍ",
["ⴺ"] = "ḏ̣",
["ⴻ"] = "e",
["ⴼ"] = "f",
["ⴽ"] = "k",
["ⴾ"] = "k",
["ⴿ"] = "k",
["ⵀ"] = "h", -- tmh, thv, taq, ttq, thz: "b"
["ⵁ"] = "h",
["ⵂ"] = "h",
["ⵃ"] = "ḥ",
["ⵄ"] = "ɛ",
["ⵅ"] = "x",
["ⵆ"] = "x",
["ⵇ"] = "q",
["ⵈ"] = "q",
["ⵉ"] = "i",
["ⵊ"] = "j",
["ⵋ"] = "j",
["ⵌ"] = "j",
["ⵍ"] = "l",
["ⵎ"] = "m",
["ⵏ"] = "n",
["ⵐ"] = "ny",
["ⵑ"] = "ng",
["ⵒ"] = "p",
["ⵓ"] = "u", -- tmh, thv, taq, ttq, thz: "w"
["ⵔ"] = "r",
["ⵕ"] = "ṛ",
["ⵖ"] = "ɣ",
["ⵗ"] = "ɣ",
["ⵘ"] = "j", -- thz: "ɣ"
["ⵙ"] = "s",
["ⵚ"] = "ṣ",
["ⵜ"] = "t",
["ⵝ"] = "ṯ",
["ⵛ"] = "c",
["ⵞ"] = "č",
["ⵟ"] = "ṭ",
["ⵠ"] = "v",
["ⵡ"] = "w",
["ⵢ"] = "y",
["ⵣ"] = "z",
["ⵤ"] = "z",
["ⵥ"] = "ẓ",
["ⵦ"] = "e",
["ⵧ"] = "o",
["ⵯ"] = "ʷ",
["⵰"] = ".",
["⵿"] = ""
},
["tmh"] = {["ⵀ"] = "b", ["ⵓ"] = "w"},
["thv"] = {["ⵀ"] = "b", ["ⵓ"] = "w"},
["taq"] = {["ⵀ"] = "b", ["ⵓ"] = "w"},
["ttq"] = {["ⵀ"] = "b", ["ⵓ"] = "w"},
["thz"] = {["ⵀ"] = "b", ["ⵓ"] = "w", ["ⵘ"] = "ɣ"}
}
function export.tr(text, lang, sc)
if not sc then
sc = require("Module:languages").getByCode(lang or "ber"):findBestScript(text):getCode()
end
if sc ~= "Tfng" then
text = nil
else
if tt[sc][lang] then
text = mw.ustring.gsub(text, '.', tt[sc][lang])
end
text = mw.ustring.gsub(text, '.', tt[sc]["common"])
end
return text
end
return export