Page MenuHomePhabricator

lang="undefined" on translated elements on wikimedia.org portal
Open, Needs TriagePublic

Description

To reproduce

  • Set browser preferences for a language other than English (e.g. French)
  • Visit https://www.wikimedia.org/
  • Inspect a translated element e.g. the Wikipedia tagline "L’encyclopédie libre"

Expected result

  • Element has the correct lang attribute (fr)

Actual result

  • Element has the attribute lang="undefined"

This seems to work fine on other portals e.g. https://www.wikipedia.org/

Event Timeline

@Aklapper, I believe the issue is that in index.handlebars, the <html lang="en"> tag is currently hard-coded instead of referencing a dynamic language variable. This is likely causing the problem.

Please let me know if my understanding is correct so that I can proceed with further work on it.

@RJ2904: Hi, why do you ping me specifically, plus why do you think I'd have any idea (because I don't)?
In any case, feel free to proceed further by verifying your understanding via testing yourself. :)

@RJ2904 I don't think that's the issue, all the portals have that hardcoded in the handlebars and then as far as I can tell function addHtmlLang in page-localized.js overwrites it with the correct one. The problem is with the other page elements, which I think are handled by replacel10nText in the same file.

@Aklapper, I sincerely apologize for this. Someone on Phabricator mentioned that there's no need to ping the person who authored the issue, so I had no choice but to ask you instead.

@RJ2904: Well there is a choice: You can also post a comment which does not mention any people. :P More seriously: Heh, no worries!

@Pcoombe I don't think the problem lies in page-localized.js because it is a common file used in both Wikipedia and Wikimedia, so if it gives the correct output for Wikipedia, then the same will happen for Wikimedia. We need to ensure that the localization data for Wikimedia is correctly loaded.