မာတိကာသို့ ခုန်သွားရန်

မော်ဂျူး:ConvertDigit

Permanently protected မော်ဂျူး
ဝီကီပီးဒီးယား မှ
Documentation icon မော်ဂျူးမှတ်တမ်းလက်စွဲ[ကြည့်ရှု] [တည်းဖြတ်] [ရာဇဝင်] [ရှင်းသန့်]

နမူနာ

{{#invoke:ConvertDigit|main|<!-- your text here -->}}
နမူနာအားဖြင့် {{#invoke:ConvertDigit|main|16:25, 3 April 2013 (UST)}} ဟုရေးလျှင် "၁၆:၂၅, ၃ ဧပြီ ၂၀၁၃ (UST)" ဟု ရမည်။

-- Return input text after converting any en digits and month names.

local en_digits = {
	['0'] = '၀',
	['1'] = '၁',
	['2'] = '၂',
	['3'] = '၃',
	['4'] = '၄',
	['5'] = '၅',
	['6'] = '၆',
	['7'] = '၇',
	['8'] = '၈',
	['9'] = '၉',
}

local en_months = {
	['January'] = 'ဇန်နဝါရီ',
	['january'] = 'ဇန်နဝါရီ',
	['February'] = 'ဖေဖော်ဝါရီ',
	['february'] = 'ဖေဖော်ဝါရီ',
	['March'] = 'မတ်',
	['march'] = 'မတ်',
	['April'] = 'ဧပြီ',
	['april'] = 'ဧပြီ',
	['May'] = 'မေ',
	['may'] = 'မေ',
	['June'] = 'ဇွန်',
	['june'] = 'ဇွန်',
	['July'] = 'ဇူလိုင်',
	['july'] = 'ဇူလိုင်',
	['August'] = 'ဩဂုတ်',
	['august'] = 'ဩဂုတ်',
	['September'] = 'စက်တင်ဘာ',
	['september'] = 'စက်တင်ဘာ',
	['October'] = 'အောက်တိုဘာ',
	['october'] = 'အောက်တိုဘာ',
	['November'] = 'နိုဝင်ဘာ',
	['november'] = 'နိုဝင်ဘာ',
	['December'] = 'ဒီဇင်ဘာ',
	['december'] = 'ဒီဇင်ဘာ',
}

local function _main(input)
	-- Callable from another module.
	input = input or ''
	return (input:gsub('%a+', en_months):gsub('%d', en_digits))
end

local function main(frame)
	-- Callable from #invoke or from a template.
	return _main(frame.args[1] or frame:getParent().args[1])
end

return { main = main, _main = _main }