Vés al contingut

Mòdul:Wikidades/i18n/en

De la Viquipèdia, l'enciclopèdia lliure
Icona de documentació de mòdul Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]

Mòdul Wikidades/i18n (codi · ús · discussió · proves · tests · casos prova | subpàgines · enllaços)

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


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 precision 0 to 9, and a timestamp with ISO 8601 format for precision 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 according to PLURAL magic word. It can include up to six values for some languages, from version 20210517. See the documentation of PLURAL magic word in your language, i.e. at m:Help:Magic words#Language-dependent word conversions, mw:Help:Magic words#Localization or translatewiki:Plural/Mediawiki plural rules, more detailed in base rules from CLDR and additional rules for Mediawiki. For example, Slavic languages as Russian use nominative singular, genitive singular and genitive plural; Arabic language use: zero, one, two, few 3-10, many 11-99, other 100-102. 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 Plantilla:Ref-web (Q5637226) and Plantilla:Ref-publicació (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 editing interface. See also parameter editicon in main module. It is false by default. 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/en/ús 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.
  • Variable i18n["categoryref"]: category title populated with pages that use references from Wikidata. By default, it is void with no categorization. This is used from version 20210304.
  • Table i18n["addfallback"] for additional fallback language codes added to default fallbacks defined in MediaWiki for the local language. Wikidata's 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 i18n["suppressids"]: list of Qids, comma separated, with values to be suppressed. For example, {'Q22282939'} will suppress Contingut no lingüístic (Q22282939) in all queries. By default, it is an empty table {}. Statement definition «no value» is not any Qid, for this case see parameter shownovalue.
  • Variable i18n["qidlabels"]: (true/false) shows labels with numerical identifier Qid if no translation is found in local language or fallback languages. True by default, false optional.
  • 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 abbreviation.
    • case=location adds a referent to a location or administrative unit, generally the state subject to local wiki fixes. In particular, case=locationcontext avoids any anachronistic reference according to a context date. Learn more at Module:Location/en
    • Genitive, plural and ordinal are examples or other potential grammatical cases that are language dependent. 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.

-- 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"] = {"", ""},		-- year(s) old, as in {{PLURAL:$1|singular|plural}}
	-- two values for most languages, up to six values for some languages
	-- see documentation of PLURAL magic word in your language, examples:
	-- ["years-old"] = {"year old", "years old"} in English
	-- ["years-old"] = {"singular", "paucal", "plural"} in Russian and other Slavic languages
	-- ["years-old"] = {"zero", "one", "two", "few 3-10", "many 11-99", "other 100-102"} in Arabic
	
	["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)
	["categoryref"] = "", -- Category:Pages with references from Wikidata (void for no local category)
	["addfallback"] = {}, -- additional fallback language codes, i.e. {'sv', 'de'}
	["suppressids"] = {}, -- list of Qid values to suppress, i.e. {'Q22282939'} for no linguistic content
	["qidlabels"] = true -- show labels as Qid if no fallback translation is available (true or false)
}

-- 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
}