Sn1per has uploaded a new change for review.
https://gerrit.wikimedia.org/r/178085
Change subject: Convert API help to use i18n pt.5
......................................................................
Convert API help to use i18n pt.5
- API help modified to use i18n messages
- i18n messages edited to add said messages
Bug: T74704
Change-Id: Ie88574335f81e951227a22908ac6b1541133bb6b
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/api/SetReference.php
M repo/includes/api/SetSiteLink.php
4 files changed, 93 insertions(+), 88 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/85/178085/1
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 273fea8..d1ef3c6 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -613,5 +613,37 @@
"apihelp-wbsetqualifier-param-token": "A \"edittoken\" token previously
obtained through the token module (prop=info).",
"apihelp-wbsetqualifier-param-baserevid": "The numeric identifier for
the revision to base the modification on.\nThis is used for detecting conflicts
during save.",
"apihelp-wbsetqualifier-param-bot": "Mark this edit as bot\nThis URL
flag will only be respected if the user belongs to the group \"bot\".",
- "apihelp-wbsetqualifier-example-1": "Set the qualifier for the given
claim with property P1 to string value GdyjxP8I6XB3"
+ "apihelp-wbsetqualifier-example-1": "Set the qualifier for the given
claim with property P1 to string value GdyjxP8I6XB3",
+ "apihelp-wbsetreference-description": "API module for creating a
reference or setting the value of an existing one.",
+ "apihelp-wbsetreference-param-statement": "A GUID identifying the
statement for which a reference is being set",
+ "apihelp-wbsetreference-param-snaks": "The snaks to set the reference
to. JSON object with property ids pointing to arrays containing the snaks for
that property",
+ "apihelp-wbsetreference-param-snaks-order": "The order of the snaks.
Comma-separated list of property ids",
+ "apihelp-wbsetreference-param-reference": "A hash of the reference that
should be updated. Optional. When not provided, a new reference is created",
+ "apihelp-wbsetreference-param-index": "The index within the statement's
list of references where to move the reference to. Optional. When not provided,
an existing reference will stay in place while a new reference will be
appended.",
+ "apihelp-wbsetreference-param-summary": "Summary for the edit.\nWill be
prepended by an automatically generated comment. The length limit of
the\nautocomment together with the summary is 260 characters. Be aware that
everything above that\nlimit will be cut off.",
+ "apihelp-wbsetreference-param-token": "A \"edittoken\" token previously
obtained through the token module (prop=info).",
+ "apihelp-wbsetreference-param-baserevid": "The numeric identifier for
the revision to base the modification on.\nThis is used for detecting conflicts
during save.",
+ "apihelp-wbsetreference-param-bot": "Mark this edit as bot\nThis URL
flag will only be respected if the user belongs to the group \"bot\".",
+ "apihelp-wbsetreference-example-1": "Create a new reference for claim
with GUID Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF",
+ "apihelp-wbsetreference-example-2": "Set reference for claim with GUID
Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF which has hash of
1eb8793c002b1d9820c833d234a1b54c8e94187e",
+ "apihelp-wbsetreference-example-3": "Creates a new reference for the
claim with GUID Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF and inserts the new
reference at the top of the list of references instead of appending it to the
bottom.",
+ "apihelp-wbsetsitelink-description": "API module to associate an
article on a wiki with a Wikibase item or remove an already made such
association.",
+ "apihelp-wbsetsitelink-param-id": "The identifier for the entity,
including the prefix.\nUse either 'id' or 'site' and 'title' together.",
+ "apihelp-wbsetsitelink-param-site": "An identifier for the site on
which the page resides.\nUse together with 'title' to make a complete
sitelink.",
+ "apihelp-wbsetsitelink-param-title": "Title of the page to
associate.\nUse together with 'site' to make a complete sitelink.",
+ "apihelp-wbsetsitelink-param-baserevid": "The numeric identifier for
the revision to base the modification on.\nThis is used for detecting conflicts
during save.",
+ "apihelp-wbsetsitelink-param-summary": "Summary for the edit.\nWill be
prepended by an automatically generated comment. The length limit of
the\nautocomment together with the summary is 260 characters. Be aware that
everything above that\nlimit will be cut off.",
+ "apihelp-wbsetsitelink-param-token": "A \"edittoken\" token previously
obtained through the token module (prop=info).",
+ "apihelp-wbsetsitelink-param-bot": "Mark this edit as bot\nThis URL
flag will only be respected if the user belongs to the group \"bot\".",
+ "apihelp-wbsetsitelink-param-linksite": "The identifier of the site on
which the article to link resides",
+ "apihelp-wbsetsitelink-param-linktitle": "The title of the article to
link. If this parameter is an empty string or both linktitle and badges are not
set, the link will be removed.",
+ "apihelp-wbsetsitelink-param-badges": "The IDs of items to be set as
badges. They will replace the current ones. If this parameter is not set, the
badges will not be changed",
+ "apihelp-wbsetsitelink-example-1": "Add a sitelink \"Hydrogen\" for
English page with id \"Q42\", if the site link does not exist",
+ "apihelp-wbsetsitelink-example-2": "Add a sitelink \"Hydrogen\" for
English page with id \"Q42\", if the site link does not exist with an edit
summary of \"World domination will be mine soon!\"",
+ "apihelp-wbsetsitelink-example-3": "Add a sitelink \"Wasserstoff\" for
the German page on item with the link for the English page to \"Hydrogen\", if
the site link does not exist",
+ "apihelp-wbsetsitelink-example-4": "Removes the German sitelink from
the item",
+ "apihelp-wbsetsitelink-example-5": "Add a sitelink \"Wodór\" for the
Polish page on item with the link for the English page to \"Hydrogen\" with one
badge pointing to the item with id \"Q149\"",
+ "apihelp-wbsetsitelink-example-6": "Change badges for the link to
Polish page from the item with id \"Q42\" to two badges pointing to the items
with ids \"Q2\" and \"Q149\" wothout providing the link title",
+ "apihelp-wbsetsitelink-example-7": "Change the link to Polish page from
the item with id \"Q42\" without changing badges",
+ "apihelp-wbsetsitelink-example-8": "Change the link to Polish page from
the item with id \"Q42\" and remove all of its badges"
}
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index d58309f..62a039a 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -637,5 +637,37 @@
"apihelp-wbsetqualifier-param-token":
"{{doc-apihelp-param|wbsetqualifier|token}}",
"apihelp-wbsetqualifier-param-baserevid":
"{{doc-apihelp-param|wbsetqualifier|baserevid}}",
"apihelp-wbsetqualifier-param-bot":
"{{doc-apihelp-param|wbsetqualifier|bot}}",
- "apihelp-wbsetqualifier-example-1":
"{{doc-apihelp-example|wbsetqualifier}}"
+ "apihelp-wbsetqualifier-example-1":
"{{doc-apihelp-example|wbsetqualifier}}",
+ "apihelp-wbsetreference-description":
"{{doc-apihelp-description|wbsetreference}}",
+ "apihelp-wbsetreference-param-statement":
"{{doc-apihelp-param|wbsetreference|statement}}",
+ "apihelp-wbsetreference-param-snaks":
"{{doc-apihelp-param|wbsetreference|snaks}}",
+ "apihelp-wbsetreference-param-snaks-order":
"{{doc-apihelp-param|wbsetreference|snaks-order}}",
+ "apihelp-wbsetreference-param-reference":
"{{doc-apihelp-param|wbsetreference|reference}}",
+ "apihelp-wbsetreference-param-index":
"{{doc-apihelp-param|wbsetreference|index}}",
+ "apihelp-wbsetreference-param-summary":
"{{doc-apihelp-param|wbsetreference|summary}}",
+ "apihelp-wbsetreference-param-token":
"{{doc-apihelp-param|wbsetreference|token}}",
+ "apihelp-wbsetreference-param-baserevid":
"{{doc-apihelp-param|wbsetreference|baserevid}}",
+ "apihelp-wbsetreference-param-bot":
"{{doc-apihelp-param|wbsetreference|bot}}",
+ "apihelp-wbsetreference-example-1":
"{{doc-apihelp-example|wbsetreference}}",
+ "apihelp-wbsetreference-example-2":
"{{doc-apihelp-example|wbsetreference}}",
+ "apihelp-wbsetreference-example-3":
"{{doc-apihelp-example|wbsetreference}}",
+ "apihelp-wbsetsitelink-description":
"{{doc-apihelp-description|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-param-id":
"{{doc-apihelp-param|wbsetsitelink|id}}",
+ "apihelp-wbsetsitelink-param-site":
"{{doc-apihelp-param|wbsetsitelink|site}}",
+ "apihelp-wbsetsitelink-param-title":
"{{doc-apihelp-param|wbsetsitelink|title}}",
+ "apihelp-wbsetsitelink-param-baserevid":
"{{doc-apihelp-param|wbsetsitelink|baserevid}}",
+ "apihelp-wbsetsitelink-param-summary":
"{{doc-apihelp-param|wbsetsitelink|summary}}",
+ "apihelp-wbsetsitelink-param-token":
"{{doc-apihelp-param|wbsetsitelink|token}}",
+ "apihelp-wbsetsitelink-param-bot":
"{{doc-apihelp-param|wbsetsitelink|bot}}",
+ "apihelp-wbsetsitelink-param-linksite":
"{{doc-apihelp-param|wbsetsitelink|linksite}}",
+ "apihelp-wbsetsitelink-param-linktitle":
"{{doc-apihelp-param|wbsetsitelink|linktitle}}",
+ "apihelp-wbsetsitelink-param-badges":
"{{doc-apihelp-param|wbsetsitelink|badges}}",
+ "apihelp-wbsetsitelink-example-1":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-2":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-3":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-4":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-5":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-6":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-7":
"{{doc-apihelp-example|wbsetsitelink}}",
+ "apihelp-wbsetsitelink-example-8":
"{{doc-apihelp-example|wbsetsitelink}}"
}
diff --git a/repo/includes/api/SetReference.php
b/repo/includes/api/SetReference.php
index bca0bba..503e361 100644
--- a/repo/includes/api/SetReference.php
+++ b/repo/includes/api/SetReference.php
@@ -234,49 +234,18 @@
}
/**
- * @see \ApiBase::getParamDescription
- *
- * @since 0.3
+ * @see ApiBase:getExamplesMessages()
*
* @return array
*/
- public function getParamDescription() {
- return array_merge(
- parent::getParamDescription(),
- array(
- 'statement' => 'A GUID identifying the
statement for which a reference is being set',
- 'snaks' => 'The snaks to set the reference to.
JSON object with property ids pointing to arrays containing the snaks for that
property',
- 'snaks-order' => 'The order of the snaks.
Comma-separated list of property ids',
- 'reference' => 'A hash of the reference that
should be updated. Optional. When not provided, a new reference is created',
- 'index' => 'The index within the statement\'s
list of references where to move the reference to. Optional. When not provided,
an existing reference will stay in place while a new reference will be
appended.',
- )
- );
- }
-
- /**
- * @see \ApiBase::getDescription
- *
- * @since 0.3
- *
- * @return string
- */
- public function getDescription() {
+ protected function getExamplesMessages() {
return array(
- 'API module for creating a reference or setting the
value of an existing one.'
- );
- }
-
- /**
- * @see \ApiBase::getExamples()
- */
- protected function getExamples() {
- return array(
-
'api.php?action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"foo"}}]}&baserevid=7201010&token=foobar'
- => 'Create a new reference for claim with GUID
Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF',
-
'api.php?action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&reference=1eb8793c002b1d9820c833d234a1b54c8e94187e&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"bar"}}]}&baserevid=7201010&token=foobar'
- => 'Set reference for claim with GUID
Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF which has hash of
1eb8793c002b1d9820c833d234a1b54c8e94187e',
-
'api.php?action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"novalue","property":"P212"}]}&index=0&baserevid=7201010&token=foobar'
- => 'Creates a new reference for the claim with
GUID Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF and inserts the new reference at
the top of the list of references instead of appending it to the bottom.',
+
'action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"foo"}}]}&baserevid=7201010&token=foobar'
+ => 'apihelp-wbsetreference-example-1',
+
'action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&reference=1eb8793c002b1d9820c833d234a1b54c8e94187e&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"bar"}}]}&baserevid=7201010&token=foobar'
+ => 'apihelp-wbsetreference-example-2',
+
'action=wbsetreference&statement=Q76$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"novalue","property":"P212"}]}&index=0&baserevid=7201010&token=foobar'
+ => 'apihelp-wbsetreference-example-3',
);
}
}
diff --git a/repo/includes/api/SetSiteLink.php
b/repo/includes/api/SetSiteLink.php
index 1f68ae7..486bbf8 100644
--- a/repo/includes/api/SetSiteLink.php
+++ b/repo/includes/api/SetSiteLink.php
@@ -188,56 +188,28 @@
}
/**
- * Get final parameter descriptions, after hooks have had a chance to
tweak it as
- * needed.
+ * @see ApiBase:getExamplesMessages()
*
- * @return array|bool False on no parameter descriptions
+ * @return array
*/
- public function getParamDescription() {
- return array_merge(
- parent::getParamDescription(),
- parent::getParamDescriptionForId(),
- parent::getParamDescriptionForSiteLink(),
- parent::getParamDescriptionForEntity(),
- array(
- 'linksite' => 'The identifier of the site on
which the article to link resides',
- 'linktitle' => 'The title of the article to
link. If this parameter is an empty string or both linktitle and badges are not
set, the link will be removed.',
- 'badges' => 'The IDs of items to be set as
badges. They will replace the current ones. If this parameter is not set, the
badges will not be changed',
- )
- );
- }
-
- /**
- * @see \ApiBase::getDescription()
- */
- public function getDescription() {
+ protected function getExamplesMessages() {
return array(
- 'API module to associate an article on a wiki with a
Wikibase item or remove an already made such association.'
- );
- }
-
- /**
- * Returns usage examples for this module. Return false if no examples
are available.
- * @return bool|string|array
- */
- protected function getExamples() {
- return array(
-
'api.php?action=wbsetsitelink&id=Q42&linksite=enwiki&linktitle=Hydrogen'
- => 'Add a sitelink "Hydrogen" for English page with id
"Q42", if the site link does not exist',
-
'api.php?action=wbsetsitelink&id=Q42&linksite=enwiki&linktitle=Hydrogen&summary=World%20domination%20will%20be%20mine%20soon!'
- => 'Add a sitelink "Hydrogen" for English page with id
"Q42", if the site link does not exist with an edit summary of "World
domination will be mine soon!"',
-
'api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki&linktitle=Wasserstoff'
- => 'Add a sitelink "Wasserstoff" for the German page on
item with the link for the English page to "Hydrogen", if the site link does
not exist',
-
'api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki'
- => 'Removes the German sitelink from the item',
-
'api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=plwiki&linktitle=Wodór&badges=Q149'
- => 'Add a sitelink "Wodór" for the Polish page on item
with the link for the English page to "Hydrogen" with one badge pointing to the
item with id "Q149"',
-
'api.php?action=wbsetsitelink&id=Q42&linksite=plwiki&badges=Q2|Q149'
- => 'Change badges for the link to Polish page from the
item with id "Q42" to two badges pointing to the items with ids "Q2" and "Q149"
wothout providing the link title',
-
'api.php?action=wbsetsitelink&id=Q42&linksite=plwiki&linktitle=Warszawa'
- => 'Change the link to Polish page from the item with
id "Q42" without changing badges',
-
'api.php?action=wbsetsitelink&id=Q42&linksite=plwiki&linktitle=Wodór&badges='
- => 'Change the link to Polish page from the item with
id "Q42" and remove all of its badges',
+
'action=wbsetsitelink&id=Q42&linksite=enwiki&linktitle=Hydrogen'
+ => 'apihelp-wbsetsitelink-example-1',
+
'action=wbsetsitelink&id=Q42&linksite=enwiki&linktitle=Hydrogen&summary=World%20domination%20will%20be%20mine%20soon!'
+ => 'apihelp-wbsetsitelink-example-2',
+
'action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki&linktitle=Wasserstoff'
+ => 'apihelp-wbsetsitelink-example-3',
+
'action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki'
+ => 'apihelp-wbsetsitelink-example-4',
+
'action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=plwiki&linktitle=Wodór&badges=Q149'
+ => 'apihelp-wbsetsitelink-example-5',
+
'action=wbsetsitelink&id=Q42&linksite=plwiki&badges=Q2|Q149'
+ => 'apihelp-wbsetsitelink-example-6',
+
'action=wbsetsitelink&id=Q42&linksite=plwiki&linktitle=Warszawa'
+ => 'apihelp-wbsetsitelink-example-7',
+
'action=wbsetsitelink&id=Q42&linksite=plwiki&linktitle=Wodór&badges='
+ => 'apihelp-wbsetsitelink-example-8',
);
}
--
To view, visit https://gerrit.wikimedia.org/r/178085
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie88574335f81e951227a22908ac6b1541133bb6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits