Module:Lang links: Difference between revisions
From Neodyland Wiki
More actions
←Created page with ' -- __ __ _ _ _ _ _ _ -- | \/ | ___ __| |_ _| | ___ _| | __ _ _ __ __ _ | (_)_ __ | | _____ -- | |\/| |/ _ \ / _` | | | | |/ _ (_) | / _` | '_ \ / _` | | | | '_ \| |/ / __| -- | | | | (_) | (_| | |_| | | __/_| |__| (_| | | | | (_| | | | | | | | <\__ \ -- |_| |_|\___/ \__,_|\__,_|_|\___(_)_____\__,_|_| |_|\__, | |_|_|_| |_|_|\_\___/...' |
No edit summary |
||
| Line 11: | Line 11: | ||
function p.lang_links(frame) | function p.lang_links(frame) | ||
local title = frame.args[1] | local title = frame.args[1] | ||
-- This list was generated by collecting all the templates from | -- This list was generated by collecting all the templates from | ||
-- [[Category:Translated marker templates]] and [[Category:Translated license tags]] | -- [[Category:Translated marker templates]] and [[Category:Translated license tags]] | ||
| Line 21: | Line 20: | ||
'nb', 'nds', 'nl', 'pl', 'pt', 'pt-br', 'ro', 'ru', 'scn', 'sk', | 'nb', 'nds', 'nl', 'pl', 'pt', 'pt-br', 'ro', 'ru', 'scn', 'sk', | ||
'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi', 'zh', 'zh-hans', 'zh-hant'} | 'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi', 'zh', 'zh-hans', 'zh-hant'} | ||
local output = {} | local output = {} | ||
for _, lang in pairs( list ) do | for _, lang in pairs( list ) do | ||
local subpage = title .. '/' .. lang | local subpage = title .. '/' .. lang | ||
if mw.title.new(subpage).exists then | if mw.title.new(subpage).exists then | ||
table.insert(output, '[[' .. subpage .. '|<bdi lang="'..lang..'">'.. | local lname = mw.language.fetchLanguageName( lang, lang ) | ||
table.insert(output, '[[' .. subpage .. '|<bdi lang="'..lang..'">'.. lname..'</bdi>]]') | |||
end | end | ||
end | end | ||
Revision as of 04:55, 24 January 2024
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 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 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
return table.concat(output, ' <b>∙</b> ')
end
return p