mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-23 23:13:27 +00:00
d2a37f5f69
The reason for this hook is not the validation itself, because that is already done by `GadgetDefinitionContent->isValid` which is part of the core Content interface, already enforced by ContentHandler. Instead, the hook was here to provide the custom interface message GadgetDefinitionValidator, because the core Content interface is limited to boolean isValid(), which provides a very generic error message. However, nowadays ContentHandler exposes this mechanism directly such that we can directly attach a custom message to it without needing to wait for the stack to reach the EditPage and then override it after the fact from a global hook. Also: * Simplify validation logic towards "is" checks with only an expected description. * Move schema.json file to top-level file. It has been unused for as long as it has been in the repo, despite appearing (due to its placement) to be used as part of the source. It was added, I believe, with the intent to be used by the validator, but it isn't. It also isn't validated or checked for correctness by anything right now. For now, keep it as informal schema in the top-level location for easy discovery where perhaps others can find a use for it. SD0001 mentions gadget developers may want to start using it for Git-maintained gadgets to help with validation in their IDE, after Gadgets 2.0 is launched. Test Plan: * Set `$wgGadgetsRepo = 'json+definition';` * Create `MediaWiki:Gadgets/example.json` * Attempt to save "x" in settings.namespaces item. * Attempt to save "x.zip" in module.pages item. * Fails with this patch, similar as on master. Bug: T31272 Change-Id: I61bc3e40348a0aeb3bd3fa9ca86ccb7b93304095
81 lines
9.2 KiB
JSON
81 lines
9.2 KiB
JSON
{
|
|
"@metadata": {
|
|
"authors": [
|
|
"Amire80",
|
|
"EugeneZelenko",
|
|
"Jon Harald Søby",
|
|
"Kghbln",
|
|
"Liuxinyu970226",
|
|
"Lloffiwr",
|
|
"Mormegil",
|
|
"Nike",
|
|
"Pikne",
|
|
"Purodha",
|
|
"Robby",
|
|
"SPQRobin",
|
|
"Shirayuki",
|
|
"Siebrand",
|
|
"The Evil IP address",
|
|
"Umherirrender"
|
|
]
|
|
},
|
|
"gadgets-desc": "{{desc|name=Gadgets|url=https://www.mediawiki.org/wiki/Extension:Gadgets}}",
|
|
"prefs-gadgets": "In Gadgets extension. The name of a tab in [[Special:Preferences#mw-prefsection-gadgets|Special:Preferences]] where user set their preferences for the extension.\n\n{{Identical|Gadgets}}",
|
|
"prefs-description-gadgets": "Used in [[Special:Preferences]] for mobile to describe the Gadgets features section.",
|
|
"gadgets-prefstext": "In Gadgets extension. This is the explanation text displayed under the Gadgets tab in [[Special:Preferences#mw-prefsection-gadgets|Special:Preferences]].",
|
|
"gadgets-prefstext-safemode": "In Gadgets extension. Shown under the Gadgets tab in [[Special:Preferences#mw-prefsection-gadgets|Special:Preferences]] when safe mode is enabled (thus gadgets are disabled).",
|
|
"special-gadgets": "{{doc-special|Gadgets}}\n{{Identical|Gadgets}}",
|
|
"gadgetusage": "{{doc-special|Gadget usage statistics}}",
|
|
"gadgetusage-gadget": "Table column header on [[Special:GadgetUsage]]\n{{Identical|Gadget}}",
|
|
"gadgetusage-usercount": "Table column header on [[Special:GadgetUsage]]",
|
|
"gadgetusage-noresults": "Message shown to user when no gadgets found installed on the wiki. Used on [[Special:GadgetUsage]]",
|
|
"gadgetusage-intro": "Intro text on [[Special:GadgetUsage]] Parameter:\n* $1 - the number of days to consider for defining a user as active",
|
|
"gadgetusage-intro-noactive": "Intro text on [[Special:GadgetUsage]]",
|
|
"gadgetusage-activeusers": "Table column header for active users using a gadget",
|
|
"gadgetusage-default": "Message to indicate the gadget is default and actual stats are not available\n{{Identical|Default}}",
|
|
"gadgets-definition": "{{notranslate}}",
|
|
"gadgets-title": "{{Identical|Gadgets}}",
|
|
"gadgets-pagetext": "Used as intro text in [[Special:Gadgets]].",
|
|
"gadgets-editdescription": "Link for editing the gadget description shown in Special:Preferences. Used on [[Special:Gadgets]].",
|
|
"gadgets-viewdescription": "Link for viewing the gadget description shown in Special:Preferences. Used on [[Special:Gadgets]] instead of {{msg-mw|Gadgets-editdescription}} when the user does not have permissions to edit.",
|
|
"gadgets-uses": "This is used as a verb in third-person singular. It appears in front of a script name. Example: \"''Uses: Gadget-UTCLiveClock.js''\"\n\nSee [[meta:Special:Gadgets|Gadgets page in meta.wikimedia.org]]\n{{Identical|Use}}",
|
|
"gadgets-required-rights": "Parameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-required-skins": "Parameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-required-actions": "{{doc-important|The difference here is between specifically one action and more than one action. In languages that use the singular form for numbers other than 1 (for example, for 21), use <nowiki>{{PLURAL:$2|1=}}</nowiki>.}}\nParameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-required-namespaces": "{{doc-important|The difference here is between specifically one namespace and more than one namespace. In languages that use the singular form for numbers other than 1 (for example, for 21), use <nowiki>{{PLURAL:$2|1=}}</nowiki>.}}\nParameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-required-categories": "{{doc-important|The difference here is between specifically one category and more than category. In languages that use the singular form for numbers other than 1 (for example, for 21), use <nowiki>{{PLURAL:$2|1=}}</nowiki>.}}\nParameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-required-contentmodels": "{{doc-important|The difference here is between specifically one content model and more than one content model. In languages that use the singular form for numbers other than 1 (for example, for 21), use <nowiki>{{PLURAL:$2|1=}}</nowiki>.}}\nParameters:\n* $1 - a comma-separated list.\n* $2 - the number of items in list $1 for PLURAL use.",
|
|
"gadgets-default": "Used in [[Special:Gadgets]], if the gadget is enabled for everyone by the Wiki's default settings.",
|
|
"gadgets-legacy": "Used on [[Special:Gadgets]], if the gadget contains legacy scripts and doesn't use ResourceLoader yet.",
|
|
"gadgets-packaged": "Used on [[Special:Gadgets]], if the gadget is [https://www.mediawiki.org/wiki/ResourceLoader/Package_files packaged]. Parameters:\n* $1 - script file which is the entry point",
|
|
"gadgets-export": "Used on [[Special:Gadgets]]. This is a verb, not noun.\n{{Identical|Export}}",
|
|
"gadgets-export-title": "Used as page title. Example: [[Special:Gadgets/export/editbuttons]]",
|
|
"gadgets-not-found": "Used as error message. Parameters:\n* $1 - gadget name",
|
|
"gadgets-export-text": "Used as page description in [[Special:Gadgets]].\n\nRefers to {{msg-mw|Gadgets-export-download}}.\n\nSee example: [[Special:Gadgets/export/editbuttons]]\n\nFollowed by the \"Export\" form.\n\nParameters:\n* $1 - gadget name\n* $2 - gadget definition (code)",
|
|
"gadgets-export-download": "Use the verb for this message. Submit button.\n{{Identical|Download}}",
|
|
"gadgets-requires-es6": "Message shown on [[Special:Gadgets]] for gadgets that only run on browsers that support ES6 (ES6 is a version of the JavaScript programming language).",
|
|
"gadgets-validate-notset": "Error message shown if a required property is not set. Parameters:\n* $1 - name of the property, e.g. settings.rights .",
|
|
"gadgets-validate-wrongtype": "Error message shown if a property is set to the wrong type. Parameters:\n* $1 - name of the property, e.g. <code>settings.rights</code> or <code>module.messages[3]</code>.\n* $2 - the expected JSON type for this property, e.g. <code>array</code> or <code>string</code>",
|
|
"gadgets-validate-json": "Warning message to indicate that JSON files cannot be used as they are only valid in package gadgets",
|
|
"gadgets-validate-es6default": "Warning message to indicate that gadget requiring ES6 cannot be default.",
|
|
"gadgets-validate-noentrypoint": "Warning message to indicate that package flag will be ignored as no script files are specified.",
|
|
"gadgets-validate-noscripts": "Warning message to indicate that scripts will be ignored as this is a styles gadget.",
|
|
"gadgets-validate-stylepeers": "Warning message to indicate that peers will be ignored as they are not allowed for styles gadgets.",
|
|
"gadgets-validate-scriptsnotallowed": "Warning message to indicate that scripts or data pages are not allowed for styles gadgets.",
|
|
"gadgets-validate-invalidjs": "Warning message to indicate that a script has invalid content model. Parameters:\n* $1 - page name, $2 - given content model",
|
|
"gadgets-validate-invalidcss": "Warning message to indicate that a stylesheet has invalid content model. Parameters:\n* $1 - page name, $2 - given content model",
|
|
"gadgets-validate-invalidjson": "Warning message to indicate that a data page has invalid content model. Parameters:\n* $1 - page name, $2 - given content model",
|
|
"gadgets-validate-nopeer": "Warning message to indicate that peer gadget does not exist. Parameters:\n* $1 - the peer gadget",
|
|
"gadgets-validate-invalidpeer": "Warning message to indicate that the peer gadget is not a styles-only gadget, so will be ignored. Parameters:\n* $1 - the peer gadget",
|
|
"gadgets-validate-invalidactions": "Warning message to indicate that the actions are not recognised. Parameters:\n* $1 - comma-separated list of invalid actions\n* $2 - number of items in list $1",
|
|
"gadgets-validate-invalidcontentmodels": "Warning message to indicate that the content models are not recognised. Parameters:\n* $1 - comma-separated list of invalid content models\n* $2 - number of items in list $1",
|
|
"gadgets-validate-invalidnamespaces": "Warning message to indicate that the namespaces are not recognised. Parameters:\n* $1 - comma-separated list of invalid namespaces\n* $2 - number of items in list $1",
|
|
"gadgets-validate-invalidskins": "Warning message to indicate that the skins are not recognised. Parameters:\n* $1 - comma-separated list of invalid skins\n* $2 - number of items in list $1",
|
|
"gadgets-validate-invalidrights": "Warning message to indicate that the rights are not recognised. Parameters:\n* $1 - comma-separated list of invalid rights\n* $2 - number of items in list $1",
|
|
"gadgets-validate-invalidtitle": "Warning message to indicate that the page title is invalid. Parameters:\n* $1 - page name",
|
|
"gadgets-validate-unknownpages": "Warning message to indicate that a gadget contains pages without .js, .css or .json suffix, which are not recognised.",
|
|
"gadgets-validate-duplicate": "Warning message to indicate that the second gadget definition with the same name would be ignored. Parameters:\n* $1 -gadget name",
|
|
"gadgets-validate-nopage": "Warning message to indicate the script/style/json page does not exist. Parameters:\n* $1 - page name",
|
|
"gadgets-supports-urlload": "Used in [[Special:Gadgets]], if the gadget supports ?withgadget query parameter."
|
|
}
|