تغییر منو
Toggle preferences menu
تغییر منوی شخصی
به سامانه وارد نشده‌اید
نشانی آی‌پی شما در صورت انجام هرگونه ویرایش به صورت عمومی قابل مشاهده خواهد بود.

پودمان:الگوی یکسان به زبان دیگر

از اسلامشناسان
نسخهٔ تاریخ ۲ فوریهٔ ۲۰۱۸، ساعت ۱۷:۲۶ توسط imported>Adminb (صفحه‌ای تازه حاوی «-- این پودمان برای الگو:جعبه پیام الگوی یکسان انگلیسی و فارسی است. local messageBox...» ایجاد کرد)

-- این پودمان برای الگو:جعبه پیام الگوی یکسان انگلیسی و فارسی است. local messageBox = require("Module:Message box").main local getArgs = require("Module:Arguments").getArgs

return {

 main = function(frame)
   local currentTitle, args
   currentTitle = mw.title.getCurrentTitle()
   args = getArgs(
   	frame, 
   	{
   		trim = true, 
   		removeBlanks = true,
   		parentOnly = true,
   		wrappers = "الگو:الگوی یکسان به زبان دیگر",
   		noOverwrite = true,
   		valueFunc = function(_, value)
   			return mw.ustring.gsub(value, "الگو:", "")

end } )

   -- 10 is template namespace
   if currentTitle:inNamespace(10) then
     if type(args[1]) ~= "nil" and mw.title.new(args[1], 10).exists then
       local text, templateIs, templateIn
       text = "این الگوی "
       if mw.ustring.match(currentTitle.text, "[a-zA-Z]") then
         templateIs = "انگلیسی"
         templateIn = "فارسی"
       else
         templateIs = "فارسی"
         templateIn = "انگلیسی"
       end
       text = text .. templateIs .. " [[الگو:" .. args[1] .. "|نمونهٔ " .. templateIn .."]] دارد که تمام پارامترهایش " .. templateIn .. " است."
       if templateIn == "فارسی" then
         text = text .. " توصیه می‌کنیم از الگوی فارسی استفاده کنید."
       end
       -- Add category into persian templates have similar template in English.
       if templateIs == "فارسی" then
         text = text .. ""
       end
       return messageBox("ombox", {text=text})
     else
       error("الگوی مقصد یا مشخص نشده‌است یا در فضای نام الگو قرار ندارد")
     end
   else
     error("الگوی {{الگوی یکسان به زبان دیگر}} فقط در فضای نام الگو استفاده می‌شود")
   end
 end

}