Page MenuHomePhabricator

SX mobile frequent languages entrypoint not working properly with special language codes
Open, MediumPublicBUG REPORT

Assigned To
Authored By
ngkountas
Mar 28 2025, 2:28 PM
Referenced Files
F63807186: lpl_yue.webm
Thu, Jul 10, 8:48 PM
F63806547: lpl_vro.webm
Thu, Jul 10, 8:48 PM
F63806248: lpl_sgs.webm
Thu, Jul 10, 8:48 PM
F63806193: lpl_nb.webm
Thu, Jul 10, 8:48 PM
F63805597: lpl_nan.webm
Thu, Jul 10, 8:48 PM
F63805211: lpl_lzh.webm
Thu, Jul 10, 8:48 PM
F63808220: lpl_en-simple.webm
Thu, Jul 10, 8:48 PM
F63804651: lpl_be-tarask.webm
Thu, Jul 10, 8:48 PM

Description

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 domainLanguage code from query/parse Action API ( language links in step a. )Language code in langMap local storageLanguage code in SectionTranslationTargetLanguagesEntrypoint status
be-taraskbe-x-oldbe-taraskbe_x_oldNever displayed
alsalsgswalsNever displayed
bhbhbhbhProperly displayed
simplesimpleen-simplesimpleNever displayed
zh-classicalzh-classicallzhlzhAlways displayed when in langMap
zh-min-nanzh-min-nannannanAlways displayed when in langMap
nononbnoNever displayed
roa-ruproa-rupruprupAlways displayed when in langMap
bat-smgbat-smgsgssgsAlways displayed when in langMap
fiu-vrofiu-vrovrofiu_vroNever displayed
zh-yuezh-yueyuezh_yueNever displayed

Testing instructions

Steps to replicate the issue (include links if applicable):

  1. Visit a production wiki of your preference on mobile (e.g. enwiki)
  2. Open an article that is present in the language you want to test (e.g. Earth)
  3. Open the mobile language selector
  4. (Optional) In your dev tools console you can clear your langMap local storage for easier testing: mw.storage.set('langMap', '')
  5. 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.
  6. 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')
  7. 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).
  8. 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:

bh-present-correct.png (1×1 px, 76 KB)
bh-missing-correct.png (1×1 px, 95 KB)

Entrypoint never displayed in als(gsw) even when it should:

als-not displayed-missing-wrong.png (1×868 px, 61 KB)

Entrypoint always displayed in rup when present in langMap:

rup-displayed-when-missing-correct.png (1×868 px, 62 KB)
rup-displayed-when-present-wrong.png (1×868 px, 83 KB)

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

  1. Visit a production wiki of your preference on mobile (e.g. enwiki)
  2. Open an article that is present in the language you want to test (e.g. Earth)
  3. Open the mobile language selector
  4. (Optional) In your dev tools console you can clear your langMap local storage for easier testing: mw.storage.set('langMap', '')
  5. 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.
  6. 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')
  7. 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).
  8. 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.
  9. ✅❓❌⬜ 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

ACStatusDetails
1T390300#10993567

Event Timeline

ngkountas triaged this task as Medium priority.
ngkountas moved this task from Prioritized to In-progress on the LPL Hypothesis board.

Change #1131985 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] Frequent languages entrypoint: Compare domain codes instead of languages

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

Change #1131990 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[operations/mediawiki-config@master] SpecialTranslationTargetLanguages: Use cxserver-supported language codes

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

Change #1131990 merged by jenkins-bot:

[operations/mediawiki-config@master] SpecialTranslationTargetLanguages: Use cxserver-supported language codes

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

Mentioned in SAL (#wikimedia-operations) [2025-03-31T13:30:34Z] <tgr@deploy1003> Started scap sync-world: Backport for [[gerrit:1132020|Enable SUL3 everywhere (T384220)]], [[gerrit:1132615|OATHAuth: Mark centralnoticeadmin as requiring 2FA (T208113)]], [[gerrit:1131990|SpecialTranslationTargetLanguages: Use cxserver-supported language codes (T390300)]]

Mentioned in SAL (#wikimedia-operations) [2025-03-31T13:35:43Z] <tgr@deploy1003> ngkountas, tgr: Backport for [[gerrit:1132020|Enable SUL3 everywhere (T384220)]], [[gerrit:1132615|OATHAuth: Mark centralnoticeadmin as requiring 2FA (T208113)]], [[gerrit:1131990|SpecialTranslationTargetLanguages: Use cxserver-supported language codes (T390300)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-03-31T13:51:00Z] <tgr@deploy1003> Finished scap sync-world: Backport for [[gerrit:1132020|Enable SUL3 everywhere (T384220)]], [[gerrit:1132615|OATHAuth: Mark centralnoticeadmin as requiring 2FA (T208113)]], [[gerrit:1131990|SpecialTranslationTargetLanguages: Use cxserver-supported language codes (T390300)]] (duration: 20m 25s)

Change #1131985 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Frequent languages entrypoint: Compare domain codes instead of languages

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

@ngkountas The entrypoint banner should properly displayed when, and only when, the defined conditions are met as seen in the videos below with each language. I will move this to Sign-off. Thanks for all your work!

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS Sequoia 15.5
Browser: Chrome 138
Device: MBA
Emulated Device: iPhone PRO Max 14 (Mobile emulation)

Test Artifact(s):

Articles not in the language selected
Rest-Batman
NB & VRO- Nightwing
Simple En- Sculptures des Sept Peuplements des Missions

Test Steps

Test Case 1: Ensure special language is correctly added to langMap after selection

Test Steps
  1. Visit a production wiki of your preference on mobile (e.g. enwiki)
  2. Open an article that is present in the language you want to test (e.g. Earth)
  3. Open the mobile language selector
  4. (Optional) In your dev tools console you can clear your langMap local storage for easier testing: mw.storage.set('langMap', '')
  5. 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.
  6. 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')
  7. 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).
  8. 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.
  9. 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.
bhgswrup
be-tarasken-simplelzh
nannbsgs
vroyue
GMikesell-WMF updated Other Assignee, added: GMikesell-WMF.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from Needs QA to Design Signoff on the LPL Hypothesis board.