মডিউল:Numeral converter
অবয়ব
আপনি চাইলে এই স্ক্রিবুন্তো মডিউলের জন্য একটি নথির পাতা তৈরি করতে পারেন (তৈরি করুন) সম্পাদনাকারীগণ খেলাঘর (সম্পাদনা | পার্থক্য) এবং পরীক্ষা পাতায় (তৈরি করুন) এই মডিউল সংক্রান্ত পরীক্ষা-নিরীক্ষা করতে পারেন। দয়া করে /নথি উপপাতায় বিষয়শ্রেণী যোগ করুন। এই মডিউলের উপপাতাসমূহ। |
local p = {}
-- Use this function from templates.
function p.convert_template(frame)
-- Third argument is optional; If true given, signs like dot (.) will be replaced.
frame.args[3] = frame.args[3] or nil
return p.convert(frame.args[1], frame.args[2], frame.args[3])
end
-- Use this function directly in modules.
function p.convert_cordination(text)
text = tostring(text)
text = mw.ustring.gsub(text, "উত্তর", "N")
text = mw.ustring.gsub(text, "পূর্ব", "E")
text = mw.ustring.gsub(text, "দক্ষিণ", "S")
text = mw.ustring.gsub(text, "পশ্চিম", "W")
return text
end
function p.convert(lang, text, signs, virgule)
text = tostring(text)
signs = signs or nil
virgule= virgule or nil
if lang == "bn" or lang == "as" or lang == "bpy" or lang == "glk" then
text = mw.ustring.gsub(text, "[0০]", "০")
text = mw.ustring.gsub(text, "[1১]", "১")
text = mw.ustring.gsub(text, "[2২]", "২")
text = mw.ustring.gsub(text, "[3৩]", "৩")
text = mw.ustring.gsub(text, "[4৪]", "৪")
text = mw.ustring.gsub(text, "[5৫]", "৫")
text = mw.ustring.gsub(text, "[6৬]", "৬")
text = mw.ustring.gsub(text, "[7৭]", "৭")
text = mw.ustring.gsub(text, "[8৮]", "৮")
text = mw.ustring.gsub(text, "[9৯]", "৯")
if type(signs) ~= "nil" then
text = mw.ustring.gsub(text, "%.", "٫")
end
elseif lang == "bn" or lang == "as" or lang == "bpy" then
text = mw.ustring.gsub(text, "[০0]", "০")
text = mw.ustring.gsub(text, "[১1]", "১")
text = mw.ustring.gsub(text, "[২2]", "২")
text = mw.ustring.gsub(text, "[৩3]", "৩")
text = mw.ustring.gsub(text, "[৪4]", "৪")
text = mw.ustring.gsub(text, "[৫5]", "৫")
text = mw.ustring.gsub(text, "[৬6]", "৬")
text = mw.ustring.gsub(text, "[৭7]", "৭")
text = mw.ustring.gsub(text, "[৮8]", "৮")
text = mw.ustring.gsub(text, "[৯9]", "৯")
elseif lang and lang ~= "" then -- برای همهٔ زبانهای دیگر
text = mw.ustring.gsub(text, "[০০]", "0")
text = mw.ustring.gsub(text, "[১১]", "1")
text = mw.ustring.gsub(text, "[২২]", "2")
text = mw.ustring.gsub(text, "[৩৩]", "3")
text = mw.ustring.gsub(text, "[৪৪]", "4")
text = mw.ustring.gsub(text, "[৫৫]", "5")
text = mw.ustring.gsub(text, "[৬৬]", "6")
text = mw.ustring.gsub(text, "[৭৭]", "7")
text = mw.ustring.gsub(text, "[৮৮]", "8")
text = mw.ustring.gsub(text, "[৯৯]", "9")
text = mw.ustring.gsub(text, "٫", ".")
if type(virgule) ~= "nil" then
text = mw.ustring.gsub(text, "،", ",")
end
end
return text
end
return p