มอดูล:Goth-translit
- The following documentation is located at มอดูล:Goth-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 อักษรกอท. It is used to transliterate กอท.
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:Goth-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 Goth_Latn = {
["𐌰"] = "ะ",
["𐌱"] = "บ",
["𐌲"] = "ก",
["𐌳"] = "ด",
["𐌴"] = "↶เ",
["𐌵"] = "คฺว",
["𐌶"] = "ซ",
["𐌷"] = "ฮ",
["𐌸"] = "ธ",
["𐌹"] = "ิ",
["𐌺"] = "ค",
["𐌻"] = "ล",
["𐌼"] = "ม",
["𐌽"] = "น",
["𐌾"] = "ย",
["𐌿"] = "ุ",
["𐍀"] = "พ",
["𐍁"] = "?",
["𐍂"] = "ร",
["𐍃"] = "ส",
["𐍄"] = "ท",
["𐍅"] = "ว",
["𐍆"] = "ฟ",
["𐍇"] = "ฅ",
["𐍈"] = "ฮฺว",
["𐍉"] = "↶โ",
["𐍊"] = "?",
}
local Goth_Latn2 = {
["𐌰𐌹"] = "↶ไ",
["𐌰𐌿"] = "↶เา",
["𐌴𐌹"] = "↶เยฺ",
["𐌹𐌰"] = "↶เีย",
["𐌹𐌿"] = "ิวฺ",
["𐍉𐌴"] = "↶โ͜เอ",
}
--[[ unused
local Latn_Goth = {
["ā"] = "𐌰",
["e"] = "𐌴",
["ī"] = "𐌹",
["o"] = "𐍉",
["ū"] = "𐌿",
["y"] = "𐍅",
}
for g, l in pairs(Goth_Latn) do
if l ~= "?" then
Latn_Goth[l] = g
end
end
--]]
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, "^([𐌰𐌴𐌹𐌿𐍉])", "อ%1")
text = mw.ustring.gsub(text, "([%s%p])([𐌰𐌴𐌹𐌿𐍉])", "%1อ%2")
text = mw.ustring.gsub(text, "[𐌰𐌴𐌹𐌿𐍉][𐌰𐌴𐌹𐌿𐍉]", Goth_Latn2)
text = mw.ustring.gsub(text, ".", Goth_Latn)
text = mw.ustring.gsub(text, "([ก-ฮ])↶([เโไ])", "%2%1")
text = mw.ustring.gsub(text, "ะ$", "า")
text = mw.ustring.gsub(text, "ะ([%s%p])", "า%1")
text = mw.ustring.gsub(text, "([ก-ฮ])ะ([ก-ฮ])$", "%1ั%2")
text = mw.ustring.gsub(text, "([ก-ฮ])ะ([ก-ฮ])([^ะัาิีฺุู])", "%1ั%2%3")
-- second time
text = mw.ustring.gsub(text, "([ก-ฮ])ะ([ก-ฮ])([^ะัาิีฺุู])", "%1ั%2%3")
return text
end
--[[ unused
function export.tr_reverse(text)
text = mw.ustring.lower(text)
return (mw.ustring.gsub(text, ".", Latn_Goth))
end
--]]
return export