تبديل القائمة
Toggle preferences menu
تبديل القائمة الشخصية
غير مسجل للدخول
سيكون عنوان الآيبي الخاص بك مرئيًا للعامة إذا قمت بإجراء أي تعديلات.

يمكن إنشاء صفحة توثيق الوحدة في وحدة:تحويل التاريخ/شرح

local p = {}

local months = {
    ["يناير"] = "January", ["فبراير"] = "February", ["مارس"] = "March",
    ["أبريل"] = "April", ["مايو"] = "May", ["يونيو"] = "June",
    ["يوليو"] = "July", ["أغسطس"] = "August", ["سبتمبر"] = "September",
    ["أكتوبر"] = "October", ["نوفمبر"] = "November", ["ديسمبر"] = "December"
}

function p.toEnglish(frame)
    local input = frame.args[1]
    if not input or input == "" then
        input = mw.title.getCurrentTitle().text
    end
    -- استخراج اسم الشهر واليوم من عناوين مثل "يوليو 23"
    local month, day = string.match(input, "^(%S+)%s+(%d+)$")
    if month and day and months[month] then
        return day .. " " .. months[month]
    end
    return input
end

return p