[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

[S] Update verbiage for "search preview" config
Closed, ResolvedPublic

Description

During development of T311644 we were advised to change the verbiage of the text from "article" to "page" to better align with mediawiki core.

The above should be reverted to the proposed text in figma as confirmed in this figma comment: https://www.figma.com/file/86M7oLZplSxXKwKJR59mIK/Special%3ASearch-on-Wikipedia?node-id=2109%3A36478#262141589

AC:

  • searchvue-snippet-gotofullpage ("Go to full page/article") should show 'article' for main namespace results; 'page' otherwise
  • searchvue-article-sections-heading ("Sections in the page/article") should show 'article' for main namespace results; 'page' otherwise

Event Timeline

Copying from @Sneha's Figma comment:

I think we should stick to article because 1) our namespace is called article 2) it is being referred to as article on the page itself (see the tabs under article title). So I think to readers it's an article.

If we want to keep open the option of rolling this out to other wikis/namespaces at some point, perhaps we should stick with "pages" as fallback message, plus add a namespace-specific message that says "articles" for the main namespace.

Something like:

"quickview-snippet-gotofullarticle": "Go to full page",
"quickview-snippet-gotofullarticle-ns0": "Go to full article",

and

$namespaceId = $title->getNamespace();
if ( wfMessage( "quickview-snippet-gotofullpage-ns{$namespaceId}" )->exists() ) {
    return wfMessage( "quickview-snippet-gotofullpage-ns{$namespaceId}" )->text();
} else {
    return wfMessage( 'quickview-snippet-gotofullpage' )->exists();
}

(above is pseudo code; this logic actually lives in JS)

CBogen renamed this task from Update verbiage for "search preview" config to [S] Update verbiage for "search preview" config.Sep 27 2022, 3:32 PM
CBogen updated the task description. (Show Details)

Change 836856 had a related patch set uploaded (by Vadim Kovalenko; author: Vadim Kovalenko):

[mediawiki/extensions/SearchVue@master] SearchVue: Update verbiage for 'search preview' config

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

Hi @matthiasmullie ! So, we need the ability to keep the word page for the help message, but only for Special:Preferences page. All other pages (e.g. namespaces) should still have word article in the same sentence.
I just checked /extensions/SearchVue/src/Hooks.php file and found that only one place where I can get the namespace is onSpecialPageBeforeExecute( $special, $subpage ) {...} method.
I used this code block to get a namespace:

if ($special->getName() === ‘Preferences’) {
    $specialName = $special->getName();
    $this->nameSpaceId = \Title::newFromText(“Special:$specialName”)->getNamespace();
}

$this->nameSpaceId always returns -1 which is expected since this is a Special page (full list of namespace values here - https://www.mediawiki.org/wiki/Help:Namespaces)
But this doesn't help us since we get this value from onSpecialPageBeforeExecute which means we are already on a Special page.

On the other hand I can get namespace using JS and immediately store it into the Vuex state (mediawiki/extensions/SearchVue/resources/store/state.js) by adding this line:
namespaceId: mw.config.get( 'wgNamespaceNumber' )

This also returns -1 if we are on the Special page.

My questions are:

  1. How to reproduce cases where mw.config.get( 'wgNamespaceNumber' ) could return some another namespace, for example 0 (Main)?
  2. If somehow namespace will be another number then -1, how to conditionally change values in mediawiki/extensions/SearchVue/i18n/en.json?

For now, I decided just replace word page with article in i18n.

For the message on Special:Preferences ("Preview the contents of the page and related pages") the namespace of that preferences page doesn't matter; it's describing how the feature related to *other* pages.
That one's a generic description, I think we simply ought to stick with "page" - if we start to use "article" there, it would become inaccurate if and once we want to roll out to other namespaces/wikis.

The most important message, however, is searchvue-snippet-gotofullpage ("Go to full page/article").
This is the one in the QuickView window, and we know exactly what page we are showing that panel for, so we can tailor it to whatever the namespace that search result is in.
If we're showing QuickView for the main namespace, "article" is appropriate terminology; if we're showing for other namespaces, we can fall back to "page", which is a good catch-all.

We could have 2 messages:

en.json

"searchvue-snippet-gotofullpage": "Go to full page",
"searchvue-snippet-gotofullpage-ns0": "Go to full article",

Both exposed to JS:

extension.json

"messages": [
	...
	"searchvue-snippet-gotofullpage",
	"searchvue-snippet-gotofullpage-ns0",
	...
]

Where JS then conditionally renders one of these 2 based on what namespace the page it's rendering QuickView for is in.

QuickViewSnippet.vue

<a :href="url">{{
	$i18n( 'searchvue-snippet-gotofullpage-ns' + namespace ).exists()
		? $i18n( 'searchvue-snippet-gotofullpage-ns' + namespace ).text()
		: $i18n( 'searchvue-snippet-gotofullpage' ).text()
}}</a>

...

computed: {
	...
	namespace() {
		const title = new mw.Title( this.title );
		return title.getNamespaceId();
	}
}

Thoughts?

Change 836856 merged by jenkins-bot:

[mediawiki/extensions/SearchVue@master] SearchVue: Update verbiage for 'search preview' config

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

Another message searchvue-article-sections-heading ("Sections in the article"), from https://gerrit.wikimedia.org/r/c/mediawiki/extensions/SearchVue/+/835615

Moving back to "Ready for dev" to give searchvue-article-sections-heading the same treatment.

Change 839611 had a related patch set uploaded (by Vadim Kovalenko; author: Vadim Kovalenko):

[mediawiki/extensions/SearchVue@master] SearchVue: Update verbiage for 'search preview' config

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

Change 839611 merged by jenkins-bot:

[mediawiki/extensions/SearchVue@master] SearchVue: Update verbiage for 'search preview' config

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

Assuming this is blocked on the SearchVue deploy for QA, please correct me if it's blocked on something else. Thanks!