Module:Ougr-translit
Appearance
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the Old Uyghur script. It is used to transliterate Old Uyghur.
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:Ougr-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 m_str_utils = require("Module:string utilities")
local U = m_str_utils.char
local ougr_combining_dot_above = U(0x10F82)
local ougr_combining_dot_below = U(0x10F83)
local ougr_combining_two_dots_above = U(0x10F84)
local ougr_combining_two_dots_below = U(0x10F85)
local ougr_punctuation_two_dots = U(0x10F88)
local combining_dot_above = U(0x0307)
local combining_dot_below = U(0x0323)
local combining_diaeresis_above = U(0x0308)
local combining_diaeresis_below = U(0x0324)
local tt = {
["𐽰"] = "ʾ",
["𐽼"] = "p",
["𐽽"] = "c",
["𐽸"] = "d",
["𐽸𐾂"] = "ḍ",
["𐾀"] = "t",
["𐽷"] = "k",
["𐽲"] = "q",
["𐽱"] = "β",
["𐽳"] = "w",
["𐽴"] = "z",
["𐽵"] = "x",
["𐽶"] = "y",
["𐽹"] = "m",
["𐽺"] = "n",
["𐽻"] = "s",
["𐽾"] = "r",
["𐽿"] = "š",
["𐾁"] = "l",
[ougr_combining_dot_above] = combining_dot_above,
[ougr_combining_dot_below] = combining_dot_below,
[ougr_combining_two_dots_above] = combining_diaeresis_above,
[ougr_combining_two_dots_below] = combining_diaeresis_below,
[ougr_punctuation_two_dots] = "",
}
function export.tr(text, lang, sc)
if not sc then
sc = require("Module:languages").getByCode(lang):findBestScript(text):getCode()
end
if sc ~= "Ougr" then
text = nil
else
text = mw.ustring.gsub(text, '.', tt)
end
return text
end
return export