Jump to content

ᱢᱳᱰᱩᱞ:ConvertDigit

ᱣᱤᱠᱤᱯᱤᱰᱤᱭᱟ, ᱨᱟᱲᱟ ᱜᱮᱭᱟᱱ ᱯᱩᱛᱷᱤ ᱠᱷᱚᱱ

see: Doc
ᱮᱴᱟᱜ ᱣᱤᱠᱤ ᱨᱮ ᱱᱚᱶᱟ ᱠᱳᱰ

{{#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'] = 'ᱡᱟᱱᱩᱣᱟᱨᱤ',
   ['February'] = 'ᱯᱷᱮᱵᱽᱨᱩᱣᱟᱨᱤ',
   ['March'] = 'ᱢᱟᱨᱪ',
   ['April'] = 'ᱮᱯᱨᱤᱞ',
   ['May'] = 'ᱢᱮ',
   ['June'] = 'ᱡᱩᱱ',
   ['July'] = 'ᱡᱩᱞᱟᱭ',
   ['August'] = 'ᱚᱜᱚᱥᱴ',
   ['September'] = 'ᱥᱮᱯᱴᱮᱢᱵᱚᱨ',
   ['October'] = 'ᱚᱠᱴᱚᱵᱚᱨ',
   ['November'] = 'ᱱᱚᱵᱷᱮᱢᱵᱚᱨ',
   ['December'] = 'ᱰᱤᱥᱮᱢᱵᱚᱨ',
   ['january'] = 'ᱡᱟᱱᱩᱣᱟᱨᱤ',
   ['february'] = 'ᱯᱷᱮᱵᱽᱨᱩᱣᱟᱨᱤ',
   ['march'] = 'ᱢᱟᱨᱪ',
   ['april'] = 'ᱮᱯᱨᱤᱞ',
   ['may'] = 'ᱢᱮ',
   ['june'] = 'ᱡᱩᱱ',
   ['july'] = 'ᱡᱩᱞᱟᱭ',
   ['august'] = 'ᱚᱜᱚᱥᱴ',
   ['september'] = 'ᱥᱮᱯᱴᱮᱢᱚᱨ',
   ['october'] = 'ᱚᱠᱴᱚᱵᱚᱨ',
   ['november'] = 'ᱱᱚᱵᱷᱮᱢᱵᱚᱨ',
   ['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 }