မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:category tree/poscatboiler/data/lang-specific

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:category tree/poscatboiler/data/lang-specific/doc

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

local langs_with_modules = {
	["ar"] = true,
	["az"] = true,
	["be"] = true,
	["bg"] = true,
	["de"] = true,
	["el"] = true,
	["es"] = true,
	["he"] = true,
	["ja"] = true,
	["la"] = true,
	["mt"] = true,
	["nl"] = true,
	["ru"] = true,
	["ryu"] = true,
	["sa"] = true,
	["uk"] = 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()
	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}}