Module:Hindi frequency list

local export = {} local header = class="wikitable sortable" ! SN !! Frequency !! Word !! Transliteration local footer = |}

local lang = require "Module:languages".getByCode("hi") local function link_and_transliterate(word, lang_code, lang_name, script) local translit = (lang:transliterate(word)) return '' .. word .. ' ', '' .. translit .. ' ' end

function export.list(frame) local args = require "Module:table".shallowcopy(frame.args) local arg_group_size = 2 if #args % arg_group_size ~= 0 then error(("The number of arguments should be a multiple of %d, but is %d")			:format(arg_group_size, #args)) end local Array = require "Module:array" local output = Array output:insert(header) local i = 0 local trim = mw.text.trim for arg_i = 1, #args, arg_group_size do		i = i + 1 local frequency, hindi = unpack(args, arg_i, arg_i + arg_group_size - 1) frequency, hindi = trim(frequency), trim(hindi) local link, translit = link_and_transliterate(hindi, "Hindi", "hi", "Deva") output:insert(("|-\n| %s || %s || %s || %s\n"):format( i, frequency, link, translit)) end output:insert(footer) return output:concat end

return export