模組:Category tree/poscatboiler/data/lang-specific/sandbox

維基詞典,自由的多語言詞典


-- This module contains language-specific labels and handlers.

local langs_with_modules = {
	["ja"] = true,
}


--------------------------- Generic driver handler ----------------------------

local function lang_specific_handler(data)
	if not data.lang then
		return nil
	end
	local langcode = data.lang:getCode()
	if not langs_with_modules[langcode] then
		return nil
	end
	local module = "Module:category tree/poscatboiler/data/lang-specific/" .. data.lang:getCode() .. "/sandbox"
	local labels_and_handlers = require(module)
	if labels_and_handlers.LABELS then
		local retval = labels_and_handlers.LABELS[data.label]
		if retval then
			if retval.umbrella == nil and retval.umbrella_parents == nil then
				retval.umbrella = false
			end
			retval.module = retval.module or module
			return retval
		end
	end
	if labels_and_handlers.HANDLERS then
		for _, handler in ipairs(labels_and_handlers.HANDLERS) do
			local retval, args_handled = handler(data)
			if retval then
				if retval.umbrella == nil and retval.umbrella_parents == nil then
					retval.umbrella = false
				end
				retval.module = retval.module or module
				return retval, args_handled
			end
		end
	end
end

return {LABELS = {}, HANDLERS = {lang_specific_handler}}