Module:Multilingual description

local p = {}

function mld(pargs) local frame = mw.getCurrentFrame local sorting = require('Module:Multilingual description/sort') local processed = {} local ret = {} local addDesc = function(langcode, val) table.insert( ret, frame:expandTemplate{ title = 'ls', args = { langcode, val, classes = 'description' } } ) end for k, v in pairs( sorting ) do		if pargs[v] then addDesc(v, pargs[v]) end processed[v] = 1 end

for k, v in pairs( pargs ) do		if not processed[k] and type(k) == 'string' and mw.language.isSupportedLanguage(k) then addDesc(k, v)		end end

return table.concat(ret) end

function p.mld(frame) local pargs = ( frame:getParent or {} ).args or {}

return mld(pargs) end

--function p.runTests --local expected = '' --local input = { ['fr'] = 'Leipzig est', ['en'] = 'Leipzig is', ['hsb'] = 'Lipsk je', ['de'] = 'Leipzig ist', ['oc'] = 'Leipzig es' } --return mld(input) == expected --end

return p