Jump to content

Module:Lang

විකිපීඩියා වෙතින්
12:32, 31 ඔක්තෝබර් 2017 වන විට en>Trappist the monk (create;) විසින් සිදු කර ඇති සංශෝධන
(වෙනස) ← පැරණි සංශෝධනය | වත්මන් සංශෝධනය (වෙනස) | නව සංශෝධනය → (වෙනස)

--[[
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 &lrm; 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;
"https://si.wikipedia.org/w/index.php?title=Module:Lang&oldid=520066" වෙතින් සම්ප්‍රවේශනය කෙරිණි