Modül:çeviriler
local m_links = require("Modül:bağlantılar")
local export = {}
local interwiki_langs = { ["nds-de"] = "nds", ["nds-nl"] = "nds", ["pdt"] = "nds", }
local ignore_caps = { ["ko"] = true, }
-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame)
local params = {
[1] = {required = true, default = "und"}, [2] = {}, [3] = {list = true}, ["alt"] = {}, ["id"] = {}, ["sc"] = {}, ["tr"] = {}, ["lit"] = {}, }
local args = require("Modül:parameters").process(frame:getParent().args, params) local terminfo = { lang = require("Modül:diller").getirKodaGore(args[1]) or require("Modül:diller").err(args[1], 1), sc = (args["sc"] and (require("Modül:alfabeler").getirKodaGore(args["sc"]) or error("Girdiğiniz \"" .. args["sc"] .. "\" dil kodu bulunamıyor.")) or nil), term = args[2] or (mw.title.getCurrentTitle().nsText == "Şablon" and "term") or nil, alt = args["alt"], id = args["id"], genders = args[3], tr = args["tr"], lit = args["lit"], interwiki = frame.args["interwiki"], }
-- Translations must be for mainspace languages if terminfo.lang:getirTip() == "reconstructed" or terminfo.lang:getirTip() == "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
local wmlangs = {}
if interwiki_langs[terminfo.lang:getirKod()] then
wmlangs = {require("Modül:vikimedya dilleri").getByCode(interwiki_langs[terminfo.lang:getirKod()])}
else
wmlangs = terminfo.lang:getirVikimedyaDilleri()
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[1] and ignore_caps[wmlangs[1]:getCode()] then
terminfo.term2 = mw.ustring.gsub(terminfo.term, "^%^", "")
end
if terminfo.interwiki then
terminfo.interwiki =
" [[:" ..
wmlangs[1]:getCode() .. ":" ..
terminfo.lang:yapGirdiAdi(terminfo.term2 or terminfo.term) ..
"|(" .. wmlangs[1]:getCode() .. ")]]"
end
end
if terminfo.lang and terminfo.lang:getirKod() == 'yue' and terminfo.tr then terminfo.tr = mw.ustring.gsub(terminfo.tr, '([1-9-])','%1') end
return m_links.full_link(terminfo, "translation", true)
end
return export