Background
The mobile "frequent languages" entrypoint is registered on mobile devices based on the following logic:
a. We find all language links for the current article (backend)
b. We compare those language links with the languages defined in SectionTranslationTargetLanguages configuration parameter to find the SX-supported languages for which the article is missing. If at least one such language exists, we register the entrypoint module (backend)
c. Inside the entrypoint module, we get user's frequent languages - as defined in the langMap stored in browser's local storage-, and we compare it to the missing SX-supported languages found in backend. If there is the intersection between the frequent languages and the missing SX-supported languages is not empty, we display the entrypoint banner (frontend)
This works well for most languages, however things get more complicated when we move to the special languages codes (e.g. be-tarask, als/gsw, lzh/zh-classical etc). The only special language code for which things work as expected is bh. For the rest of the languages, the entrypoint is either never displayed or displayed always when the language code is present in langMap local storage field. The reason of this issue is the different language codes used for these languages from different "sources", as demonstrated in the following table:
Wiki domain | Language code from query/parse Action API ( language links in step a. ) | Language code in langMap local storage | Language code in SectionTranslationTargetLanguages | Entrypoint status |
be-tarask | be-x-old | be-tarask | be_x_old | Never displayed |
als | als | gsw | als | Never displayed |
bh | bh | bh | bh | Properly displayed |
simple | simple | en-simple | simple | Never displayed |
zh-classical | zh-classical | lzh | lzh | Always displayed when in langMap |
zh-min-nan | zh-min-nan | nan | nan | Always displayed when in langMap |
no | no | nb | no | Never displayed |
roa-rup | roa-rup | rup | rup | Always displayed when in langMap |
bat-smg | bat-smg | sgs | sgs | Always displayed when in langMap |
fiu-vro | fiu-vro | vro | fiu_vro | Never displayed |
zh-yue | zh-yue | yue | zh_yue | Never displayed |
Testing instructions
Steps to replicate the issue (include links if applicable):
- Visit a production wiki of your preference on mobile (e.g. enwiki)
- Open an article that is present in the language you want to test (e.g. Earth)
- Open the mobile language selector
- (Optional) In your dev tools console you can clear your langMap local storage for easier testing: mw.storage.set('langMap', '')
- Click on the special language you want to test, so that the language is added to the langMap. You are going to be redirected to the corresponding wiki.
- Go back to the wiki of step (1). In your dev tools console, test that langMap is properly populated with the language you just selected: mw.storage.get('langMap')
- In a new tab, visit the production wiki of step (1) and open an article that is not present in the special language selected in step (5).
- Open the language selector. Check for the entrypoint banner. Then re-open the initial article (e.g. Earth) and check for the entrypoint banner there, too.
What happens?:
The entrypoint banner is missing from both article language selectors or present in both article language selectors, depending on the "Entrypoint status" value of the language in the previous table
What should have happened instead?:
The entrypoint banner should properly displayed when, and only when, the defined conditions are met.
Screenshots from greek (el) production wiki
Entrypoint correctly displayed in bh when it should:
Entrypoint never displayed in als(gsw) even when it should:
Entrypoint always displayed in rup when present in langMap:
Derived Requirement
Ensure that when a user selects a special language via the mobile language selector, the corresponding language code is accurately saved in langMap and reflects correctly in local storage for use by the SX frequent languages entrypoint logic.
Test Steps
Test Case 1: Ensure special language is correctly added to langMap after selection
- Visit a production wiki of your preference on mobile (e.g. enwiki)
- Open an article that is present in the language you want to test (e.g. Earth)
- Open the mobile language selector
- (Optional) In your dev tools console you can clear your langMap local storage for easier testing: mw.storage.set('langMap', '')
- Click on the special language you want to test, so that the language is added to the langMap. You are going to be redirected to the corresponding wiki.
- Go back to the wiki of step (1). In your dev tools console, test that langMap is properly populated with the language you just selected: mw.storage.get('langMap')
- In a new tab, visit the production wiki of step (1) and open an article that is not present in the special language selected in step (5).
- Open the language selector. Check for the entrypoint banner. Then re-open the initial article (e.g. Earth) and check for the entrypoint banner there, too.
- ✅❓❌⬜ AC1: Confirm that the selected special language (e.g., be-tarask) appears in the retrieved langMap value and and "Missing in <lang>", when conditions are met.
QA Results - Mobile PROD
AC | Status | Details |
---|---|---|
1 | ✅ | T390300#10993567 |