Module:Lang links
From Neodyland Wiki
More actions
This documentation is transcluded from Module:Lang links/doc.
-- __ __ _ _ _ _ _ _
-- | \/ | ___ __| |_ _| | ___ _| | __ _ _ __ __ _ | (_)_ __ | | _____
-- | |\/| |/ _ \ / _` | | | | |/ _ (_) | / _` | '_ \ / _` | | | | '_ \| |/ / __|
-- | | | | (_) | (_| | |_| | | __/_| |__| (_| | | | | (_| | | | | | | | <\__ \
-- |_| |_|\___/ \__,_|\__,_|_|\___(_)_____\__,_|_| |_|\__, | |_|_|_| |_|_|\_\___/
-- |___/
require('strict') -- used for debugging purposes as it detects cases of unintended global variables
local p = {}
function p.lang_links(frame)
local title = frame.args[1]
-- This list was generated by collecting all the templates from
-- [[Category:Translated marker templates]] and [[Category:Translated license tags]]
-- and counting how many subtemplates from each language we have. This is top 70 list.
local list = {'af', 'als', 'ar', 'az', 'be', 'be-tarask', 'bg', 'bn', 'br', 'ca', 'cs',
'cy', 'da', 'de', 'diq', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fr', 'ga',
'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'it', 'ja', 'ka', 'ko', 'lb', 'lt', 'lv',
'mk', 'ml', 'mr', 'ms', 'mt', 'nb', 'nds', 'ne', 'nl', 'nn', 'pl', 'pt', 'pt-br',
'ro', 'ru', 'scn', 'sk', 'sk', 'sl', 'sq', 'sr', 'sv', 'ta', 'th', 'tl', 'tr', 'uk',
'ur', 'vi', 'zh', 'zh-hans', 'zh-hant'}
local output = {}
for _, lang in pairs( list ) do
local subpage = title .. '/' .. lang
if mw.title.new(subpage).exists then
local lname = mw.language.fetchLanguageName( lang, lang )
table.insert(output, '[[' .. subpage .. '|<bdi lang="'..lang..'">'.. lname..'</bdi>]]')
end
end
local subpage = title .. '/lang'
if mw.title.new(subpage).exists then
table.insert(output, '[[' .. subpage .. '|+/−]]')
end
list = table.concat(output, ' <b>∙</b> ')
return '<span class="plainlinks" style="font-size:small;line-height:1.4">'.. list.. '</span>'
end
return p