Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Multilingual description: Difference between revisions

From Neodyland Wiki
test
 
m mimic logic of Template:Mld + allowing all supported language codes
Line 3: Line 3:
function p.mld(frame)
function p.mld(frame)
local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}
local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}
local sorting = require('Module:Multilingual description/sort')
local processed = {}
local ret = {}
local ret = {}
for k, v in pairs( sorting ) do
if pargs[v] then
table.insert(ret, '{{ls|' .. v .. '|' .. pargs[v] .. '|classes=description}}')
end
processed[v] = 1
end
for k, v in pairs( pargs ) do
for k, v in pairs( pargs ) do
if mw.language.isSupportedLanguage(k) or (k == 'simple') then
if not processed[k] and mw.language.isSupportedLanguage(k) then
table.insert(ret, '{{ls|' .. k .. '|' .. v .. '|classes=description}}')
table.insert(ret, '{{ls|' .. k .. '|' .. v .. '|classes=description}}')
end
end
end
end
return frame:preprocess(table.concat(ret))
return frame:preprocess(table.concat(ret))
end
end


return p
return p

Revision as of 22:11, 27 February 2014

Module documentation[ create · purge ]
local p = {}

function p.mld(frame)
	local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}
	local sorting = require('Module:Multilingual description/sort')
	local processed = {}
	local ret = {}
	
	for k, v in pairs( sorting ) do
		if pargs[v] then
			table.insert(ret, '{{ls|' .. v .. '|' .. pargs[v] .. '|classes=description}}')
		end
		processed[v] = 1
	end

	for k, v in pairs( pargs ) do
		if not processed[k] and mw.language.isSupportedLanguage(k) then
			table.insert(ret, '{{ls|' .. k .. '|' .. v .. '|classes=description}}')
		end
	end

	return frame:preprocess(table.concat(ret))
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.