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]
local user_lang = frame:callParserFunction("int","lang") -- get user's chosen language
-- 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 50 list.
local list = {'ar', 'be-tarask', 'bg', 'bn', 'ca', 'cs', 'da', 'de',
'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fr', 'gl', 'he',
'hi', 'hr', 'hu', 'hy', 'id', 'it', 'ja', 'ko', 'mk', 'ml', 'ms',
'nb', 'nds', 'nl', 'pl', 'pt', 'pt-br', 'ro', 'ru', 'scn', 'sk',
'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi', 'zh', 'zh-hans', 'zh-hant'}
local langName = mw.language.fetchLanguageNames( user_lang )
local output = {}
for _, lang in pairs( list ) do
local subpage = title .. '/' .. lang
if mw.title.new(subpage).exists then
table.insert(output, '[[' .. subpage .. '|<bdi lang="'..lang..'">'.. langName[lang]..'</bdi>]]')
end
end
return table.concat(output, ' <b>∙</b> ')
end
return p