This module will transliterate text in the Latin script.
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:Latn-Tfng-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 tt = {}
tt = {
= {
= "ⴰ",
= "ⴰⴰ",
= "ⴱ",
= "ⴲ",
= "ⴵ",
= "ⴳ",
= "ⴷ",
= "ⴸ",
= "ⴹ",
= "ⴺ",
= "ⴻ",
= "ⴼ",
= "ⴽ",
= "ⵀ",
= "ⵃ",
= "ⵄ",
= "ⵅ",
= "ⵇ",
= "ⵉ",
= "ⵊ",
= "ⵍ",
= "ⵎ",
= "ⵏ",
= "ⵒ",
= "ⵓ",
= "ⵔ",
= "ⵔ",
= "ⵕ",
= "ⵖ",
= "ⵙ",
= "ⵚ",
= "ⵜ",
= "ⵝ",
= "ⵛ",
= "ⵛ",
= "ⵞ",
= "ⵟ",
= "ⵠ",
= "ⵡ",
= "ⵢ",
= "ⵣ",
= "ⵥ",
= "ⵧ",
= "ⵯ",
= "⵰",
},
= { = "ⵀ", = "ⵓ"},
= { = "ⵀ", = "ⵓ"},
= { = "ⵀ", = "ⵓ"},
= { = "ⵀ", = "ⵓ"},
= { = "ⵀ", = "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 == "Latn" then
text = mw.ustring.lower(text)
if tt then
text = mw.ustring.gsub(text, '.', tt)
end
text = mw.ustring.gsub(text, '.', tt)
else
text = nil
end
return text
end
return export