Page MenuHomePhabricator

Language overlay will not open on enwiki
Closed, ResolvedPublic

Description

Testing on a real phone (Android Nexus 5) / Chrome
When I click the language button in beta while logged in I get:
Uncaught TypeError: Cannot read property 'localeCompare' of undefined
Same problem in stable.
The language overlay does not open and I cannot switch languages.
Unbreak now please.

Event Timeline

Using break points:

Object {
variantsHeader: "中文
variants: [{ lang: "zh-min-nan"
langname: "Bân-lâm-gú"
title: "Chheh"
url: "https://zh-min-nan.wikipedia.org/wiki/Chheh"
variant: "min-nan"
}
,{
lang: "zh-yue"
langname: "粵語"
title: "書"
url: "https://zh-yue.wikipedia.org/wiki/%E6%9B%B8"
variant: "yue"}], hasVariants: true
}

is causing the issue (no lang property)

Is this an issue of localeCompare being unavailable for the pertinent block?

It seems well supported on a number of desktop UAs, but maybe less so on mobile ones.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Browser_compatibility

The strange thing here is if the issues is on a supported version of Chrome for Android why it wouldn't work. Anyway, if a UA doesn't support it it seems like lexicographic comparison wouldn't work if I'm reading correctly.

Oh I guess for Chrome the issue is maybe the thing being evaluated lacks the property (like @Jdlrobson says). So my other comment is perhaps an aside...not sure how important it is or if there's some polyfill that guarantees it would work for different UAs.

Disregard. This is the single option version of the method call anyway.

I cannot re-produce this on Chrome 47.0.2526.83, Android 6.0.1 / Nexus 5.

To be clear the issue is the line

allLanguages = allLanguages.sort( compareLanguagesByLanguageCode );

The sort algorithm will break if it runs on a variant (allLanguages variable contains both languages and variants)
I have no time to work on this today but this should be enough information to work on and the patch should be fixed today and SWAT deployed given the A/B test is running in stable (alternatively we should disable that A/B test until this is fixed)

I can replicate this on Chrome desktop now after updating localStorage with:

localStorage.setItem( 'langMap', '{"en":100,"fa":1,"fr":1,"ko":2,"zh":5,"zh-classical":1,"simple":1}' )

Change 276266 had a related patch set uploaded (by Bmansurov):
Add a missing language code

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

@Jdlrobson could you please SWAT this in the evening window? I'm off for the day. Thanks.

Change 276266 merged by jenkins-bot:
Add a missing language code

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

Change 276389 had a related patch set uploaded (by Catrope):
Add a missing language code

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

Change 276390 had a related patch set uploaded (by Catrope):
Add a missing language code

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

Change 276389 merged by jenkins-bot:
Add a missing language code

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

Change 276390 merged by jenkins-bot:
Add a missing language code

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

Change 276444 had a related patch set uploaded (by Bmansurov):
Do not show the parent language if it doesn't exist

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

This appears to be fixed. @Jdlrobson, can you please confirm on your device?

Previously, the structured-overlay associated languageListLoaded events were skewed much lower than expected while a head-to-head test is in force, but now the balance has been restored.

select event_event, event_languageOverlayVersion, count(*)
from MobileWebLanguageSwitcher_15302503
where timestamp > '2016031001'
group by event_event, event_languageOverlayVersion;



event_event	event_languageOverlayVersion	count(*)
exitModal	NULL	194
languageButtonImpression	NULL	20626
languageButtonTap	NULL	299
languageListLoaded	simpler-overlay	169
languageListLoaded	structured-overlay	180
pageLoaded	NULL	61116
startLanguageSearch	NULL	8

Change 276444 merged by jenkins-bot:
Do not show the parent language if it doesn't exist

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