跳至內容

bacu-saupu:lan

makayzaay i Wikipitiya

可在bacu-saupu:lan/doc建立此模組的說明文件

local l = {}

l.fallbackList = {
	 ['zh']={'zh','zh-hant','zh-tw','zh-hk','zh-mo','zh-hans','zh-cn','zh-sg','zh-my'},
	 ['zh-hans']={'zh-hans','zh-cn','zh-sg','zh-my','zh'},
	 ['zh-cn']={'zh-cn','zh-hans','zh-my','zh-sg','zh'},
	 ['zh-sg']={'zh-sg','zh-hans','zh-cn','zh-my','zh'},
	 ['zh-my']={'zh-my','zh-hans','zh-cn','zh-sg','zh'},
	 ['zh-hant']={'zh-hant','zh-tw','zh-hk','zh-mo','zh'},
	 ['zh-tw']={'zh-tw','zh-hant','zh-hk','zh-mo','zh'},
	 ['zh-hk']={'zh-hk','zh-hant','zh-tw','zh-mo','zh'},
	 ['zh-mo']={'zh-mo','zh-hant','zh-tw','zh-hk','zh'}
}

function l._main(args)
	local frame = mw.getCurrentFrame()
	local userlanguage = frame:callParserFunction{ name = 'int', args = {'Conversionname'} }
--	local fallback = l.fallbackList[userlanguage]
--	if (not fallback) then
		local fallback = l.fallbackList['zh']
--	end
	for _,langArgName in ipairs(fallback)  do
		if args[langArgName] ~= nil then
			return args[langArgName]
		end
	end
	return ''
end

function l.main(frame)
	local getArgs
	local args
	if not getArgs then
		getArgs = require('Module:Arguments').getArgs
	end
	args = getArgs(frame, {parentFirst=true})
	return l._main(args)
end

return l