Modul:Cizojazyčně
Dokumentaci tohoto modulu lze vytvořit na stránce Nápověda:Modul:Cizojazyčně
-- @brief
-- Backend for {{Cizojazyčně}}.
--
-- @author
-- [[meta:User:Danny B.]]
local _module = {}
----------------------------------------
local Error = require( "Module:Error" )
local Language = require( "Module:Language" )
function _module.print( frame )
local output = ""
local parentFrame = frame:getParent()
local templateArgs = parentFrame.args
local errorData = { template = "Cizojazyčně" }
local lang = mw.text.trim( templateArgs["1"] or "" )
local langName = Language.getName( lang )
local dir = Language.getDirection( lang )
if not langName then
if lang == "" then
errorData.missingValue = { paramName = 1, paramDesc = "kód jazyka" }
else
errorData.unknownValue = { paramName = 1, paramDesc = "kód jazyka" }
end
output = output .. Error.getText( errorData )
end
if output == "" then
output = output .. "<span class=\"cizojazycne\" lang=\"" .. lang .. "\" xml:lang=\"" .. lang .. "\""
output = dir == "rtl" and output .. " dir=\"rtl\"" or output
output = output .. " title=\"" .. langName .. "\">" .. mw.text.trim( templateArgs["2"] or "" ) .. "</span>"
output = dir == "rtl" and output .. "‎" or output
end
output = frame:preprocess( output )
return output
end
----------------------------------------
return _module