Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316535

Change subject: Introduce missing "not-a-language" error message
......................................................................

Introduce missing "not-a-language" error message

Trivial to test on monolingual values.

This message is also used in TermValidatorFactory, which is used in
ChangeOpLabel and so on, which is used in FingerprintChangeOpFactory,
which is used in all kinds of special pages. But these special pages
all have a dedicated check and error message for invalid language codes:
"wikibase-wikibaserepopage-invalid-langcode". This makes
"wikibase-validator-not-a-language" a fallback that's currently not
seen by the user (except for monolingual, see above).

Change-Id: Iede9569575ac57a89663d10c3aa53671000443e7
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/ValidatorBuilders.php
3 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/35/316535/1

diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 177580b..fe89660 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -121,6 +121,7 @@
        "wikibase-validator-label-with-description-conflict": "Item $3 already 
has label \"$1\" associated with language code $2, using the same description 
text.",
        "wikibase-validator-label-no-entityid": "The label must not be a valid 
entity ID.",
        "wikibase-validator-no-such-media": "The file \"$1\" does not exist on 
[https://commons.wikimedia.org/ Wikimedia Commons].",
+       "wikibase-validator-not-a-language": "\"$1\" is not a known language 
code.",
        "wikibase-itemlink": "$1 $2",
        "wikibase-itemlink-id-wrapper": "($1)",
        "wikibase-itemlink-userlang-wrapper": " ($1: $2)",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 2e4151b..77f6f24 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -152,12 +152,13 @@
        "wikibase-validator-label-with-description-conflict": "Error message 
shown when a user tries to save an item that has a non-unique label+description 
pair.\n\nParameters:\n* $1 - label text\n* $2 - the label's language code\n* $3 
- the id of the item that already has the label and the description\nSee 
also:\n* {{msg-mw|Wikibase-validator-label-conflict}}",
        "wikibase-validator-label-no-entityid": "Error message shown when a 
user tries to save an item that has a valid entity id as label. Parameters:\n* 
$1 is the label.",
        "wikibase-validator-no-such-media": "Error message shown when a user 
tries to add a link to a Wikimedia Commons media file which does not exist. 
Parameters:\n* $1 is the name of the file.",
+       "wikibase-validator-not-a-language": "Validation error message shown 
when a user tries to use a language code that is not known to the system.\n* $1 
- the invalid language code\nSee also:\n* 
{{msg-mw|wikibase-wikibaserepopage-invalid-langcode}}",
        "wikibase-itemlink": "{{optional}}\nused to generate the link text for 
links to items. $1 is the items label, $2 the id given to 
\"wikibase-itemlink-id-wrapper\". This message can be altered to change the 
position of the single parts within the link. Params:\n* $1 is label on a html 
form\n* $2 is id on a html form",
        "wikibase-itemlink-id-wrapper": "{{optional}}\nUsed to wrap the items 
id for a link to an item in parentheses or similar. Params:\n* $1 is the 
prefixed id of the item",
        "wikibase-itemlink-userlang-wrapper": "{{optional}}\nUsed to wrap the 
language and label for an additional entry when the language are different from 
the user's own. Parameters:\n* $1 is the label;s language name\n* $2 is the 
label text",
        "wikibase-itemlink-title": "{{optional}}\nTitle attribute set in links 
to an item. $1 is the items label or (if not available) the prefixed page title 
of the item. $2 is the items description. Parameters:\n* $1 label as a 
directional string\n* $2 description as a directional string",
        "wikibase-wikibaserepopage-not-itemid": "Error message when an entity 
id, other than item id, is entered. The message advises users that the id is 
invalid.\n\nParameters:\n* $1 - the invalid id",
-       "wikibase-wikibaserepopage-invalid-langcode": "Response informing that 
the language code is not valid. Could give an example of a valid language 
code.\n\nParameters:\n* $1 - the invalid code\n\n\"language identifier\" is the 
same as \"language code\".",
+       "wikibase-wikibaserepopage-invalid-langcode": "Response informing that 
the language code is not valid. Could give an example of a valid language 
code.\n\nParameters:\n* $1 - the invalid code\n\n\"language identifier\" is the 
same as \"language code\".\nSee also:\n* 
{{msg-mw|wikibase-validator-not-a-language}}",
        "wikibase-wikibaserepopage-invalid-id": "Response informing that the 
selected entity ID is not valid.\n\nParameters:\n* $1 - the invalid ID",
        "wikibase-wikibaserepopage-unresolved-redirect": "Error message shown 
when the user supplied an entity ID that refers to a redirect.\nParameters:\n* 
$1 - the entity ID",
        "wikibase-wikibaserepopage-storage-exception": "Error message shown 
when an entity could not be loaded due to a storage layer 
exception.\nParameters:\n* $1 - the entity ID\n* $2 - the (unlocalized and 
possibly technical) error message.",
diff --git a/repo/includes/ValidatorBuilders.php 
b/repo/includes/ValidatorBuilders.php
index dfd8f79..4617baf 100644
--- a/repo/includes/ValidatorBuilders.php
+++ b/repo/includes/ValidatorBuilders.php
@@ -207,7 +207,7 @@
 
                $validators[] = new DataFieldValidator(
                        'language',
-                       new MembershipValidator( 
$this->contentLanguages->getLanguages() )
+                       new MembershipValidator( 
$this->contentLanguages->getLanguages(), 'not-a-language' )
                );
 
                $topValidator = new DataValueValidator(

-- 
To view, visit https://gerrit.wikimedia.org/r/316535
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iede9569575ac57a89663d10c3aa53671000443e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to