Page MenuHomePhabricator

language and direction are not set at the portal
Closed, ResolvedPublic


The <html> element on is set to lang="mul" and doesn't have a dir attribute. In a certain technical way this is right because there are multiple languages there, but it's not actually correct and must not be done.

The language of most of the page is specifically known and it is the same—that's the language that shows the names and the descriptions of Wikimedia projects, the language of the words "The Free Encyclopedia" at the top, etc. This language's code should be set in the lang attribute of the <html> element and the dir attribute must be set to that language's direction.

The names of the languages of the large and the suggested languages around the globe must be in elements with their own lang and dir elements. If the legal text at the bottom is intentionally left in English for legal reasons, this is reasonable, but then it must be explicitly set to lang="en" dir="ltr".

Not doing this causes real problems. For example the footer-description is shown in Hebrew with incorrect punctuation and direction.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
debt triaged this task as Medium priority.Jan 6 2017, 6:59 PM
debt added a project: Discovery-Portal-Sprint.
debt added subscribers: Jdrewniak, debt.
Jdrewniak raised the priority of this task from Medium to High.Jan 10 2017, 11:55 PM

Change 336634 had a related patch set uploaded (by Jdrewniak):
Adding RTL support to JS translations

Change 336634 merged by jenkins-bot:
Adding RTL support to JS translations

debt claimed this task.
debt moved this task from In Progress to Done on the Discovery-Portal-Sprint board.

Resolving this - as it was pushed to production on Feb 8, 2017 and can be seen in action in this screenshot:

hebrewwikipedia-fix for rtl-8feb2017.jpg (1×1 px, 381 KB)


Thanks for adding the direction attribute.

However, this is not enough, because lang="mul" is not quite correct. It is not too hard to set the correct lang attribute for each of the languages. It is important not only for internal semantic correctness. It also helps browsers set correct fonts. Doing it comprehensively will also help resolving T122053, because you can set the correct dir parameter for each languages along with fixing this issue.

Change 341728 had a related patch set uploaded (by JGirault):
[wikimedia/portals] Fix <html> "lang" attribute incorrectly set

Change 341728 merged by jenkins-bot:
[wikimedia/portals] Fix <html> "lang" attribute incorrectly set