Module:Wikidades/i18n

Lua
CodeDiscussionLinksLink count SubpagesDocumentationTestsResultsSandboxLive code All modules


Page for translation in local language and settings for local wiki used by Module:Wikidades. It includes:

  • Table i18n["errors"] for translations of messages.
  • Table i18n["datetime"] for default settings of date formats in local language. For each precision it accepts either:
    Input value is a number for precisions 0 to 9, and a timestamp with ISO 8601 format for precisions 10 and 11 (i.ex. +1582-10-04T00:00:00Z)
    • Table i18n["datetime"]["hms"] for abbreviated hours, minutes and seconds, as in 1h 23m 45shms. It is used with formatting=durationhms.
  • Table i18n["years-old"] for singular and plural expression for age, as 'year old' and 'years old', used by function yearsOld. It can include a thirth form for paucal number used in Slavic languages as Russian: nominative singular as singular, genitive plural as plural and genitive singular as paucal (see parser function PLURAL at mw:Help:Magic words#Localization). Default output format is "$1 ["years-old"]". Table values can include a pattern for formatting, i.e. "($1 years old)". This is used from version 20191204.
  • Table i18n["cite"] with parameter names of local templates Template:Cite web (Q5637226) and Template:Cite journal (Q5624899). Those templates are used with option references= of function claim.
  • Variable i18n["addpencil"] (true/false) habilitates the pencil icon linked to corresponding Wikidata statement. Planned to overwrite by mw:Wikidata Bridge with a pop-up editting interface. See also parameter editicon in main module. By default it is false. This is used from version 20200129. If enabled with templates using prior versions of the module, check first that templates are not broken. See Module:Wikidata/addpencil/doc for some tips.
  • Variable i18n["categorylabels"]: category title populated with pages that have labels not found in the local language. By default it is void with no categorization. This is used from version 20200210.
  • Variable i18n["categoryprop"]: tracking categories of pages by property used. Value $1 is the Pid used. If void then no category is added. This is used from version 20200810.
  • Table i18n["addfallback"] for additional fallback language codes added to default fallbacks defined in MediaWiki for the local language. Wikidata labels are fetched by default in local language, its default fallback languages and the additional ones. Check default fallback languages defined in MediaWiki previewing {{#invoke:Wikidades/debug|getFallbacks|<code>}}. Please, avoid duplicating language codes. By default it is an empty table {}. This is used from version 20200303.
  • Table cases for changes in labels needed in local wiki. See parameter case= of function claim. General purpose cases are:
    • case=infoboxlabel fix labels in local language to a more suitable form for an infobox (label parameter of infobox template). This is defined at Module:Wikidades/labels with function fixInfoboxLabel or table infoboxlabels.
    • case=infoboxdata fix label values in local language to a more suitable form for an infobox (data parameter of infobox template). This is defined at Module:Wikidades/labels with function fixInfoboxData or table infoboxdata. For example it can be used for a short alias or abbreviattion.
    Genitive, plural and ordinal are examples or other potential grammatical cases that are language dependant. They can be defined here with a simple function or a more complex function calling another module. If necessary ask for help at ca:Module talk:Wikidades.

Code

-- copied from cawiki master. ver:20200822

-- Translate and set up for your language

-- Please contact [[:ca:Module talk:Wikidades]] if you need any help

local i18n = {
	["errors"] = {
		["property-not-found"] = "Property not found.",
		["qualifier-not-found"] = "Qualifier not found.",
	},
	["datetime"] =
	{
		-- $1 is a placeholder for the actual number, or use the format of #time parser function
		["beforenow"] = "$1 BCE",	-- how to format negative numbers for precisions 0 to 5
		["afternow"] = "$1 CE",		-- how to format positive numbers for precisions 0 to 5
		["bc"] = '$1 "BCE"',		-- how print negative years
		["ad"] = "$1",				-- how print 1st century AD dates
		
		[0] = "$1 billion years",	-- precision: billion years
		[1] = "$100 million years",	-- precision: hundred million years
		[2] = "$10 million years",	-- precision: ten million years
		[3] = "$1 million years",	-- precision: million years
		[4] = "$100000 years",		-- precision: hundred thousand years; thousand separators added afterwards
		[5] = "$10000 years",		-- precision: ten thousand years; thousand separators added afterwards
		[6] = "$1 millennium",		-- precision: millennium
		[7] = "$1 century",			-- precision: century
		[8] = "$1s",				-- precision: decade
		[9] = "Y",					-- precision: year, 
		[10] = "F Y",				-- precision: month
		[11] = "F j, Y",			-- precision: day
		
		["hms"] = {["hours"] = "h", ["minutes"] = "m", ["seconds"] = "s"},	-- duration: xh xm xs
	},
	
	["years-old"] = {
		["singular"] = "year old",	-- year old, as in {{PLURAL:$1|singular|plural}}
		["plural"] = "years old",	-- years old
		["paucal"] = "",			-- for languages with 3 plural forms as in {{PLURAL:$1|singular|paucal|plural}}
	},
	
	["cite"] = {					-- cite parameters of local templates
		["title"] = "title",
		["author"] = "author",
		["date"] = "date",
		["pages"] = "pages",
		["language"] = "language",
		-- cite web parameters
		["url"] = "url",
		["website"] = "website",
		["access-date"] = "access-date",
		["archive-url"] = "archive-url",
		["archive-date"] = "archive-date",
		["publisher"] = "publisher",
		["quote"] = "quote",
		-- cite journal parameters
		["work"] = "work",
		["issue"] = "issue",
		["issn"] = "issn",
		["doi"] = "doi"
	},
	
	-- local wiki settings
	["addpencil"] = true, -- adds a pencil icon linked to Wikidata statement, planned to overwrite by Wikidata Bridge
	["categorylabels"] = "", -- Category:Pages with Wikidata labels not translated (void for no local category)
	["categoryprop"] = "", -- Category:Pages using Wikidata property $1 (void for no local category)
	["addfallback"] = {} -- additional fallback language codes, i.e. {'sv', 'de'}
}

-- Functions for local grammatical cases (as ordinal) and local fixes (if used)
local cases = {
	-- local fixes
	-- ["infoboxlabel"] = function(word) return require("Module:Wikidades/labels").fixInfoboxLabel(word) end,
	-- ["infoboxdata"] = function(word) return require("Module:Wikidades/labels").fixInfoboxData(word) end,
	-- other local cases
}

return {
	i18n = i18n,
	cases = cases
}