မဝ်ဂျူ:mnw-utilities
မံက်ပြာကတ်
local export = {}
local gsub = mw.ustring.gsub
local find = mw.ustring.find
local match = mw.ustring.match
local mon_digits = {"၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"}
function export.pluralize(str)
return str:find("ဂမၠိုင်$") and str or str .. "ဂမၠိုင်"
end
-- from [[Module:headword/data]]
local mon_pos = {
-- these are lemmas
["verbs"] = "ကြိယာ",
["verb forms"] = "ဗီုပြင်ကြိယာ",
["weak verbs"] = "ကြိယာဇြဟတ်ဍိုန်",
["auxiliary verbs"] = "ကြိယာအထံက်အပင်",
["nouns"] = "နာမ်",
["noun forms"] = "ဗီုပြင်နာမ်",
["adjectives"] = "နာမဝိသေသန",
["adjective forms"] = "ဗီုပြင်နာမဝိသေသန",
["superlative adjectives"] = "သဒ္ဒာနာမဝိသေသန",
["superlative adjective forms"] = "ဗီုပြင်သဒ္ဒာနာမဝိသေသန",
["comparative adjectives"] = "နာမဝိသေသနပတုပ်ရံင်",
["comparative adjective forms"] = "ဗီုပြင်ပတုပ်ရံင်နာမဝိသေသန",
["adverbs"] = "ကြိယာဝိသေသန",
["adverb forms"] = "ဗီုပြင်ကြိယာဝိသေသန",
["superlative adverbs"] = "သဒ္ဒာကြိယာဝိသေသန",
["proper nouns"] = "နာမ်မကိတ်ညဳ",
["proper noun forms"] = "ဗီုပြင်နာမ်မကိတ်ညဳ",
["pronouns"] = "သဗ္ဗနာမ်",
["pronoun forms"] = "ဗီုပြင်သဗ္ဗနာမ်",
["affixes"] = "အဆက်ဖျပ်စုတ်လက္ကရဴ",
["affixe forms"] = "ဗီုပြင်အဆက်ဖျပ်စုတ်လက္ကရဴ",
["articles"] = "ပစ္စဲ",
["article forms"] = "ဗီုပြင်ဗီုပြင်ပစ္စဲ",
["roots"] = "တံရိုဟ်",
["root forms"] = "ဗီုပြင်တံရိုဟ်",
["punctuation marks"] = "ခရက်သမ္တီလဝ်ဓမံက်ထ္ၜးရမျာင်",
["postpositions"] = "ကဆံင်အကာဲအရာ",
["postposition forms"] = "ဗီုပြင်ကဆံင်အကာဲအရာ",
["hanzi"] = "ဟာန်သဳ",
["numerals"] = "ဂၞန်သင်္ချာ",
["numeral forms"] = "ဗီုပြင်ဂၞန်သင်္ချာ",
["numeral symbols"] = "သင်္ကေတဂၞန်သင်္ချာ",
["numeral symbols"] = "သင်္ကေတဂၞန်သင်္ချာ",
["syllables"] = "ဝဏ္ဏ",
["symbols"] = "သင်္ကေတ",
["participles"] = "လုပ်ကၠောန်စွံလဝ်",
["participle forms"] = "လုပ်ကၠောန်စွံလဝ်",
["present participles"] = "လုပ်ကၠောန်စွံလဝ်ပစ္စုပ္ပန်",
["past participles"] = "လုပ်ကၠောန်စွံလဝ်နကဵုအတိတ်",
["past participle forms"] = "ဗီုပြင်လုပ်ကၠောန်စွံလဝ်နကဵုအတိတ်",
["romanizations"] = "ဗီုအက္ခရ်ရောမ",
}
function export.mnw_pos(pos)
return mon_pos[pos] or mon_pos[en_utilities.pluralize(pos)] or pos
end
function export.arabic_digit_to_mon(text)
if type(text) == "number" then
text = tostring(text) -- convert to string
end
if type(text) == "string" and find(text, "[0-9]") then
for n = 0, 9 do
text = gsub(text, tostring(n), mon_digits[n + 1])
end
end
return text
end
function export.mon_digit_to_arabic(text)
if type(text) == "string" and find(text, "[၀-၉]") then
for n = 0, 9 do
text = gsub(text, mon_digits[n + 1], tostring(n))
end
end
return text
end
return export