Module:Name in various languages
Appearance
| This module is rated as alpha. It is ready for limited use and third-party feedback. It may be used on a small number of pages, but should be monitored closely. Suggestions for new features or adjustments to input and output are welcome. |
Usage
{{#invoke:Name in various languages|main}}
This module implements {{Name in various languages}}, a Lua-based replacement for {{Name in official languages}}.
Example
| Names of the European Union | |
|---|---|
| Italian | Unione europea |
| French | Union européenne |
| Estonian | Euroopa Liit |
| Dutch | Europese Unie |
| Czech | Evropská unie |
| German | Europäische Union |
| Portuguese | União Europeia |
| Irish | An tAontas Eorpach |
| Latvian | Eiropas Savienība |
| Bulgarian | Европейски съюз |
| Danish | Den Europæiske Union |
| Romanian | Uniunea Europeană |
| Croatian | Europska unija |
| Lithuanian | Europos Sąjunga |
| Slovak | Európska únia |
| Swedish | Europeiska unionen |
| Polish | Unia Europejska |
| Spanish | Unión Europea |
| Hungarian | Európai Unió |
| Finnish | Euroopan unioni |
| English | European Union |
| Maltese | Unjoni Ewropea |
| Greek | Ευρωπαϊκή Ένωση |
| Slovene | Evropska unija |
local lang_mod = require ('Module:Lang');
local get_args = require ('Module:Arguments').getArgs;
local p = {};
local SEPARATOR = '|- style="border-bottom:1px solid #aaa"\n';
local STYLE = "border-bottom:1px solid #aaa";
local function make_table_start(width, font_size, name)
return '{| class="mw-collapsible mw-collapsed" style="width:'..width..';'..
'font-size:' .. font_size .. '; text-align:left; border-collapse:collapse;'..'\n'..
'! colspan=2 style="text-align:center; border-top: 0px;" | '..name..'\n';
end
local function make_language_row(frame, lang_code, lang_text)
local lang_link_wikilink = lang_mod.name_from_tag({lang_code, ['link'] = 'yes'})
return "! style=\"padding-left:0.5em\" | "..lang_link_wikilink..
"\n| "..frame:expandTemplate{title='lang',args={lang_code, lang_text}};
end
function p.main(frame)
local args = get_args(frame)
local output = '';
output = output .. make_table_start(
args.width,
args.font_size,
args.name) .. SEPARATOR;
for k,v in pairs(args) do
if lang_mod._is_ietf_tag(k) then
output = output .. make_language_row(frame,k,v) .. '\n' .. SEPARATOR;
end
end
output = output .. '|}';
return output;
end
return p