Module:Lang

From Zoophilia Wiki
Revision as of 12:32, 31 October 2017 by meta>Trappist the monk (create;)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This module exists primarily to provide correct html markup for non-English language text where that text is used in the English Wikipedia. It has a secondary purpose of providing correct visual rendering for this non-English text. The module was developed to consolidate processing for {{Lang}}, the {{lang-??}} (most), and {{Transl}} templates into a single source and to use a clearly defined data set extracted from international standards. It provides error checking and reporting to ensure that the html rendered is correct for browsers and screen readers.

Other templates that get language name support from this module are:

Data set

The data set is specified in Module:Language/name/data and its included data modules:

The data set also includes supplementary data modules:

Error messages and categorization

Mainspace articles that have errors are placed in appropriate error categories:

Maintenance categories:

See also

MoS on foreign words:


--[[
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;