--
local lang_obj = mw.language.getContentLanguage; -- make a language object for the local language; used here for languages and dates
----------------------------< S E T T I N G S >--------------------------------------------------------------
boolean settings used to control various things. these setting located here to make them easy to find
-- these settings local to this module onlylocal local_digits_from_mediawiki = false; -- for i18n; when true, module fills date_names['local_digits'] from MediaWiki; manual fill required else; always false at en.wikilocal local_date_names_from_mediawiki = false; -- for i18n; when true, module fills date_names['local']['long'] and date_names['local']['short'] from MediaWiki; -- manual translation required else; ; always false at en.wiki-- these settings exported to other moduleslocal use_identifier_redirects = true; -- when true use redirect name for identifier label links; always true at en.wikilocal local_lang_cat_enable = false; -- when true categorizes pages where |language=
--uncategorized_namespace_lister|all=
local uncategorized_namespaces_t = ; -- init with user namespace idfor k, _ in pairs (mw.site.talkNamespaces) do -- add all talk namespace ids uncategorized_namespaces_t[k] = true;end
local uncategorized_subpages = ; -- list of Lua patterns found in page names of pages we should not categorize
--2 template on a page in that namespace.
i18n: if this does not work well for your language, set
local name_space_sort_keys =
----------------------------< M E S S A G E S >--------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.This is separated from the main body to aid in future translations of thismodule.
local messages = templates have errors; messages may be hidden (help).'; -- $1 is template link ['warning_msg_m'] = '
One or more{}
templates have maintenance messages; messages may be hidden (help).'; -- $1 is template link }--CitationClass= in the cs1|2 templates to the canonical template name whenthe value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values areused as class attributes in the tag that encloses the citation so these names may not contain spaces whilethe canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to thetemplate's documentation when an article is displayed in preview mode. Most cs1|2 template |CitationClass= values at en.wiki match their canonical template names so are not listed here.
local citation_class_map_t =
--[=[-------------------------< E T _ A L _ P A T T E R N S >-------------------------------------------------- This table provides Lua patterns for the phrase "et al" and variants in name text (author, editor, etc.). The main module uses these to identify and emit the 'etal' message. ]=]
local et_al_patterns =
----------------------------< P R E S E N T A T I O N >------------------------
Fixed presentation markup. Originally part of citation_config.messages it hasbeen moved into its own, more semantically correct place.
local presentation =
----------------------------< A L I A S E S >---------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have beendefined in the Whitelist before they will be recognized as valid parameter names
local aliases =
----------------------------< P U N C T _ S K I P >---------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
local punct_meta_params =
local url_meta_params =
local function build_skip_table (skip_t, meta_params) for _, meta_param in ipairs (meta_params) do -- for each meta parameter key local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name if 'string'
local punct_skip = ;local url_skip = ;
----------------------------< S I N G L E - L E T T E R S E C O N D - L E V E L D O M A I N S >----------
this is a list of tlds that are known to have single-letter second-level domain names. This list does not includeccTLDs which are accepted in is_domain_name.
local single_letter_2nd_lvl_domains_t = ;
-------------< S P E C I A L C A S E T R A N S L A T I O N S >------------
This table is primarily here to support internationalization. Translations inthis table are used, for example, when an error message, category name, etc.,is extracted from the English alias key. There may be other cases wherethis translation table may be useful.
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191';local special_case_translation =--2 only supports generic seasons.EDTF does support the distinction between north and south hemisphere seasonsbut CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,Easter and Christmas are defined here as 98 and 99, which should be out of theISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean. When set to: true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']; this will unconditionally overwrite manual translations false – module will *not* fetch local month names from MediaWiki
Caveat lector: There is no guarantee that MediaWiki will provide short month names. At your wiki you can testthe results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted): =mw.dumpObject (p.date_names['local'])
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date namesfrom MediaWiki. Those must be translated manually.
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']; overwrites manual translations -- when true, module fetches long and short month names from MediaWikilocal date_names =
if local_date_names_from_mediawiki then -- if fetching local month names from MediaWiki is enabled local long_t = ; local short_t = ; for i=1, 12 do -- loop 12x and local name = lang_obj:formatDate('F', '2022-' .. i .. '-1'); -- get long month name for each i long_t[name] = i; -- save it name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i short_t[name] = i; -- save it end date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation date_names['local']['short'] = short_t; -- write the short table – overwrites manual translationend -- create inverted date-name tables for reformatting and/or translationfor _, invert_t in pairs do for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd endend
if local_digits_from_mediawiki then -- if fetching local digits from MediaWiki is enabled local digits_t = ; for i=0, 9 do -- loop 10x and digits_t [lang_obj:formatNum (i)] = tostring (i); -- format the loop indexer as local lang table index and assign loop indexer (a string) as the value end date_names['local_digits'] = digits_t;end
for ld, ed in pairs (date_names.local_digits) do -- make a digit translation table for simple date translation from en to local language using local_digits table date_names.xlate_digits [ed] = ld; -- en digit becomes index with local digit as the valueend
local df_template_patterns =