
در صورت تمایل یک صفحهٔ توضیحات برای این پودمان اسکریبونتو ایجاد کنید. ویرایشگران میتوانند در صفحات تمرین (ایجاد | آینه) و آزمایشی (ایجاد) این پودمان را آزمایش کنند. لطفاً ردهها را به زیرصفحهٔ /توضیحات بیافزایید. زیرصفحههای این پودمان. |
local E = {} function E.convert_template(frame) return E.convert(frame.args[1], frame.args[2]) end function E.convert(lang, text) text = tostring(text) if lang == "fa" or lang == "ur" or lang == "mzn" 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٩]", "۹") elseif lang == "ar" or lang == "ckb" or lang == "ks" 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, "٫", ".") end return text end E.nums = {["۰"]="0",["۱"]="1",["۲"]="2",["۳"]="3",["۴"]="4",["۵"]="5",["۶"]="6",["۷"]="7",["۸"]="8",["۹"]="9"} function E.to_en(frame) txt = tostring(frame.args[1]) for k, v in pairs(E.nums) do txt = mw.ustring.gsub(txt,k,v) end txt = mw.ustring.gsub(txt,"٫",".") return txt end function E.to_fa(frame) txt = tostring(frame.args[1]) for k, v in pairs(E.nums) do txt = mw.ustring.gsub(txt,v,k) end txt = mw.ustring.gsub(txt,"\\.","٫") return txt end return E