မေႃႇၵျူး:ConvertDigit

လုၵ်ႉတီႈ ဝီႇၶီႇၽီးတီးယႃး ဢၼ်လွတ်ႈလႅဝ်းထၢင်ႇႁၢင်ႈ ၼၼ်ႉမႃး
Documentation icon ၽိုၼ်ၵႅမ်မိုဝ်းမေႃႇၵျူး[သၢင်ႈ]
-- First, define a table of text to search for, and what to convert it to.

local conversionTable = {
   ['January'] = 'ၸၼ်ႇဝႃႇရီႇ',
   ['February'] = 'ၾႅပ်ႇဝႃႇရီႇ',
   ['March'] = 'မၢတ်ႉၶျ်',
   ['April'] = 'ဢေႇပရႄႇ',
   ['May'] = 'မေႇ',
   ['June'] = 'ၸုၼ်ႇ',
   ['July'] = 'ၸူႇလၢႆႇ',
   ['August'] = 'ဢေႃးၵၢတ်ႉ',
   ['September'] = 'သႅပ်ႇထႅမ်ႇပႃႇ',
   ['October'] = 'ဢွၵ်ႇထူဝ်ႇပႃႇ',
   ['November'] = 'ၼူဝ်ႇဝႅမ်ႇပႃႇ',
   ['December'] = 'တီႇသႅမ်ႇပႃႇ',

}

-- Then we define a table to hold our function
local p = {}

-- Then we define a function that converts strings using conversionTable.
function p.main(frame)
    local s = frame.args[1] -- This gets the first positional argument.
    for en, bn in pairs(conversionTable) do -- This converts every string found in the table.
        s = mw.ustring.gsub(s, en, bn)
    end
    return s -- Get the result of the function.
end

return p -- Pass our table containing our function back to Lua.
-- Now we can call our function using {{#invoke:ConvertDigit|main|<!-- your text here 

-->}}.