Module:Wd/i18n
-- The values and functions in this submodule should be localized per wiki.
 
 local p = {}
 
 function p.init(aliasesP)
 	p = {
 		[&quot;errors&quot;] = {
 			[&quot;unknown-data-type&quot;]          = &quot;Unknown or unsupported datatype '$1'.&quot;,
 			[&quot;missing-required-parameter&quot;] = &quot;No required parameters defined, needing at least one&quot;,
 			[&quot;extra-required-parameter&quot;]   = &quot;Parameter '$1' must be defined as optional&quot;,
 			[&quot;no-function-specified&quot;]      = &quot;You must specify a function to call&quot;,  -- equal to the standard module error message
 			[&quot;main-called-twice&quot;]          = 'The function &quot;main&quot; cannot be called twice',
 			[&quot;no-such-function&quot;]           = 'The function &quot;$1&quot; does not exist',  -- equal to the standard module error message
             [&quot;malformed-reference&quot;]        = &quot;Error: Unable to display the reference properly. See [[Module:wd/doc#References|the documentation]] for details.&quot;
 		},
 		[&quot;info&quot;] = {
 			[&quot;edit-on-wikidata&quot;] = &quot;Edit this on Wikidata&quot;
 		},
 		[&quot;numeric&quot;] = {
 			[&quot;decimal-mark&quot;] = &quot;.&quot;,
 			[&quot;delimiter&quot;]    = &quot;,&quot;
 		},
 		[&quot;datetime&quot;] = {
 			[&quot;prefixes&quot;] = {
 				[&quot;decade-period&quot;] = &quot;&quot;
 			},
 			[&quot;suffixes&quot;] = {
 				[&quot;decade-period&quot;] = &quot;s&quot;,
 				[&quot;millennium&quot;]    = &quot; millennium&quot;,
 				[&quot;century&quot;]       = &quot; century&quot;,
 				[&quot;million-years&quot;] = &quot; million years&quot;,
 				[&quot;billion-years&quot;] = &quot; billion years&quot;,
 				[&quot;year&quot;]          = &quot; year&quot;,
 				[&quot;years&quot;]         = &quot; years&quot;
 			},
 			[&quot;julian-calendar&quot;] = &quot;Julian calendar&quot;,  -- linked page title
 			[&quot;julian&quot;]          = &quot;Julian&quot;,
 			[&quot;BCE&quot;]             = &quot;BCE&quot;,
 			[&quot;CE&quot;]              = &quot;CE&quot;,
 			[&quot;common-era&quot;]      = &quot;Common Era&quot;  -- linked page title
 		},
 		[&quot;coord&quot;] = {
 			[&quot;latitude-north&quot;] = &quot;N&quot;,
 			[&quot;latitude-south&quot;] = &quot;S&quot;,
 			[&quot;longitude-east&quot;] = &quot;E&quot;,
 			[&quot;longitude-west&quot;] = &quot;W&quot;,
 			[&quot;degrees&quot;]        = &quot;°&quot;,
 			[&quot;minutes&quot;]        = &quot;'&quot;,
 			[&quot;seconds&quot;]        = '&quot;',
 			[&quot;separator&quot;]      = &quot;, &quot;
 		},
 		[&quot;values&quot;] = {
 			[&quot;unknown&quot;] = &quot;unknown&quot;,
 			[&quot;none&quot;]    = &quot;none&quot;
 		},
 		[&quot;cite&quot;] = {
 			[&quot;version&quot;] = &quot;3&quot;,  -- increment this each time the below parameters are changed to avoid conflict errors
 			[&quot;web&quot;] = {
 				-- &lt;= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources
 				-- =&gt; right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. &quot;&quot;)
 				[aliasesP.statedIn]         = &quot;website&quot;,
 				[aliasesP.referenceURL]     = &quot;url&quot;,
 				[aliasesP.publicationDate]  = &quot;date&quot;,
 				[aliasesP.retrieved]        = &quot;access-date&quot;,
 				[aliasesP.title]            = &quot;title&quot;,
 				[aliasesP.archiveURL]       = &quot;archive-url&quot;,
 				[aliasesP.archiveDate]      = &quot;archive-date&quot;,
 				[aliasesP.language]         = &quot;language&quot;,
 				[aliasesP.author]           = &quot;author&quot;,  -- existence of author1, author2, author3, etc. is assumed
 				[aliasesP.authorNameString] = &quot;author&quot;,
 				[aliasesP.publisher]        = &quot;publisher&quot;,
 				[aliasesP.quote]            = &quot;quote&quot;,
 				[aliasesP.pages]            = &quot;pages&quot;  -- extra option
 			},
 			[&quot;q&quot;] = {
 				-- &lt;= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources
 				-- =&gt; right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. &quot;&quot;)
 				[aliasesP.statedIn]                = &quot;1&quot;,
 				[aliasesP.pages]                   = &quot;pages&quot;,
 				[aliasesP.column]                  = &quot;at&quot;,
 				[aliasesP.chapter]                 = &quot;chapter&quot;,
 				[aliasesP.sectionVerseOrParagraph] = &quot;section&quot;,
 				[&quot;external-id&quot;]                    = &quot;id&quot;,  -- used for any type of database property ID
 				[aliasesP.title]                   = &quot;title&quot;,
 				[aliasesP.publicationDate]         = &quot;date&quot;,
 				[aliasesP.retrieved]               = &quot;access-date&quot;
 			}
 		}
 	}
 
 	p.getOrdinalSuffix = function(num)
 		if tostring(num):sub(-2,-2) == '1' then
 			return &quot;th&quot;  -- 10th, 11th, 12th, 13th, ... 19th
 		end
 
 		num = tostring(num):sub(-1)
 
 		if num == '1' then
 			return &quot;st&quot;
 		elseif num == '2' then
 			return &quot;nd&quot;
 		elseif num == '3' then
 			return &quot;rd&quot;
 		else
 			return &quot;th&quot;
 		end
 	end
 
 	p.addDelimiters = function(n)
 		local left, num, right = string.match(n, &quot;^([^%d]*%d)(%d*)(.-)$&quot;)
 
 		if left and num and right then
 			return left .. (num:reverse():gsub(&quot;(%d%d%d)&quot;, &quot;%1&quot; .. p['numeric']['delimiter']):reverse()) .. right
 		else
 			return n
 		end
 	end
 
 	return p
 end