Page MenuHomePhabricator

Allow the user to configure the language of the rendered article preview
Closed, ResolvedPublic

Description

Description

Readers or editors of an Abstract content page should be able to change the language that the Abstract Preview is being rendered for, independently from the page language.

Desired behavior/Acceptance criteria


Completion checklist

Event Timeline

gengh renamed this task from Allow the user changing the page language to change that used for rendering the auto-article to Allow the user to configure the language of the rendered article preview.Feb 12 2026, 11:18 AM
gengh updated the task description. (Show Details)

Implementation details:

Fragment preview cache will be keyed by (keyPath + language) to support multiple cached languages. When switching the language selector back to a language selected before, therefor the preview will show instantly.

Abstract store (abstractWiki.js)

  • Add previewLanguageZid to state
  • Add getter getPreviewLanguageZid
  • Returns previewLanguageZid OR getUserLangZid
  • Add action setPreviewLanguageZid(zid)
  • Initialize preview language to page language

Fragment cache changes
We are talking about state.fragments[keypath] currently.

  • Change fragment cache key to keyPath|language
  • Update all helpers to use composite key: getFragmentPreview, renderFragmentPreview, etc

AbstractPreview.vue

  • Header label: use getPreviewLanguageZid instead of getUserLangZid
  • Add language selector in header-action
  • Use ZObjectSelector with type=Z_NATURAL_LANGUAGE. On select → call setPreviewLanguageZid

NB: I wonder if this is how we want to fetch the languages?

AbstractPreviewFragment.vue

  • Pass language: getPreviewLanguageZid to renderFragmentPreview
  • Continue reading via getFragmentPreview(keyPath) (store resolves correct language key)
  • Existing watchers should trigger re-render on language change (no new watcher required)

Acceptance Criteria

  • Preview defaults to page language
  • User can change preview language via selector
  • Preview re-renders in selected language
  • Fragment cache is language-aware
  • Currently selected language is excluded from selector options
DSmit-WMF changed the task status from Open to In Progress.Feb 12 2026, 12:07 PM
DSmit-WMF claimed this task.

open questions

  • Should we translate the error (not sure how havent looked into it)? Maybe not as part of this scope.
  • Do we want to reuse the zobject selector here with Z60 as input? or a different selector
  • I feel like the zobject selector or lookup has a bug, whenever I try to change the page language to something else then english and clear the language selector -> the suggestions never show up, only until I have chosen a different language . I checked and this is because the lookup expects the selectedItem to be inside the menuItems, which is not the case with the suggested items. so this is a bug. We probably need to reset the selecteditem

Is the following like we want it?

Demo video

Change #1239152 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] Preview: add language selector for the abstract preview

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

Change #1239152 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Preview: add language selector for the abstract preview

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