မေႃႇၵျူး:ConvertTime
Appearance
ၽိုၼ်ၵႅမ်မိုဝ်းမေႃႇၵျူး[သၢင်ႈ]
တွၼ်ႈတႃႇ Scribunto module ဢၼ်ၼႆႉ ၸဝ်ႈၵဝ်ႇ ၸၢင်ႈ သၢင်ႈ ၼႃႈလိၵ်ႈ ၼႆႉလႆႈယူႇၶႃႈ။ ၽူႈၸိူဝ်းမႄးထတ်းၶဝ် ၸၢင်ႈၸၢမ်းတူၺ်းလႆႈ ၸိူဝ်းပဵၼ်ၼႃႈလိၵ်ႈ sandbox (သၢင်ႈ | ငဝ်းမိူၼ်) လႄႈ testcases (သၢင်ႈ) ႁင်း မေႃႇၵျူးဢၼ်ၼႆႉ လႆႈယူႇၶႃႈ။ သႂ်ႇပိူင်ထၢၼ်ႈ ၵႃႈတီႈ ၼႃႈလိၵ်ႈၽႄ /doc လႄႈ။ ၼႃႈလိၵ်ႈၽႄ ႁင်း မေႃႇၵျူး ဢၼ်ၼႆႉ။. |
-- 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',
['႐'] = '0',
['႑'] = '1',
['႒'] = '2',
['႓'] = '3',
['႔'] = '4',
['႕'] = '5',
['႖'] = '6',
['႗'] = '7',
['႘'] = '8',
['႙'] = '9',
}
-- 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 bn, en in pairs(conversionTable) do -- This converts every string found in the table.
s = mw.ustring.gsub(s, bn, en)
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:ConvertTime|main|<!-- your text here -->}}.