Page MenuHomePhabricator

Language button in article search displays "null" on first use
Closed, ResolvedPublic

Description

  1. Create new account
  2. Enable CX
  3. Go to CX

Observe the language button's label is "null"

image.png (286×1 px, 18 KB)

Event Timeline

Thank you @Esanders for reporting this.
I saw this error once in some unusual circumstances and wasn't able to reproduce it ever again. When you reported, I decided to look into what causes this problem.

This requires:

  • Content and UI language to be the same (which is usually the case)
  • Browser language same as previous two. Or if some language code unrecognized by ULS is used, like 'en-us'
  • There are no previous ULS languages (easily the case for new and monolingual users)
  • Accepted language list isn't altered. Usually browsers use 'en-us' and 'en' as defaults. In Chrome, you can add more (probably most users don't). Don't know about other browsers
  • Country code is not available

All of the above prerequisites aren't that unusual, especially for new users, who decide to try Content Translation soon after account creation. Probably most affected are new users of wikis where content language is English, because browser language is often also set to English.

We don't have any reasonable info about the user in such case. In the past, this case was resolved to using Spanish as source language. Here are the top languages from which users translate to English:

#TranslationsLanguage
11,365español
21,174français
3741Deutsch
4453italiano
5417português

Given the above analysis, I think we should fallback to Spanish as source language if English is the target language. If some non-English language is used as target, we should fallback to English, as most translation come from English anyway.

@Amire80, do you have other ideas?

Change 455210 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Fix null being used as source language

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

Change 455210 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Fix null being used as source language

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

Petar.petkovic claimed this task.
Petar.petkovic moved this task from Check & Move to Bugs on the ContentTranslation board.

This is long resolved, just wasn't closed.