⚓ T230839 Create mw.wikibase.getDescriptionByLang
Page Menu
Phabricator
Create Task
Maniphest
T230839
Create mw.wikibase.getDescriptionByLang
Closed, Resolved
Public
3 Estimated Story Points
Actions
Edit Task
Edit Related Tasks...
Create Subtask
Edit Parent Tasks
Edit Subtasks
Merge Duplicates In
Close As Duplicate
Edit Related Objects...
Edit Commits
Edit Mocks
Mute Notifications
Protect as security issue
Assigned To
noarave
Authored By
Mike_Peel
Aug 20 2019, 9:44 PM
2019-08-20 21:44:51 (UTC+0)
Tags
Wikidata
(incoming)
Wikibase-Lua
(Incoming)
Wikidata-Campsite
(Miscellaneous)
[Archived]Wikidata Dev Team (Sprint-∞)
(2023 completed tasks)
User-Noarave
(Backlog)
MW-1.40-notes (1.40.0-wmf.22; 2023-02-06)
Referenced Files
None
Subscribers
Aklapper
AlexisJazz
Arian_Bozorg
hoo
Lucas_Werkmeister_WMDE
Lydia_Pintscher
Mike_Peel
View All 9 Subscribers
Description
As a Lua module writer I want to access the description of an Item in a specific language in order to make use of it in my Lua module.
Problem:
According to the documentation at:
we currently have 'mw.wikibase.getLabelByLang' and 'mw.wikibase.getDescription' - but not 'mw.wikibase.getDescriptionByLang'.
That means one has to fetch the whole Item and parse it. This is an expensive operation.
Solution
Add a new 'mw.wikibase.getDescriptionByLang' convenience function similar to 'mw.wikibase.getLabelByLang'
An example call might look like this:
mw.wikibase.getDescriptionByLang( 'QID', 'lang' )
Returns the description of the Item as a string.
BDD
GIVEN Wikidata Item with a description in language X
WHEN a Lua 'getDescriptionByLang' convenience function is run for this Item in language X
THEN a Lua string with the description in the requested language is returned
Acceptance criteria:
a new Lua function exists that returns the description for an Item in a specific language
the function does not fall back to other languages in the fallback chain but only returns the description in the requested language
the documentation at
is updated
Original report:
It would be useful to be able to use Lua to fetch a description given an input language, without having to fetch and parse the whole item. Ideally, this would also allow an option to use the fallback languages or not.
According to the documentation at:
we currently have mw.wikibase.getLabelByLang and mw.wikibase.getDescription - but not mw.wikibase.getDescriptionByLang.
For on-wiki discussion, see:
Note that the "WithLang" options aren't relevant here, as they just return the defined language, they don't let you select the language to use.
Details
Related Changes in Gerrit:
Subject
Repo
Branch
Lines +/-
docs/topics/lua.md: Fix getDescriptionByLang example
mediawiki/extensions/Wikibase
master
+2
-2
Introduce mw.wikibase.getDescriptionByLang
mediawiki/extensions/Wikibase
master
+198
-12
Customize query in gerrit
Related Objects
Search...
Task Graph
Status
Subtype
Assigned
Task
Open
None
T182147
more convenience functions for Lua
Resolved
noarave
T230839
Create mw.wikibase.getDescriptionByLang
Event Timeline
Mike_Peel
created this task.
Aug 20 2019, 9:44 PM
2019-08-20 21:44:51 (UTC+0)
Restricted Application
added a subscriber:
Aklapper
View Herald Transcript
Aug 20 2019, 9:44 PM
2019-08-20 21:44:52 (UTC+0)
Mike_Peel
added a parent task:
T182147: more convenience functions for Lua
Aug 20 2019, 9:48 PM
2019-08-20 21:48:08 (UTC+0)
Pigsonthewing
subscribed.
Aug 20 2019, 10:28 PM
2019-08-20 22:28:54 (UTC+0)
Lydia_Pintscher
added a project:
Wikidata-Campsite
Aug 21 2019, 8:49 AM
2019-08-21 08:49:00 (UTC+0)
Lydia_Pintscher
added a subscriber:
hoo
RexxS
added a comment.
Aug 21 2019, 12:50 PM
2019-08-21 12:50:07 (UTC+0)
Comment Actions
The priority for me would be to have mw.wikibase.getDescriptionByLang with no language fallback (the way that mw.wikibase.getLabelByLang already works). as we already have a request for that functionality.
It would be nice to have the option to switch language fallback on or off, but that's a secondary consideration at present.
AlexisJazz
subscribed.
Aug 21 2019, 6:42 PM
2019-08-21 18:42:51 (UTC+0)
Addshore
moved this task from
Incoming
to
Needs Wikidata PM Work
on the
Wikidata-Campsite
board.
Jan 27 2020, 4:02 PM
2020-01-27 16:02:00 (UTC+0)
Manuel
moved this task from
Needs Wikidata PM Work
to
Miscellaneous
on the
Wikidata-Campsite
board.
Jul 12 2022, 11:58 AM
2022-07-12 11:58:43 (UTC+0)
Lydia_Pintscher
added a project:
[Archived]Wikidata Dev Team
Dec 4 2022, 12:46 PM
2022-12-04 12:46:50 (UTC+0)
Lydia_Pintscher
updated the task description.
(Show Details)
Lydia_Pintscher
moved this task from
Incoming
to
Product Backlog
on the
[Archived]Wikidata Dev Team
board.
karapayneWMDE
moved this task from
Product Backlog
to
SEND TO OMEGA BOARD. Will land in the 'incoming' column and need to be moved to the correct location (former Unified DOT Backlog)
on the
[Archived]Wikidata Dev Team
board.
Dec 7 2022, 10:37 AM
2022-12-07 10:37:30 (UTC+0)
karapayneWMDE
moved this task from
SEND TO OMEGA BOARD. Will land in the 'incoming' column and need to be moved to the correct location (former Unified DOT Backlog)
to
Product Backlog
on the
[Archived]Wikidata Dev Team
board.
Dec 7 2022, 10:39 AM
2022-12-07 10:39:32 (UTC+0)
Lydia_Pintscher
updated the task description.
(Show Details)
Dec 13 2022, 10:07 AM
2022-12-13 10:07:53 (UTC+0)
Lydia_Pintscher
updated the task description.
(Show Details)
Arian_Bozorg
updated the task description.
(Show Details)
Jan 10 2023, 1:52 PM
2023-01-10 13:52:27 (UTC+0)
Lydia_Pintscher
moved this task from
Product Backlog
to
SEND TO OMEGA BOARD. Will land in the 'incoming' column and need to be moved to the correct location (former Unified DOT Backlog)
on the
[Archived]Wikidata Dev Team
board.
Jan 18 2023, 10:52 AM
2023-01-18 10:52:01 (UTC+0)
Michael
set the point value for this task to
Jan 24 2023, 9:55 AM
2023-01-24 09:55:57 (UTC+0)
Michael
moved this task from
SEND TO OMEGA BOARD. Will land in the 'incoming' column and need to be moved to the correct location (former Unified DOT Backlog)
to
Sprint-∞
on the
[Archived]Wikidata Dev Team
board.
Michael
edited projects, added
[Archived]Wikidata Dev Team (Sprint-∞)
; removed
[Archived]Wikidata Dev Team
Lucas_Werkmeister_WMDE
moved this task from
Parents/Waiting
to
Todo/Backlog
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Jan 25 2023, 9:41 AM
2023-01-25 09:41:35 (UTC+0)
Lucas_Werkmeister_WMDE
subscribed.
Comment Actions
Task breakdown notes:
An easy way to test Lua changes on a local wiki is to use the Lua console that appears when editing a module page. The module page doesn’t need to actually exist, so you can just go to
index.php?title=Module:Whatever&action=edit
on your local wiki (once Scribunto is installed).
The new function can be added following the model of
getLabelByLang
(implementation, tests, documentation in
docs/topics/lua.md
).
No feature flag needed, this gets deployed with the train.
noarave
claimed this task.
Jan 25 2023, 11:46 AM
2023-01-25 11:46:50 (UTC+0)
Restricted Application
added a project:
User-Noarave
View Herald Transcript
Jan 25 2023, 11:46 AM
2023-01-25 11:46:50 (UTC+0)
noarave
moved this task from
Todo/Backlog
to
Doing
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Jan 25 2023, 11:46 AM
2023-01-25 11:46:57 (UTC+0)
gerritbot
added a comment.
Jan 25 2023, 1:32 PM
2023-01-25 13:32:57 (UTC+0)
Comment Actions
Change 883569 had a related patch set uploaded (by Noa wmde; author: Noa wmde):
[mediawiki/extensions/Wikibase@master] WIP Introduce mw.wikibase.getDescriptionByLang
gerritbot
added a project:
Patch-For-Review
Jan 25 2023, 1:32 PM
2023-01-25 13:32:58 (UTC+0)
noarave
moved this task from
Doing
to
Peer Review
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Jan 30 2023, 1:45 PM
2023-01-30 13:45:35 (UTC+0)
hoo
moved this task from
Peer Review
to
Tech Verification
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Jan 31 2023, 12:41 PM
2023-01-31 12:41:20 (UTC+0)
gerritbot
added a comment.
Jan 31 2023, 12:55 PM
2023-01-31 12:55:06 (UTC+0)
Comment Actions
Change 883569
merged
by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Introduce mw.wikibase.getDescriptionByLang
ReleaseTaggerBot
added a project:
MW-1.40-notes (1.40.0-wmf.22; 2023-02-06)
Jan 31 2023, 1:00 PM
2023-01-31 13:00:46 (UTC+0)
Maintenance_bot
removed a project:
Patch-For-Review
Jan 31 2023, 1:30 PM
2023-01-31 13:30:40 (UTC+0)
gerritbot
added a comment.
Jan 31 2023, 1:37 PM
2023-01-31 13:37:35 (UTC+0)
Comment Actions
Change 885352 had a related patch set uploaded (by Hoo man; author: Hoo man):
[mediawiki/extensions/Wikibase@master] docs/topics/lua.md: Fix getDescriptionByLang example
gerritbot
added a project:
Patch-For-Review
Jan 31 2023, 1:37 PM
2023-01-31 13:37:36 (UTC+0)
gerritbot
added a comment.
Jan 31 2023, 3:10 PM
2023-01-31 15:10:53 (UTC+0)
Comment Actions
Change 885352
merged
by jenkins-bot:
[mediawiki/extensions/Wikibase@master] docs/topics/lua.md: Fix getDescriptionByLang example
Maintenance_bot
removed a project:
Patch-For-Review
Jan 31 2023, 3:31 PM
2023-01-31 15:31:56 (UTC+0)
Lucas_Werkmeister_WMDE
moved this task from
Tech Verification
to
Product Verification
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Feb 1 2023, 9:17 AM
2023-02-01 09:17:25 (UTC+0)
Arian_Bozorg
closed this task as
Resolved
Feb 1 2023, 3:47 PM
2023-02-01 15:47:59 (UTC+0)
Arian_Bozorg
moved this task from
Product Verification
to
Our work done
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Arian_Bozorg
subscribed.
Comment Actions
Thanks everyone this looks all good to me :)
karapayneWMDE
moved this task from
Our work done
to
2023 completed tasks
on the
[Archived]Wikidata Dev Team (Sprint-∞)
board.
Feb 6 2023, 4:28 PM
2023-02-06 16:28:38 (UTC+0)
Log In to Comment
Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct.
Wikimedia Foundation
Code of Conduct
Disclaimer
CC-BY-SA
GPL
Credits