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 my_digits = {"၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"}

function export.pluralize(str)
	return str:find("များ$") and str or str .. "များ"
end

function export.arabic_digit_to_my(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), my_digits[n + 1])
		end
	end
	return text
end

function export.my_digit_to_arabic(text)
	if type(text) == "string" and find(text, "[၀-၉]") then
		for n = 0, 9 do
			text = gsub(text, my_digits[n + 1], tostring(n))
		end
	end
	return text
end

return export