Module:En2bndigit
提供: VANGUARD FLIGHT wiki
Translates numbers, dates and months from English to Bengali language
-- 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 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:En2bndigit|main|<!-- your text here
-->}}.