Description
Incorporate language selector to Abstract Wikipedia content and special pages, following Wikifunctions behavior, described below:
Wikifunctions behavior
Wikifunctions language selector module ext.wikilambda.languageselector replaces ULS at the top level of the page:
- on search, calls action=query&meta=languageinfo to get MW language codes, names and autonyms (E.g. https://www.wikifunctions.org/w/api.php?action=query&format=json&formatversion=2&liprop=code|name|autonym&meta=languageinfo&uselang=es )
- then matches the substring and displays the matches
- the selected language is then appended to the url as uselang=es
Implementation details
class: HookHandler/PageRenderingHandler.php
hooks: onSkinTemplateNavigation__Universal, onHtmlPageLinkRendererEnd
docs:
- https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal
- https://www.mediawiki.org/wiki/Manual:Hooks/HtmlPageLinkRendererEnd
Currently this hook is used to rewrite the skin links for ZObject content pages and exits early when the content model is not ZOBJECT:
90 // The rest of this function is about rewriting skin links on ZObject pages
91 $targetTitle = $skinTemplate->getRelevantTitle();
92
93 if ( !$targetTitle || !$targetTitle->hasContentModel( CONTENT_MODEL_ZOBJECT ) ) {
94 // Nothing to do, exit.
95 return;
96 }We should add the necessary behavior here when content model is CONTENT_MODEL_ABSTRACT, which probably is the same one that for ZObjects rewrites urls by adding the uselang
Desired behavior/Acceptance criteria
- On Abstract content and special pages, users can select a MW language in the same selector
- Once selected, page will be redirected to uselang=<lang>
- Links should inherit the uselang url property (e.g. from Read page with uselang=es, when clicking "Edit" link, should take to edit page with uselang=es)
- Vue app (e.g. view/read pages, Special:CreateAbstract page, etc.) should gathered language code and language zid properly
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist