"ماڈیول:translations" کے نسخوں کے درمیان فرق

حذف شدہ مندرجات اضافہ شدہ مندرجات
نیا صفحہ: local m_links = require("Module:links") local export = {} local interwiki_langs = { ["nds-de"] = "nds", ["nds-nl"] = "nds", ["pdt"] = "nds" } -- The main entry poi...
 
کوئی خلاصۂ ترمیم نہیں
 
سطر 4:
 
local interwiki_langs = {
["nds-deckb"] = "ndsku",
["nds-nlkmr"] = "ndsku",
["pdtlki"] = "ndsku" },
["nds-de"] = "nds",
["nds-nl"] = "nds",
["pdt"] = "nds",
["sdh"] = "ku",
}
 
local ignore_caps = {
["ko"] = true,
}
 
local tracked = {
["se"] = true,
}
 
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local argsparams = frame:getParent().args{
[1] = {required = true, default = "und"},
local interwiki = frame.args["interwiki"]
[2] = {},
[3] = {list = true},
NAMESPACE = mw.title.getCurrentTitle().nsText
["alt"] = {},
local categories = {}
["id"] = {},
["sc"] = {},
local lang = args[1] or (NAMESPACE == "Template" and "und") or error("Language code has not been specified. Please pass parameter 1 to the template.")
["tr"] = {},
local sc = args["sc"] or ""; if sc == "" then sc = nil end
["ts"] = {},
lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
["lit"] = {},
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
}
local term = args[2] or (NAMESPACE == "Template" and "term" or ""); if term == "" then term = nil end
local args = require("Module:parameters").process(frame:getParent().args, params)
local alt = args["alt"]; if alt == "" then alt = nil end
local terminfo = {
local tr = args["tr"]; if tr == "" then tr = nil end
lang = require("Module:languages").getByCode(args[1]) or require("Module:languages").err(args[1], 1),
sc = (args["sc"] and (require("Module:scripts").getByCode(args["sc"]) or error("The script code \"" .. args["sc"] .. "\" is not valid.")) or nil),
-- Gender and number
term = args[2] or (mw.title.getCurrentTitle().nsText == "Template" and "term") or nil,
-- Iterate over all numbered parameters starting from 3, until one is empty.
alt = args["alt"],
local genders = {}
id = args["id"],
local i = 3
local g genders = args[i3] or "",
tr = args["tr"],
ts = args["ts"],
while g ~= "" do
lit = args["lit"],
table.insert(genders, g)
interwiki = frame.args["interwiki"],
i = i + 1
}
g = args[i] or ""
end
return export.show_terminfo(terminfo)
end
-- Don't show the interwiki link if there is nothing to link to.
 
if term then
function export.show_terminfo(terminfo, no_check_redundant_translit)
local wmlangs = {}
-- Translations must be for mainspace languages
if terminfo.lang:getType() == "reconstructed" or terminfo.lang:getType() == "appendix-constructed" then
if interwiki_langs[lang:getCode()] then
error("Translations must be for attested and approved main-namespace languages.")
wmlangs = {require("Module:wikimedia languages").getByCode(interwiki_langs[lang:getCode()])}
else
wmlangs = 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 term:find("[[", nil, true) or #wmlangs == 0 then
interwiki = false
end
if interwiki then
interwiki = "<span class=\"" .. interwiki .. "\">&nbsp;[[:"
.. wmlangs[1]:getCode() .. ":"
.. lang:makeEntryName(term)
.. "|(" .. wmlangs[1]:getCode() .. ")]]</span>"
end
end
-- Don't show the interwiki link if there is nothing to link to.
if lang and lang:getCode()=='yue' and tr then
if terminfo.term then
tr = mw.ustring.gsub(tr,'([1-9])','<sup>%1</sup>')
-- Track translations for particular languages
tr = mw.ustring.gsub(tr,'[-*]','⁻')
if tracked[terminfo.lang:getCode()] then
require("Module:debug").track("translations/" .. terminfo.lang:getCode())
end
local wmlangs = {}
if interwiki_langs[terminfo.lang:getCode()] then
wmlangs = {require("Module:wikimedia languages").getByCode(interwiki_langs[terminfo.lang:getCode()])}
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[1] and ignore_caps[wmlangs[1]:getCode()] then
terminfo.term2 = mw.ustring.gsub(terminfo.term, "^%^", "")
end
if terminfo.interwiki then
terminfo.interwiki =
"<span class=\"" .. terminfo.interwiki .. "\">&nbsp;[[:" ..
wmlangs[1]:getCode() .. ":" ..
terminfo.lang:makeEntryName(terminfo.term2 or terminfo.term) ..
"|(" .. wmlangs[1]: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
-- languages needing superscripts in tr
need_super = {
["yue"] = true, ["gan"] = true, ["hak"] = true,
["cjy"] = true, ["nan"] = true, ["hsn"] = true,
}
if terminfo.lang and need_super[terminfo.lang:getCode()] and terminfo.tr then
terminfo.tr = mw.ustring.gsub(terminfo.tr, '([1-9]%-?[1-9]?)','<sup>%1</sup>')
end
return m_links.full_link(termterminfo, alt"translation", langtrue, sc, nil, nil, {interwiki = interwiki, tr = tr, genders = genders}, trueno_check_redundant_translit)
end