OutputPage: Set wgPageContentLanguage to pageViewLang instead of pageLang
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 8 Mar 2016 23:44:18 +0000 (23:44 +0000)
committerGilles Dubuc <gdubuc@wikimedia.org>
Fri, 11 Mar 2016 08:35:41 +0000 (09:35 +0100)
Follows-up 80a090ea7 (r104483).

I'm assuming the difference is that pageLanguage will be the canonical variant
for the page (as authored in wikitext, presumably the wiki's default), whereas
pageViewLanguage will be the variant of the pageLanguage based on the current
user-interface language (if and only if the user interface is related).

Viewing zh by default has:
* userLanguage: zh
* pageLanguage: zh
* pageViewLanguage: zh

Viewing zh-cn by default has:
* userLanguage: zh
* pageLanguage: zh
* pageViewLanguage: zh-cn

Viewing zh-cn with uselang=en has:
* userLanguage: en
* pageLanguage: zh
* pageViewLanguage: zh-cn

Viewing zh-cn with uselang=zh-tw has:
* userLanguage: zh-tw
* pageLanguage: zh
* pageViewLanguage: zh-cn

The main use case behind wgPageContentLanguage in 80a090ea7 was tablesorter
which should match the language and variant of the rendered wikipage content.

The parser output and div#mw-content-text element use pageViewLanguage, so
let's set wgPageContentLanguage to that as well.

Change-Id: Ibf399dfe5ca60fb55e7acd75a5c0238d8b903807

includes/OutputPage.php

index 11c23f0..e36d83f 100644 (file)
@@ -3218,7 +3218,7 @@ class OutputPage extends ContextSource {
                        $articleId = $wikiPage->getId();
                }
 
-               $lang = $title->getPageLanguage();
+               $lang = $title->getPageViewLanguage();
 
                // Pre-process information
                $separatorTransTable = $lang->separatorTransformTable();