Spun out of T275807
Readers Web will be A/B testing the existing treatment of the language switcher and a new treatment being worked on as part of #desktop_improvements. The initial cohort will be for **logged-in users only**
== AC
- [] We should bucketed on a user's centralized ID (global ID) so that they remain consistently bucketed across sites (e.g. If I switch from English to French I should be bucketed the same)
- [] When I visit a wiki with the A/B test enabled, I receive either the existing treatment or the new one
- [] When I visit a wiki with the A/B test enabled and I have the **magic query string parameter** set then it should have the following effects:
| Value | Effect |
| --- | --- |
| `undefined` | I'm entered into the A/B test and bucketed as usual |
| `control` | I see the existing treatment |
| `A` | I see the new treatment |
# Developer Notes
1. Bucketing should happen on the server side
-- Would adding a class to the body tag to help with bucketing
# //We should bucketed on a user's centralized ID (global ID) so that they remain consistently bucketed across sites…//
This change be achieved with the following:
```lang=php
$lookup = CentralIdLookup::factoryNonLocal();
$id = null;
if ( $lookup ) {
$id = $lookup->centralIdFromLocalUser( $user );
}
// The central ID lookup failed?
if ( !$id ) {
$id = $user->getId();
}
```
== QA Steps
=== With Even Logged in User
1) Visit https://patchdemo.wmflabs.org/wikis/51ef0c9126/wiki/Tree
2) Login with username: `alice` and password `patchdemo1`
3) In dev console, run `mw.user.getId();` ensuring that user has an **even** user id.
4) Assert that language button appears and languages do NOT appear in sidebar.
5) Visit https://patchdemo.wmflabs.org/wikis/51ef0c9126/wiki/Tree?languageinheader=0
6) Assert that languages appear in the sidebar and that the language button does NOT appear
=== With Odd Logged in User
1) Visit https://patchdemo.wmflabs.org/wikis/51ef0c9126/wiki/Tree
2) Login with username: `bob` and password `patchdemo1`
3) In dev console, run `mw.user.getId();` ensuring that user has an **odd** user id.
4) Assert that languages appear in the sidebar and that the language button does NOT appear
5) Visit https://patchdemo.wmflabs.org/wikis/51ef0c9126/wiki/Tree?languageinheader=1
6) Assert that language button appears and languages do NOT appear in sidebar.
=== With Anonymous User (and `languageinheader` config off for anons)
1) Logout and assert that you are an anonymous user.
2) Visit https://patchdemo.wmflabs.org/wikis/51ef0c9126/wiki/Tree
3) Assert that languages appear in the sidebar and that the language button does NOT appear
== QA Results - Beta
| **AC** | **Status** | **Details** |
| ----- | ----- | ----- |
| 1 | ✅ | T280825#7099839 |
| 2 | ✅ | T280825#7099839 |
| 3 | ✅ | T280825#7099839 |
| 4 | ✅ | T280825#7099839 |
| 5 | ✅ | T280825#7099839 |
== QA Results - Beta
| **AC** | **Status** | **Details** |
| ----- | ----- | ----- |
| 1 | ✅ | T280825#7146336 |
| 2 | ✅ | T280825#7146336 |
| 3 | ❌ | T280825#7146336 need more info|
| 4 | ✅ | T280825#7146336 |
| 5 | ✅ | T280825#7146336 |