Module:Lang: Difference between revisions

no edit summary
(enable lang-xx promotion messaging;)
No edit summary
Line 30:
return not (var == nil or var == '');
end
 
 
--[[--------------------------< T O _ B O O L E A N >----------------------------------------------------------
 
Returns true for 'yes', false for 'no', and nil for any other value.
 
]]
 
Line 113 ⟶ 116:
each of lang, script, region, and variant, when used, must be valid
 
Languages with both two- and three-character code synonyms are promoted to the two-character synonym because
the IANA registry file omits the synonymous three-character code; we cannot depend on browsers understanding
the synonymous three-character codes in the lang= attribute.
 
For {{lang-xx}} templates, the parameters |script=, |region=, and |variant= are supported (not supported in {{lang}}
Line 493 ⟶ 500:
 
return code_subtag;
end
 
 
--[[--------------------------< R E N D E R _ M A I N T >------------------------------------------------------
 
render mainenance messages and categories
]]
 
local function render_maint()
local maint = {};
if 0 < #maint_msgs then
table.insert (outmaint, table.concat ({'<span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">'}));
for _, msg in ipairs (maint_msgs) do
table.insert (outmaint, table.concat ({msg, ' '}));
end
table.insert (outmaint, '</span>');
end
if (0 < #maint_cats) and (0 == namespace) and not is_set (args.nocat) then
for _, cat in ipairs (maint_cats) do
table.insert (outmaint, table.concat ({'[[Category:', cat, ']]'}));
end
end
return table.concat (maint);
end
 
Line 570 ⟶ 603:
table.insert (out, make_text_span (args.code, args.text, args.rtl, args.italic, args.size));
table.insert (out, make_category (code, language_name, args.nocat));
table.insert (out, render_maint()); -- maintenance messages and categories
if 0 < #maint_msgs then
 
table.insert (out, table.concat ({'<span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">'}));
for _, msg in ipairs (maint_msgs) do
table.insert (out, table.concat ({msg, ' '}));
end
table.insert (out, '</span>');
end
if (0 < #maint_cats) and (0 == namespace) and not is_set (args.nocat) then
for _, cat in ipairs (maint_cats) do
table.insert (out, table.concat ({'[[Category:', cat, ']]'}));
end
end
return table.concat (out); -- put it all together and done
end
Line 753 ⟶ 774:
table.insert (out, make_category (code, language_name, args.nocat));
table.insert (out, render_maint()); -- maintenance messages and categories
if 0 < #maint_msgs then
 
table.insert (out, table.concat ({'<span class="lang-comment" style="font-style:normal; display:none; color:#33aa33; margin-left:0.3em">'}));
for _, msg in ipairs (maint_msgs) do
table.insert (out, table.concat ({msg, ' '}));
end
table.insert (out, '</span>');
end
if (0 < #maint_cats) and (0 == namespace) and not is_set (args.nocat) then
for _, cat in ipairs (maint_cats) do
table.insert (out, table.concat ({'[[Category:', cat, ']]'}));
end
end
return table.concat (out); -- put it all together and done
end
Anonymous user