Module:xmr-translit
Jump to navigation
Jump to search
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Meroitic language text.
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:xmr-translit/testcases.
Functions
[edit]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 chars = {
["𐦠"] = "a", ["𐦀"] = "a",
["𐦡"] = "e", ["𐦁"] = "e",
["𐦣"] = "o", ["𐦃"] = "o",
["𐦢"] = "i", ["𐦂"] = "i",
["𐦤"] = "y", ["𐦄"] = "y",
["𐦥"] = "w", ["𐦅"] = "w",
["𐦦"] = "b", ["𐦆"] = "b",
["𐦧"] = "p", ["𐦈"] = "p",
["𐦨"] = "m", ["𐦉"] = "m",
["𐦩"] = "n", ["𐦊"] = "n",
["𐦪"] = "ne", ["𐦌"] = "ne",
["𐦫"] = "r", ["𐦎"] = "r", ["𐦏"] = "r",
["𐦬"] = "l", ["𐦐"] = "l",
["𐦭"] = "ḫ", ["𐦑"] = "ḫ",
["𐦮"] = "ẖ", ["𐦒"] = "ẖ",
["𐦱"] = "se", ["𐦕"] = "se",
["𐦯"] = "s", ["𐦓"] = "s",
["𐦲"] = "k", ["𐦖"] = "k",
["𐦳"] = "q", ["𐦗"] = "q",
["𐦴"] = "t", ["𐦘"] = "t",
["𐦵"] = "te", ["𐦚"] = "te",
["𐦶"] = "to", ["𐦜"] = "to",
["𐦷"] = "d", ["𐦝"] = "d",
}
function export.tr(text, lang, sc)
return (mw.ustring.gsub(text, '.', chars))
end
return export