Module:Copt-translit
Jump to navigation
Jump to search
- The following documentation is located at Module:Copt-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Coptic script. It is used to transliterate Coptic, Nobiin, and Old Nubian.
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:Copt-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 chars = {
["Ⲁ"] = "A", ["ⲁ"] = "a",
["Ⲃ"] = "B", ["ⲃ"] = "b",
["Ⲅ"] = "G", ["ⲅ"] = "g",
["Ⲇ"] = "D", ["ⲇ"] = "d",
["Ⲉ"] = "E", ["ⲉ"] = "e",
["Ⲍ"] = "Z", ["ⲍ"] = "z",
["Ⲏ"] = "Ē", ["ⲏ"] = "ē",
["Ⲑ"] = "Th", ["ⲑ"] = "th",
["Ⲓ"] = "I", ["ⲓ"] = "i",
["Ⲕ"] = "K", ["ⲕ"] = "k",
["Ⲗ"] = "L", ["ⲗ"] = "l",
["Ⲙ"] = "M", ["ⲙ"] = "m",
["Ⲛ"] = "N", ["ⲛ"] = "n", ["Ⲻ"] = "N", ["ⲻ"] = "n", ["⳯"] = "n", ["Ⲳ"] = "N", ["ⲳ"] = "n",
["Ⳟ"] = "Ŋ", ["ⳟ"] = "ŋ",
["Ⳡ"] = "Ñ", ["ⳡ"] = "ñ",
["Ⳣ"] = "W", ["ⳣ"] = "w",
["Ⲝ"] = "Ks", ["ⲝ"] = "ks",
["Ⲟ"] = "O", ["ⲟ"] = "o",
["Ⲡ"] = "P", ["ⲡ"] = "p",
["Ⲣ"] = "R", ["ⲣ"] = "r",
["Ⲥ"] = "S", ["ⲥ"] = "s",
["Ⲧ"] = "T", ["ⲧ"] = "t",
["Ⲩ"] = "U", ["ⲩ"] = "u",
["Ⲫ"] = "Ph", ["ⲫ"] = "ph",
["Ⲭ"] = "Kh", ["ⲭ"] = "kh",
["Ⲯ"] = "Ps", ["ⲯ"] = "ps",
["Ⲱ"] = "Ō", ["ⲱ"] = "ō", ["Ⲿ"] = "Ō", ["ⲿ"] = "ō",
["Ϣ"] = "Š", ["ϣ"] = "š", ["Ⳇ"] = "Š", ["ⳇ"] = "š", ["Ⳅ"] = "Š", ["ⳅ"] = "š",
["Ϥ"] = "F", ["ϥ"] = "f",
["Ϧ"] = "X", ["ϧ"] = "x", ["Ⳉ"] = "X", ["ⳉ"] = "x", ["Ⳳ"] = "X", ["ⳳ"] = "x",
["Ϩ"] = "H", ["ϩ"] = "h", ["Ⳏ"] = "h", ["ⳏ"] = "h", ["Ⳑ"] = "h", ["ⳑ"] = "h",
["Ϫ"] = "Č", ["ϫ"] = "č", ["Ⳗ"] = "Č", ["ⳗ"] = "č", ["Ⳙ"] = "Č", ["ⳙ"] = "č",
["Ϭ"] = "C", ["ϭ"] = "c", ["Ⳛ"] = "C", ["ⳛ"] = "c",
["Ⳝ"] = "J", ["ⳝ"] = "j",
["Ϯ"] = "Ti", ["ϯ"] = "ti",
["Ⲹ"] = "Q", ["ⲹ"] = "q",
["Ⳋ"] = "Ç", ["ⳋ"] = "ç", ["Ⳃ"] = "Ç", ["ⳃ"] = "ç",
["Ⳓ"] = "Ḫ", ["ⳓ"] = "ḫ",
["Ⳕ"] = "ḥ", ["ⳕ"] = "ḥ", ["Ⳍ"] = "ḥ", ["ⳍ"] = "ḥ",
["Ⲵ"] = "ʿ", ["ⲵ"] = "ʿ",
["ⳤ"] = "ke",
["⳦"] = "pros",
["⳧"] = "stauros",
["⳨"] = "taur",
["⳪"] = "cōis",
}
function export.tr(text, lang, sc)
return (mw.ustring.gsub(text, '.', chars))
end
return export