2,788
edits
TheNightAvl (talk | contribs) mNo edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
function export.show(frame) | function export.show(frame) | ||
local function sort_function(a, b) | local function sort_function(a, b) | ||
return a.name < b.name | return a.name < b.name | ||
end | end | ||
local tag_missing = {"rad", "lfv", "ryn"} | |||
local translations = {} | local translations = {} | ||
local title | local title | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local language = m_languages.get_by_code(args[1]) | |||
local title = args[2] or args["title"] or args["t"] | |||
if title then title = string.gsub(title, "%s+$", "") end | |||
for k, v in pairs(args) do | for k, v in pairs(args) do | ||
if | if type(k) == "string" and type(v) == "string" then | ||
local tr_language = m_languages.get_by_code(k) | |||
local | |||
local to_process = v | local to_process = v | ||
local bytext = "" | local bytext = "" | ||
Line 26: | Line 26: | ||
local translink = mw.ustring.match(to_process, "%*([^%*]+)%*") | local translink = mw.ustring.match(to_process, "%*([^%*]+)%*") | ||
to_process = mw.ustring.sub(to_process, mw.ustring.len(pre) + mw.ustring.len(translink) + 3) | to_process = mw.ustring.sub(to_process, mw.ustring.len(pre) + mw.ustring.len(translink) + 3) | ||
translink = m_links.full_link{term = translink, language = | translink = m_links.full_link{term = translink, language = tr_language, nobold = true} | ||
bytext = bytext .. pre .. translink | bytext = bytext .. pre .. translink | ||
else | else | ||
Line 33: | Line 33: | ||
end | end | ||
end | end | ||
table.insert(translations, {name = | table.insert(translations, {name = tr_language.name, display = tr_language.name .. ": " .. bytext}) | ||
end | end | ||
end | end | ||
Line 46: | Line 46: | ||
for _, n in ipairs(translations) do out = out .. '\n* ' .. n.display end | for _, n in ipairs(translations) do out = out .. '\n* ' .. n.display end | ||
out = out .. '\n|}' | out = out .. '\n|}' | ||
out = out .. '\n</div></div>' | out = out .. '\n</div></div>[[Category:' .. language.name .. ' terms with translations]]' | ||
for _, lang in ipairs(tag_missing) do | for _, lang in ipairs(tag_missing) do | ||
if args[lang] == nil then | if lang ~= language.code and args[lang] == nil then | ||
out = out .. "[[Category: | out = out .. "[[Category:" .. language.name .. " terms needing " .. m_languages.get_by_code(lang).name .. " translations]]" | ||
end | end | ||
end | end |