در حال ویرایش پودمان:Numeral converter

هشدار: شما وارد نشده‌اید. نشانی آی‌پی شما برای عموم قابل مشاهده خواهد بود اگر هر تغییری ایجاد کنید. اگر وارد شوید یا یک حساب کاربری بسازید، ویرایش‌هایتان به نام کاربری‌تان نسبت داده خواهد شد، همراه با مزایای دیگر.

این ویرایش را می‌توان خنثی کرد. لطفاً تفاوت زیر را بررسی کنید تا تأیید کنید که این چیزی است که می‌خواهید انجام دهید، سپس تغییرات زیر را ذخیره کنید تا خنثی‌سازی ویرایش را به پایان ببرید.

نسخهٔ فعلی متن شما
خط ۱: خط ۱:
local p = {}
local p = {}
local lang = mw.language.new('fa')
 
-- Use this function from templates.
-- Use this function from templates.
function p.convert_template(frame)
function p.convert_template(frame)
-- Third argument is optional; If true given, signs like dot (.) will be replaced.
  -- Third argument is optional; If true given, signs like dot (.) will be replaced.
frame.args[3] = frame.args[3] or nil
  frame.args[3] = frame.args[3] or nil
return p.convert(frame.args[1], frame.args[2], frame.args[3])
  return p.convert(frame.args[1], frame.args[2], frame.args[3])
end
end


خط ۱۱: خط ۱۱:


function p.convert_cordination_template(frame)
function p.convert_cordination_template(frame)
return p.convert("en", p.convert_cordination(frame.args[1]))
  return p.convert('en',p.convert_cordination(frame.args[1]))
end
end


function p.convert_cordination(text)
function p.convert_cordination(text)
text = tostring(text)
  text = tostring(text)
text = mw.ustring.gsub(text, "شمالی", "N")
  text = mw.ustring.gsub(text, "شمالی", "N")
text = mw.ustring.gsub(text, "شرقی", "E")
  text = mw.ustring.gsub(text, "شرقی", "E")
text = mw.ustring.gsub(text, "جنوبی", "S")
  text = mw.ustring.gsub(text, "جنوبی", "S")
text = mw.ustring.gsub(text, "غربی", "W")
  text = mw.ustring.gsub(text, "غربی", "W")
return text
  return text
end
end


function p.convert_Fa_cordination(text)
function p.convert_Fa_cordination(text)
text = tostring(text)
  text = tostring(text)
text = mw.ustring.gsub(text, "N", "شمالی")
  text = mw.ustring.gsub(text,"N", "شمالی")
text = mw.ustring.gsub(text, "E", "شرقی")
  text = mw.ustring.gsub(text,"E", "شرقی")
text = mw.ustring.gsub(text, "S", "جنوبی")
  text = mw.ustring.gsub(text, "S","جنوبی")
text = mw.ustring.gsub(text, "W", "غربی")
  text = mw.ustring.gsub(text, "W","غربی")
return text
  return text
end
end


function p.convert(lang, text, signs, virgule)
function p.convert(lang, text, signs, virgule)
local file
  text = tostring(text)
local files = {}
  signs = signs or nil
local i = 1
  virgule= virgule or nil
text = tostring(text)
if mw.ustring.find(text, "%[%[[Ffپ][Iiر][Llو][Eeن]د?ه?%:") then
for capture in mw.ustring.gmatch(text, "%[%[[Ffپ][Iiر][Llو][Eeن]د?ه?%:.+%]%]") do
text = mw.ustring.gsub(text, "%[%[[Ffپ][Iiر][Llو][Eeن]د?ه?%:.+%]%]", "FILE", 1)
files[i] = capture
i = i + 1
end
i = 1
end


signs = signs or nil
  if lang == "fa" or lang == "ur" or lang == "mzn" or lang == "glk" then -- برای فارسی، اردو، مازندرانی، گیلکی
virgule = virgule or nil
    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(signs) ~= "nil" then
      text = mw.ustring.gsub(text, "%.", "٫")
      --تبدیل % به درصد فارسی ٪ را نگذاشتم چون ممکن است کدهای درصدی وارد شده به پودمان را خراب کند.
    end
  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, "٫", ".")
    text = mw.ustring.gsub(text, "٪", "%")
    if type(virgule) ~= "nil" then
      text = mw.ustring.gsub(text, "،", ",")
      text = mw.ustring.gsub(text, "٪", "%")
    end
  end


if lang == "fa" or lang == "ur" or lang == "mzn" or lang == "glk" then -- برای فارسی، اردو، مازندرانی، گیلکی
  return text
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(signs) ~= "nil" then
text = mw.ustring.gsub(text, "%.", "٫")
--تبدیل % به درصد فارسی ٪ را نگذاشتم چون ممکن است کدهای درصدی وارد شده به پودمان را خراب کند.
end
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, "٫", ".")
text = mw.ustring.gsub(text, "٪", "%")
if type(virgule) ~= "nil" then
text = mw.ustring.gsub(text, "،", ",")
text = mw.ustring.gsub(text, "٪", "%")
end
end
if #files > 0 then
while i <= #files do
text = mw.ustring.gsub(text, "FILE", files[i], 1)
i = i + 1
end
end
return text
end
end
 
return p
return p
لطفاً توجه داشته باشید که همهٔ مشارکت‌ها در ویکی حج منتشرشده تحت Creative Commons Attribution-NonCommercial-ShareAlike در نظر گرفته‌می‌شوند (برای جزئیات بیش‌تر ویکی حج:حق تکثیر را ببینید). اگر نمی‌خواهید نوشته‌هایتان بی‌رحمانه ویرایش و توزیع شوند؛ بنابراین، آنها را اینجا ارائه نکنید.
شما همچنین به ما تعهد می‌کنید که خودتان این را نوشته‌اید یا آن را از یک منبع با مالکیت عمومی یا مشابه آزاد آن برداشته‌اید (برای جزئیات بیش‌تر ویکی حج:حق تکثیر را ببینید). کارهای دارای حق تکثیر را بدون اجازه ارائه نکنید!
لغو راهنمای ویرایش (در پنجرهٔ تازه باز می‌شود)

الگوی به‌کاررفته در این صفحه: