Module:Lang
From Vigyanwiki
Documentation for this module may be created at Module:Lang/doc
--[[
This is an experiment to see what is required to consolodate all of the myriad {{lang-xx}} templates
and their subtemplates into a single module with a data table
]]
require('Module:No globals');
local getArgs = require('Module:Arguments').getArgs;
local p = {};
--[=[-------------------------< L A N G >----------------------------------------------------------------------
{{lang-es}} has parameters:
{{{1}}} text - required
{{{link}}} or {{{links}}} defaults to 'yes'
{{{lit}}} literal translation
{{language with name}} has parameters:
{{{1}}} iso language code - required
{{{2}}} language name in English - superfluous?
{{{3}}} text - required
{{{4}}} or {{{lit}}} literal translation
{{{link}}} or {{{links}}} set to 'no' disables '{{{2}} language' wikilinks
{{{rtl}}} passed through to {{lang}}
{{{nocat}}} passed through to {{lang}}
{{lang}} has parameters:
{{{1}}} iso language code - required
{{{2}}} text - required
{{{rtl}}} if set to any value, set dir="rtl" attribute and inserts ‎ after the </span> tag
{{{nocat}}} if set to any value, disables categorization
How it works now:
1. {{lang-es}} receives text as {{{1}}} to which it adds italic markup, sets |links to {{{link}}} or {{{links}}} or yes, sets |lit to {{{lit}}}, and calls {{language with name}}. {{{rtl}}} ignored for this example
2. {{language with name}} renders [[Spanish language|Spanish]] ({{{links}}} not set) or Spanish ({{{links}}} set) and calls {{lang}}
3. {{lang}} wraps the text in the <span lang="es">text</span> and adds categorization
]=]
function p.Lang (frame)
local args = getArgs(frame);
end
return p;