မော်ဂျူး:my-utilities
ပုံပန်းသွင်ပြင်
Documentation for this module may be created at မော်ဂျူး:my-utilities/doc
local export = {}
local gsub = mw.ustring.gsub
local find = mw.ustring.find
local match = mw.ustring.match
local burmese_digits = {"၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"}
function export.pluralize(str)
return str:find("များ$") and str or str .. "များ"
end
-- from [[Module:headword/data]]
local my_pos = {
-- these are lemmas
["verbs"] = "ကြိယာ",
["verb"] = "ကြိယာ",
["ကြိယာ"] = "ကြိယာ",
["ကြိယာများ"] = "ကြိယာ",
["verb forms"] = "ကြိယာပုဒ်",
["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"] = "အညွှန်းစကားလုံးပုဒ်",
["punctuation marks"] = "ပုဒ်ဖြတ်ပုဒ်ရပ်သင်္ကေတ",
["hanzi"] = "ဟန်ဇီ",
["numerals"] = "ဂဏန်းခြေ",
["numeral forms"] = "ဂဏန်းခြေပုဒ်",
["syllables"] = "ဝဏ္ဏ",
["symbols"] = "သင်္ကေတ",
["participles"] = "ကြိယာသဏ္ဌာန်",
["participle forms"] = "ကြိယာသဏ္ဌာန်ပုဒ်",
["present participles"] = "ပစ္စုပ္ပန်ကာလပြ ကြိယာသဏ္ဌာန်",
["past participles"] = "အတိတ်ကာလပြ ကြိယာသဏ္ဌာန်",
["past participle forms"] = "အတိတ်ကာလပြ ကြိယာသဏ္ဌာန်ပုဒ်",
["romanizations"] = "ရောမအက္ခရာဖလှယ်ခြင်း",
}
function export.my_pos(pos)
return my_pos[pos] or my_pos[en_utilities.pluralize(pos)] or pos
end
function export.arabic_digit_to_burmese(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), burmese_digits[n + 1])
end
end
return text
end
function export.burmese_digit_to_arabic(text)
if type(text) == "string" and find(text, "[၀-၉]") then
for n = 0, 9 do
text = gsub(text, burmese_digits[n + 1], tostring(n))
end
end
return text
end
return export