Description
Earlier in the desktop improvements project we moved the language switcher from the sidebar to the top of the page (next to the article title), so that it is more discoverable (T260738). This presented a problem for Main pages because they do not have a page title element, so there was no clear place to put the language switcher. In T276140 we put it at the bottom of the Main page so it would at least be somewhere, and we started to explore ideas for how to find a better location for it on the Main page. This task is for continuing that conversation, and finding a better solution to make it easier to switch languages from the Main page.
Ideas
Add title to Main page (which includes the language switcher)
One idea to try is adding a title to the Main page, which includes the language switcher beside it. The main benefit to this solution is that the language switcher will be consistent between the Main page and all article pages. Currently the Main page doesn't have a title, so it would take some time and discussion to figure out what an appropriate title for the page could be. And a good option for one project might not work for others.
Logged-out | Logged-in |
---|---|
Create language switcher templates for main page
Another idea is to create some template (or templates) for the Main page that communities can choose to add as they like. Some communities already have language templates on their Main pages, so for them it could be about moving those templates closer to the top. For other projects they would have to add them entirely. Here are some examples:
for reference, here are some of the existing language templates on Main pages:
Acceptance Criteria
- Add a feature flag that allows us to put the language button at the top in the main page and that allows editors to change the page title message.
- Default configuration for title:
- Logged-out: "Welcome to [project name]"
- Logged-in: "Welcome [user name]"
- Ensure feature flag is visible via a query string parameter like our other feature flags
- Create new task for follow-up (steps outlined below)
Follow-up for euwiki
- Restrict eu.wikipedia.org styles on the main page to pages without the feature flag.
- Test on https://eu.wikipedia.org/w/index.php?title=Azala&oldid=8746129&languageinmainpageheader=1
- Enable the config flag and apply the revision.
Developer Notes
- @Jdlrobson wrote a POC patch for customizing the main page title. This data can be made available in core and output to the base mustache template for all skins to access.
- For internationalization and logged in/out users, we'll need 2 message keys: mainpage-title-logged-in and mainpage-title-logged-out - both of which can be customized by editors at will.
- The feature flag that renders the custom/default main page title AND places the language button at the top of the main page is presumably scoped to Vector and should be straightforward to add with a query parameter as well using the OverridableConfigRequirement class.
- The relevant templates can check for the feature flag to display the main page title + language button accordingly.
QA Steps
Please perform the following steps for both logged in and anonymous users. Note, when testing on the beta cluster we are looking for the presence of this button:
Please ignore this button:
When at default
- Visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page
- Verify that the language list is absent in the sidebar and the new language button is at the TOP of the content.
- Verify the new language button is not at the bottom of the content.
When languageinheader is disabled and languageinmainpageheader is enabled
- Visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page?languageinheader=0&languageinmainpageheader=1
- Verify that the language list is present in the sidebar and the new language button is not at the bottom of the content and not at the top of the content
When languageinheader is enabled and languageinmainpageheader is at its default (enabled)
- Visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page?languageinheader=1
- Verify that the language list is absent in the sidebar and the new language button is at the top of the content.
- Verify the new language button is NOT at the bottom of the content
When languageinheader is enabled and languageinmainpageheader is enabled
- Visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page?languageinheader=1&languageinmainpageheader=1
- Verify that the language list is absent in the sidebar and the new language button is at the top of the content.
- Verify the new language button is not at the bottom of the content
When languageinheader is enabled and languageinmainpageheader is disabled and visiting content
- Visit https://en.wikipedia.beta.wmflabs.org/wiki/Dog?languageinheader=1&languageinmainpageheader=0
- Verify that the language list is absent in the sidebar and the new language button is at the top of the content.
- Verify the new language button is not at the bottom of the content
QA Results - Beta
AC | Status | Details |
---|---|---|
1 | ✅ | T293470#7595784 |
2 | ❌ | T293470#7595784 |
3 | ❌ | T293470#7595784 |
4 | ❌ | T293470#7595784 |
5 | ✅ | T293470#7595784 |