"ମଡ୍ୟୁଲ:ConvertDigit" ପୃଷ୍ଠାର ସଂସ୍କରଣଗୁଡ଼ିକ ମଧ୍ୟରେ ତଫାତ
Content deleted Content added
ଟିକେNo edit summary ଟ୍ୟାଗ: Reverted |
ଟିକେ Jnanaranjan sahu (ଆଲୋଚନା)ଙ୍କ ଦେଇ କରାଯାଇଥିବା ବଦଳକୁ Snip1ଙ୍କ ଦେଇ କରାଯାଇଥିବା ଶେଷ ବଦଳକୁ ଫେରାଇ ଦିଆଗଲା ଟ୍ୟାଗ: Rollback |
||
୧ କ ଧାଡ଼ି: | ୧ କ ଧାଡ଼ି: | ||
-- First, define a table of text to search for, and what to convert it to. |
-- First, define a table of text to search for, and what to convert it to. |
||
local |
local convertDigitOnly = { |
||
['0'] = '୦', |
['0'] = '୦', |
||
['1'] = '୧', |
['1'] = '୧', |
||
୨୭ କ ଧାଡ଼ି: | ୨୭ କ ଧାଡ଼ି: | ||
} |
} |
||
local |
local conversionTable = { |
||
['January'] = 'ଜାନୁଆରୀ', |
['January'] = 'ଜାନୁଆରୀ', |
||
['February'] = 'ଫେବୃଆରୀ', |
['February'] = 'ଫେବୃଆରୀ', |
||
୬୮ କ ଧାଡ଼ି: | ୬୮ କ ଧାଡ଼ି: | ||
['9'] = '୯', |
['9'] = '୯', |
||
} |
} |
||
local function _main(input) |
|||
-- Then we define a table to hold our function |
|||
-- Callable from another module. |
|||
local p = {} |
|||
input = input or '' |
|||
return (input:gsub('%a+', en_months):gsub('%d', en_digits)) |
|||
-- define a function that converts english digits to Odia digits only nothing else. |
|||
⚫ | |||
local s = frame.args[1] -- This gets the first positional argument. |
|||
for en, odia in pairs(convertDigitOnly) do -- This converts every digit found in the table. |
|||
s = mw.ustring.gsub(s, en, odia) |
|||
end |
|||
return s -- Get the result of the function. |
|||
end |
end |
||
-- define a function that converts Odia digits to English digits only nothing else. |
|||
⚫ | |||
function p.Or2endigit(frame) |
|||
-- Callable from #invoke or from a template. |
|||
local s = frame.args[1] -- This gets the first positional argument. |
|||
return _main(frame.args[1] or frame:getParent().args[1]) |
|||
for en, odia in pairs(Odia2EngDigitOnly) do -- This converts every digit found in the table. |
|||
s = mw.ustring.gsub(s, en, odia) |
|||
end |
|||
return s -- Get the result of the function. |
|||
end |
end |
||
-- Then we define a function that converts strings using conversionTable. |
|||
return { main = main, _main = _main } |
|||
function p.main(frame) |
|||
local s = frame.args[1] -- This gets the first positional argument. |
|||
for en, odia in pairs(conversionTable) do -- This converts every string found in the table. |
|||
s = mw.ustring.gsub(s, en, odia) |
|||
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 |
|||
-->}}. |
୨୩:୫୭, ୨୪ ନଭେମ୍ବର ୨୦୨୦ ହୋଇଥିବା ରିଭିଜନ
ବ୍ୟବହାର[ସମ୍ପାଦନା]
{{#invoke:ConvertDigit|main|<!-- your text here -->}}
- ଉଦାହରଣ:
{{#invoke:ConvertDigit|En2ordigit|16:25, 3 April 2013 (UST)}}
ଲେଖିଲେ, ଦେଖାଯିବ "୧୬:୨୫, ୩ April ୨୦୧୩ (UST)"
- ଉଦାହରଣ:
{{#invoke:ConvertDigit|Or2endigit|୧୬:୨୫, ୩ April ୨୦୧୩ (UST)}}
ଲେଖିଲେ, ଦେଖାଯିବ "16:25, 3 April 2013 (UST)"
- ଉଦାହରଣ:
{{#invoke:ConvertDigit|main|16:25, 3 April 2013 (UST)}}
ଲେଖିଲେ, ଦେଖାଯିବ "୧୬:୨୫, ୩ ଅପ୍ରେଲ ୨୦୧୩ (UST)"
ଆହୁରି ଦେଖନ୍ତୁ[ସମ୍ପାଦନା]
ଏହି ମଡ୍ୟୁଲ ବ୍ୟବହାର ହେଇଛି[ସମ୍ପାଦନା]
- {{Or2endigit2}}
- {{En2ordigit2}}
ଏହି ମଡ୍ୟୁଲ ବ୍ୟବହାର ହେଇନାହିଁ[ସମ୍ପାଦନା]
- {{Or2endigit}}
- {{En2ordigit}}
-- First, define a table of text to search for, and what to convert it to.
local convertDigitOnly = {
['0'] = '୦',
['1'] = '୧',
['2'] = '୨',
['3'] = '୩',
['4'] = '୪',
['5'] = '୫',
['6'] = '୬',
['7'] = '୭',
['8'] = '୮',
['9'] = '୯',
}
local Odia2EngDigitOnly = {
['୦'] = '0',
['୧'] = '1',
['୨'] = '2',
['୩'] = '3',
['୪'] = '4',
['୫'] = '5',
['୬'] = '6',
['୭'] = '7',
['୮'] = '8',
['୯'] = '9',
}
local conversionTable = {
['January'] = 'ଜାନୁଆରୀ',
['February'] = 'ଫେବୃଆରୀ',
['March'] = 'ମାର୍ଚ୍ଚ',
['April'] = 'ଅପ୍ରେଲ',
['May'] = 'ମଇ',
['June'] = 'ଜୁନ',
['July'] = 'ଜୁଲାଇ',
['August'] = 'ଅଗଷ୍ଟ',
['September'] = 'ସେପ୍ଟେମ୍ବର',
['October'] = 'ଅକ୍ଟୋବର',
['November'] = 'ନଭେମ୍ବର',
['December'] = 'ଡିସେମ୍ବର',
['january'] = 'ଜାନୁଆରୀ',
['february'] = 'ଫେବୃଆରୀ',
['march'] = 'ମାର୍ଚ୍ଚ',
['april'] = 'ଅପ୍ରେଲ',
['may'] = 'ମଇ',
['june'] = 'ଜୁନ',
['july'] = 'ଜୁଲାଇ',
['august'] = 'ଅଗଷ୍ଟ',
['september'] = 'ସେପ୍ଟେମ୍ବର',
['october'] = 'ଅକ୍ଟୋବର',
['november'] = 'ନଭେମ୍ବର',
['december'] = 'ଡିସେମ୍ବର',
['mile'] = 'ମାଇଲ',
['miles'] = 'ମାଇଲ',
['kilometre'] = 'କିଲୋମିଟର',
['kilometres'] = 'କିଲୋମିଟର',
['km'] = 'କି.ମି.',
['0'] = '୦',
['1'] = '୧',
['2'] = '୨',
['3'] = '୩',
['4'] = '୪',
['5'] = '୫',
['6'] = '୬',
['7'] = '୭',
['8'] = '୮',
['9'] = '୯',
}
-- Then we define a table to hold our function
local p = {}
-- define a function that converts english digits to Odia digits only nothing else.
function p.En2ordigit(frame)
local s = frame.args[1] -- This gets the first positional argument.
for en, odia in pairs(convertDigitOnly) do -- This converts every digit found in the table.
s = mw.ustring.gsub(s, en, odia)
end
return s -- Get the result of the function.
end
-- define a function that converts Odia digits to English digits only nothing else.
function p.Or2endigit(frame)
local s = frame.args[1] -- This gets the first positional argument.
for en, odia in pairs(Odia2EngDigitOnly) do -- This converts every digit found in the table.
s = mw.ustring.gsub(s, en, odia)
end
return s -- Get the result of the function.
end
-- 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, odia in pairs(conversionTable) do -- This converts every string found in the table.
s = mw.ustring.gsub(s, en, odia)
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
-->}}.