Module:sish-translit: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
local tt = {} | local tt = {} | ||
tt["Armn"] = { | tt["Armn"] = { | ||
{"Ու", "U"}, {"ու", "u"}, | |||
{"Ա", "A"}, {"ա", "a"}, | {"Ա", "A"}, {"ա", "a"}, | ||
{"Բ", "B"}, {"բ", "b"}, | {"Բ", "B"}, {"բ", "b"}, | ||
| Line 24: | Line 26: | ||
{"Ս", "S"}, {"ս", "s"}, | {"Ս", "S"}, {"ս", "s"}, | ||
{"Տ", "T"}, {"տ", "t"}, | {"Տ", "T"}, {"տ", "t"}, | ||
{"Ֆ", "F"}, {"ֆ", "f"}, | {"Ֆ", "F"}, {"ֆ", "f"}, | ||
{"Հ", "H"}, {"հ", "h"}, | {"Հ", "H"}, {"հ", "h"}, | ||
Latest revision as of 19:47, 12 June 2026
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate Ossamic 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:sish-translit/testcases.
Functions
tr(text, lang, sc)- Transliterates a given piece of
textwritten in the script specified by the codesc, and language specified by the codelang. - When the transliteration fails, returns
nil.
local export = {}
local tt = {}
tt["Armn"] = {
{"Ու", "U"}, {"ու", "u"},
{"Ա", "A"}, {"ա", "a"},
{"Բ", "B"}, {"բ", "b"},
{"Վ", "V"}, {"վ", "v"},
{"Գ", "G"}, {"գ", "g"},
{"Դ", "D"}, {"դ", "d"},
{"Ե", "E"}, {"ե", "e"},
{"Է", "Ē"}, {"է", "ē"},
{"Ժ", "Ž"}, {"ժ", "ž"},
{"Զ", "Z"}, {"զ", "z"},
{"Ի", "I"}, {"ի", "i"},
{"Ձ", "J"}, {"ձ", "j"},
{"Կ", "K"}, {"կ", "k"},
{"Լ", "L"}, {"լ", "l"},
{"Մ", "M"}, {"մ", "m"},
{"Ն", "N"}, {"ն", "n"},
{"Ո", "O"}, {"ո", "o"},
{"Օ", "Ō"}, {"օ", "ō"},
{"Պ", "P"}, {"պ", "p"},
{"Ր", "R"}, {"ր", "r"},
{"Ս", "S"}, {"ս", "s"},
{"Տ", "T"}, {"տ", "t"},
{"Ֆ", "F"}, {"ֆ", "f"},
{"Հ", "H"}, {"հ", "h"},
{"Ծ", "C"}, {"ծ", "c"},
{"Ճ", "Č"}, {"ճ", "č"},
{"Ջ", "J̌"}, {"ջ", "ǰ"},
{"Շ", "Š"}, {"շ", "š"},
{"Յ", "Y"}, {"յ", "y"},
{"Խ", "X"}, {"խ", "x"},
{"Ղ", "Ġ"}, {"ղ", "ġ"},
{"Ը", "Ə"}, {"ը", "ə"},
{"Ռ", "Ṙ"}, {"ռ", "ṙ"},
{"Փ", "Pʻ"}, {"փ", "pʻ"},
{"Թ", "Tʻ"}, {"թ", "tʻ"},
{"Ք", "Kʻ"}, {"ք", "kʻ"},
{"Ց", "Cʻ"}, {"ց", "cʻ"},
{"Չ", "Čʻ"}, {"չ", "čʻ"},
{"ւ", "w"},
{"՝", ","}, {"։", "."}, {"․", ";"}, {"՛", "́"}, {"՜", "<sup>!</sup>"}, {"՞", "<sup>?</sup>"},
{"՟", "."}, {"֊", "-"}, {"՚", "’"}, {"«", "“"}, {"»", "”"}, {"ՙ", "ʻ"}
};
tt["Latn"] = {
--Digraphs
{"U", "Ու"}, {"u", "ու"},
{"A", "Ա"}, {"a", "ա"},
{"B", "Բ"}, {"b", "բ"},
{"V", "Վ"}, {"v", "վ"},
{"G", "Գ"}, {"g", "գ"},
{"D", "Դ"}, {"d", "դ"},
{"E", "Ե"}, {"e", "ե"},
{"Ē", "Է"}, {"ē", "է"},
{"Ž", "Ժ"}, {"ž", "ժ"},
{"Z", "Զ"}, {"z", "զ"},
{"I", "Ի"}, {"i", "ի"},
{"J", "Ձ"}, {"j", "ձ"},
{"K", "Կ"}, {"k", "կ"},
{"L", "Լ"}, {"l", "լ"},
{"M", "Մ"}, {"m", "մ"},
{"N", "Ն"}, {"n", "ն"},
{"O", "Ո"}, {"o", "ո"},
{"Ō", "Օ"}, {"ō", "օ"},
{"P", "Պ"}, {"p", "պ"},
{"R", "Ր"}, {"r", "ր"},
{"S", "Ս"}, {"s", "ս"},
{"T", "Տ"}, {"t", "տ"},
{"F", "Ֆ"}, {"f", "ֆ"},
{"H", "Հ"}, {"h", "հ"},
{"C", "Ծ"}, {"c", "ծ"},
{"Č", "Ճ"}, {"č", "ճ"},
{"J̌", "Ջ"}, {"ǰ", "ջ"},
{"Š", "Շ"}, {"š", "շ"},
{"Y", "Յ"}, {"y", "յ"},
{"X", "Խ"}, {"x", "խ"},
{"Ġ", "Ղ"}, {"ġ", "ղ"},
{"Ə", "Ը"}, {"ə", "ը"},
{"Ṙ", "Ռ"}, {"ṙ", "ռ"},
{"Pʻ", "Փ"}, {"pʻ", "փ"},
{"Tʻ", "Թ"}, {"tʻ", "թ"},
{"Kʻ", "Ք"}, {"kʻ", "ք"},
{"Cʻ", "Ց"}, {"cʻ", "ց"},
{"Čʻ", "Չ"}, {"čʻ", "չ"},
{"w", "ւ"},
{"%-", "֊"}
};
function export.tr(text, lang, sc)
for _, rule in ipairs(tt[sc]) do
text = mw.ustring.gsub(text, rule[1], rule[2])
end
return text
end
return export