มอดูล:Armn-translit
หน้าตา
- The following documentation is located at มอดูล:Armn-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 อักษรอาร์มีเนีย.
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:Armn-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 gsub = mw.ustring.gsub
local mapping = {
["ա"]="า", ["բ"]="บ", ["գ"]="กฺ", ["դ"]="ด", ["ե"]="↶เʲ", ["զ"]="ซฺ",["է"]="↶เ", ["ը"]="↶เอ̂",
["թ"]="ท", ["ժ"]="ฌฺ", ["ի"]="ี", ["լ"]="ล", ["խ"]="ฅ", ["ծ"]="ต͜ซ", ["կ"]="ก", ["հ"]="ฮ",
["ձ"]="ด͜ซฺ", ["ղ"]="ฆ", ["ճ"]="จ", ["մ"]="ม", ["յ"]="ย", ["ն"]="น", ["շ"]="ฌ", ["ո"]="อ̂",
["չ"]="ช", ["պ"]="ป", ["ջ"]="จฺ", ["ռ"]="รฺ", ["ս"]="ซ", ["վ"]="วฺ", ["տ"]="ต", ["ր"]="ร",
["ց"]="ท͜ซ", ["ւ"]="ว", ["փ"]="พ", ["ք"]="ค", ["և"]="↶เʲวฺ", ["օ"]="↶โ", ["ֆ"]="ฟ",
["Ա"]="า", ["Բ"]="บ", ["Գ"]="กฺ", ["Դ"]="ด", ["Ե"]="↶เʲ", ["Զ"]="ซฺ", ["Է"]="↶เ", ["Ը"]="↶เอ̂",
["Թ"]="ท", ["Ժ"]="ฌฺ", ["Ի"]="ี", ["Լ"]="ล", ["Խ"]="ฅ", ["Ծ"]="ต͜ซ", ["Կ"]="ก", ["Հ"]="ฮ",
["Ձ"]="ด͜ซฺ", ["Ղ"]="ฆ", ["Ճ"]="จ", ["Մ"]="ม", ["Յ"]="ย", ["Ն"]="น", ["Շ"]="ฌ", ["Ո"]="อ̂",
["Չ"]="ช", ["Պ"]="ป", ["Ջ"]="จฺ", ["Ռ"]="รฺ", ["Ս"]="ซ", ["Վ"]="วฺ", ["Տ"]="ต", ["Ր"]="ร",
["Ց"]="ท͜ซ", ["Ւ"]="ว", ["Փ"]="พ", ["Ք"]="ค", ["Օ"]="↶โ", ["Ֆ"]="ฟ",
["ﬓ "]="มน", ["ﬔ"]="ม↶เะ", ["ﬕ"]="มี", ["ﬖ"]="วฺน", ["ﬗ"]="มฅ",
-- punctuation
["՝"]=",", ["։"]=".", ["․"]=";", ["՛"]="́", ["՜"]="<sup>!</sup>", ["՞"]="<sup>?</sup>",
["՟"]=".", ["֊"]="-", ["՚"]="’", ['«']='“', ['»']='”', ['ՙ']='ʿ'
}
function export.tr(text, lang, sc)
text = gsub(text, 'յ̵', 'ɦ')
text = gsub(text, 'Ո[ւՒ]', 'ู')
text = gsub(text, 'ու', 'ู')
text = gsub(text, 'Ո՛[ւՒ]', 'ู')
text = gsub(text, 'ո՛ւ', 'ู')
text = gsub(text, 'Ո՜[ւՒ]', 'ู<sup>!</sup>')
text = gsub(text, 'ո՜ւ', 'ู<sup>!</sup>')
text = gsub(text, 'Ո՞[ւՒ]', 'ู<sup>?</sup>')
text = gsub(text, 'ո՞ւ', 'ู<sup>?</sup>')
text = gsub(text, 'ո̈ւ', 'ื')
text = gsub(text, 'Ո̈[ւՒ]', 'ื')
text = gsub(text, '.', mapping)
text = gsub(text, '^([าีืู])', 'อ%1')
text = gsub(text, ' ([าีืู])', ' อ%1')
text = gsub(text, 'าี', 'าอี')
text = gsub(text, '^(อ̂)', 'วฺ%1')
text = gsub(text, ' (อ̂)', ' วฺ%1')
text = gsub(text, '^(↶เʲ)', 'ย%1')
text = gsub(text, ' (↶เʲ)', ' ย%1')
text = gsub(text, '^(↶เอ̂)', 'อ%1')
text = gsub(text, ' (↶เอ̂)', ' อ%1')
text = gsub(text, '^(↶[เโ])', 'อ%1')
text = gsub(text, ' (↶[เโ])', ' อ%1')
text = gsub(text, 'ʲ', '')
text = gsub(text, '([ก-ฮ]ฺ?)↶([เโ])', '%2%1')
text = gsub(text, '([ก-ฮ]ฺ?)า([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1ั%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)า([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1ั%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)า([ก-ฮ]ฺ?)([เแโ])', '%1ั%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)า([ก-ฮ]ฺ?)([%s%p])', '%1ั%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)า([ก-ฮ]ฺ?)$', '%1ั%2')
text = gsub(text, '([ก-ฮ]ฺ?)ี([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1ิ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ี([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1ิ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ี([ก-ฮ]ฺ?)([เแโ])', '%1ิ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ี([ก-ฮ]ฺ?)([%s%p])', '%1ิ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ี([ก-ฮ]ฺ?)$', '%1ิ%2')
text = gsub(text, '([ก-ฮ]ฺ?)ื([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1ึ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ื([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1ึ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ื([ก-ฮ]ฺ?)([เแโ])', '%1ึ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ื([ก-ฮ]ฺ?)([%s%p])', '%1ึ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ื([ก-ฮ]ฺ?)$', '%1ึ%2')
text = gsub(text, '([ก-ฮ]ฺ?)ู([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1ุ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ู([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1ุ%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)ู([ก-ฮ]ฺ?)([เแโ])', '%1ุ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ู([ก-ฮ]ฺ?)([%s%p])', '%1ุ%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)ู([ก-ฮ]ฺ?)$', '%1ุ%2')
text = gsub(text, '([ก-ฮ]ฺ?)อ̂([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1็อ̂%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)อ̂([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1็อ̂%2%3%4')
text = gsub(text, '([ก-ฮ]ฺ?)อ̂([ก-ฮ]ฺ?)([เแโ])', '%1็อ̂%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)อ̂([ก-ฮ]ฺ?)([%s%p])', '%1็อ̂%2%3')
text = gsub(text, '([ก-ฮ]ฺ?)อ̂([ก-ฮ]ฺ?)$', '%1็อ̂%2')
text = gsub(text, '([เแโ])([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)(อ̂)', '%1%2็%3%4%5')
text = gsub(text, '([เแโ])([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([ัาิีึืฺุู็])', '%1%2็%3%4%5')
text = gsub(text, '([เแโ])([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([เแโ])', '%1%2็%3%4')
text = gsub(text, '([เแโ])([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)([%s%p])', '%1%2็%3%4')
text = gsub(text, '([เแโ])([ก-ฮ]ฺ?)([ก-ฮ]ฺ?)$', '%1%2็%3')
return text
end
return export