Modul:translations

Üdvözlöm, Ön a Modul:translations szó jelentését keresi. A DICTIOUS-ban nem csak a Modul:translations szó összes szótári jelentését megtalálod, hanem megismerheted az etimológiáját, a jellemzőit és azt is, hogyan kell a Modul:translations szót egyes és többes számban mondani. Minden, amit a Modul:translations szóról tudni kell, itt található. A Modul:translations szó meghatározása segít abban, hogy pontosabban és helyesebben fogalmazz, amikor beszélsz vagy írsz. AModul:translations és más szavak definíciójának ismerete gazdagítja a szókincsedet, és több és jobb nyelvi forráshoz juttat.

This module is used for the translation templates {{t}} and {{t+}}. It contains a single function which is invoked by these templates. See their documentation for more information.


local m_links = require("Module:links")

local export = {}

local interwiki_langs = {
	 = "ku",
	 = "ku",
	 = "ku",
	 = "nds",
	 = "nds",
	 = "nds",
	 = "ku",
}

local ignore_caps = {
	 = true,
}

local tracked = {
	 = true,
}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	local params = {
		 = {required = true, default = "und"},
		 = {},
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local terminfo = {
		lang = require("Module:languages").getByCode(args) or require("Module:languages").err(args, 1),
		sc = (args and (require("Module:scripts").getByCode(args) or error("The script code \"" .. args .. "\" is not valid.")) or nil),
		term = args or (mw.title.getCurrentTitle().nsText == "Template" and "term") or nil,
		alt = args,
		id = args,
		genders = args,
		tr = args,
		ts = args,
		lit = args,
		interwiki = frame.args,
		}
	
	return export.show_terminfo(terminfo)
end

function export.show_terminfo(terminfo)	
	-- Translations must be for mainspace languages
	if terminfo.lang:getType() == "reconstructed" or terminfo.lang:getType() == "appendix-constructed" then
		error("Translations must be for attested and approved main-namespace languages.")
	end
	
	-- Don't show the interwiki link if there is nothing to link to.
	if terminfo.term then
		-- Track translations for particular languages
		if tracked then
			require("Module:debug").track("translations/" .. terminfo.lang:getCode())
		end
		
		local wmlangs = {}
		
		if interwiki_langs then
			wmlangs = {require("Module:wikimedia languages").getByCode(interwiki_langs)}
		else
			wmlangs = terminfo.lang:getWikimediaLanguages()
		end
		
		-- Don't show the interwiki link if the language is not recognised by Wikimedia
		-- or if the term contains links (for SOP translations)
		if terminfo.term:find("[[", nil, true) or #wmlangs == 0 then
			terminfo.interwiki = false
		end
		
		if wmlangs and ignore_caps:getCode()] then
			terminfo.term2 = mw.ustring.gsub(terminfo.term, "^%^", "")
		end
		
		if terminfo.interwiki then
			terminfo.interwiki =
				"<span class=\"" .. terminfo.interwiki .. "\">&nbsp;[[:" ..
				wmlangs:getCode() .. ":" ..
				terminfo.lang:makeEntryName(terminfo.term2 or terminfo.term) ..
				"|(" .. wmlangs:getCode() .. ")]]</span>"
		end
	else
		-- Track what entries currently don't provide a term
		require("Module:debug").track("translations/no term")
		require("Module:debug").track("translations/no term/" .. terminfo.lang:getCode())
	end
	
	if terminfo.lang and terminfo.lang:getCode() == 'yue' and terminfo.tr then
		terminfo.tr = mw.ustring.gsub(terminfo.tr, '()','<sup>%1</sup>')
	end
	
	return m_links.full_link(terminfo, "translation", true)
end

return export