Module:GetLocalDate

मुक्त ज्ञानकोश विकिपीडिया से

"इस मॉड्यूल हेतु प्रलेख Module:GetLocalDate/doc पर बनाया जा सकता है"

local p = {}

p.localize = function(inputDigit)
    local inputArray = {}
    local output = ""
    inputDigit:gsub(".",function(c) table.insert(inputArray,c) end)
    local digits = {"०","१","२","३","४","५","६","७","८","९"}
    table.foreach(inputArray, function(key, value)
         index = tonumber(value)+1
         output = output .. digits[index]
    end)
    return output
end

p.localizeDate = function(frame)
	local input = frame.args[1]
	if (string.len(input) > 1)
	then
		local words = {}
		for word in input:gmatch("%w+") do table.insert(words, word) end
	    local months = {
	    	["January"] = "जनवरी",
	    	["February"] = "फरवरी",
	    	["March"] = "मार्च",
	    	["April"] = "अप्रैल",
	    	["May"] = "मई",
	    	["June"] = "जून",
	    	["July"] = "जुलाई",
	    	["August"] = "अगस्त",
	    	["September"] = "सितम्बर",
	    	["October"] = "अक्तूबर",
	    	["November"] = "नवम्बर",
	    	["December"] = "दिसम्बर"
	    }
           local output = p.localize(words[1])
           if (words[3] ~= nil and words[3] ~= "Blue")
           then
                   output = output .. " " .. months[words[3]]
           end
           if (words[5] ~= nil and words[5] ~= "svg")
           then
                   output = output .. " " .. p.localize(words[5])
           end
	    return output
--           return words[4]
	end
end

return p