توضیحات پودمان[نمایش] [ویرایش] [تاریخچه] [پاکسازی]

رشتهٔ تاریخ میلادی با حروف فارسی را به یک رشتهٔ انگلیسی تبدیل می‌کند. در واقع نام ماه را به میلادی و اعداد را لاتین خواهد کرد.

مثال: {{#invoke:Date2en|convert_template|۱۲ دسامبر}} می‌دهد 12 December

استفاده ویرایش

{{#invoke:Date2en|convert_template|تاریخ میلادی}}

local p = {}

local numConv = require( "Module:Numeral converter" ).convert

-- Use this function from templates.
function p.convert_template(frame)
  return p.convert(frame.args[1])
end

-- Use this function directly in modules.
function p.convert(text)
	text = mw.ustring.gsub(text, "ٔ", "")
	text = mw.ustring.gsub(text, "ژانویه", "January")
	text = mw.ustring.gsub(text, "فوریه", "February")
	text = mw.ustring.gsub(text, "مارس", "March")
	text = mw.ustring.gsub(text, "آوریل", "April")
	text = mw.ustring.gsub(text, "مه", "May")
	text = mw.ustring.gsub(text, "ژوئن", "June")
	text = mw.ustring.gsub(text, "ژوئیه", "July")
	text = mw.ustring.gsub(text, "اوت", "August")
	text = mw.ustring.gsub(text, "سپتامبر", "September")
	text = mw.ustring.gsub(text, "اکتبر", "October")
	text = mw.ustring.gsub(text, "نوامبر", "November")
	text = mw.ustring.gsub(text, "دسامبر", "December")
	text = mw.ustring.gsub(text, "ساعت", "hours")
	text = mw.ustring.gsub(text, "روز", "days")
	text = mw.ustring.gsub(text, "هفته", "weeks")
	text = mw.ustring.gsub(text, "ماه", "months")
	text = mw.ustring.gsub(text, "سال", "years")
	
	return numConv("en", text)
end

return p