r104483 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104482‎ | r104483 | r104484 >
Date:20:53, 28 November 2011
Author:robin
Status:ok (Comments)
Tags:
Comment:
* (bug 27721) Make JavaScript variables wgSeparatorTransformTable and wgDigitTransformTable depend on page content language so the sort script sorts correctly more often. It will e.g. sort according to the user language on special pages, where localised numbers are usually used.
* New JavaScript variable wgPageContentLanguage (independent from the bug, but I assume this var can be useful)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -97,6 +97,7 @@
9898 and adding paths to the PathRouter.
9999 * (bug 32666) Special:ActiveUsers now allows a subpage to be used as the
100100 username (eg. Special:ActiveUsers/Username)
 101+* New JavaScript variable wgPageContentLanguage
101102
102103 === Bug fixes in 1.19 ===
103104 * $wgUploadNavigationUrl should be used for file redlinks if.
@@ -163,6 +164,9 @@
164165 * (bug 29475) Remove "trackback" feature entirely from core
165166 * (bug 32665) Special:BlockList prefills the username in the input field if
166167 using the Special:BlockList\username URL
 168+* (bug 27721) Make JavaScript variables wgSeparatorTransformTable and
 169+ wgDigitTransformTable depend on page content language so the sort script
 170+ sorts correctly more often
167171
168172 === API changes in 1.19 ===
169173 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/OutputPage.php
@@ -2727,6 +2727,22 @@
27282728 $canonicalName = false; # bug 21115
27292729 }
27302730
 2731+ $lang = $title->getPageLanguage();
 2732+
 2733+ // Pre-process information
 2734+ $separatorTransTable = $lang->separatorTransformTable();
 2735+ $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
 2736+ $compactSeparatorTransTable = array(
 2737+ implode( "\t", array_keys( $separatorTransTable ) ),
 2738+ implode( "\t", $separatorTransTable ),
 2739+ );
 2740+ $digitTransTable = $lang->digitTransformTable();
 2741+ $digitTransTable = $digitTransTable ? $digitTransTable : array();
 2742+ $compactDigitTransTable = array(
 2743+ implode( "\t", array_keys( $digitTransTable ) ),
 2744+ implode( "\t", $digitTransTable ),
 2745+ );
 2746+
27312747 $vars = array(
27322748 'wgCanonicalNamespace' => $nsname,
27332749 'wgCanonicalSpecialPageName' => $canonicalName,
@@ -2741,8 +2757,10 @@
27422758 'wgUserGroups' => $this->getUser()->getEffectiveGroups(),
27432759 'wgCategories' => $this->getCategories(),
27442760 'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
 2761+ 'wgPageContentLanguage' => $lang->getCode(),
 2762+ 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
 2763+ 'wgDigitTransformTable' => $compactDigitTransTable,
27452764 );
2746 - $lang = $this->getTitle()->getPageLanguage();
27472765 if ( $lang->hasVariants() ) {
27482766 $vars['wgUserVariant'] = $lang->getPreferredVariant();
27492767 }
Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -40,19 +40,6 @@
4141 $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
4242 $wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgLegacyJavaScriptGlobals;
4343
44 - // Pre-process information
45 - $separatorTransTable = $wgContLang->separatorTransformTable();
46 - $separatorTransTable = $separatorTransTable ? $separatorTransTable : array();
47 - $compactSeparatorTransTable = array(
48 - implode( "\t", array_keys( $separatorTransTable ) ),
49 - implode( "\t", $separatorTransTable ),
50 - );
51 - $digitTransTable = $wgContLang->digitTransformTable();
52 - $digitTransTable = $digitTransTable ? $digitTransTable : array();
53 - $compactDigitTransTable = array(
54 - implode( "\t", array_keys( $digitTransTable ) ),
55 - implode( "\t", $digitTransTable ),
56 - );
5744 $mainPage = Title::newMainPage();
5845
5946 /**
@@ -91,8 +78,6 @@
9279 'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(),
9380 'wgMonthNames' => $wgContLang->getMonthNamesArray(),
9481 'wgMonthNamesShort' => $wgContLang->getMonthAbbreviationsArray(),
95 - 'wgSeparatorTransformTable' => $compactSeparatorTransTable,
96 - 'wgDigitTransformTable' => $compactDigitTransTable,
9782 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null,
9883 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
9984 'wgNamespaceIds' => $namespaceIds,

Comments

#Comment by Nikerabbit (talk | contribs)   11:05, 2 December 2011

Can you provide test cases?

#Comment by SPQRobin (talk | contribs)   23:22, 3 December 2011

I don't yet know how to write tests, but most importantly I don't know in which way I could/should test this. Will try to figure that out.

I can give you examples to see how this works: sorting e.g. https://translatewiki.net/wiki/Special:ContributionScores?uselang=fa (where page content language [fa] matches language of numbers [fa]) works, versus sorting e.g. https://translatewiki.net/wiki/User:SPQRobin/sandbox?uselang=fa#Special:ContributionScores (where page content language [en] doesn't match language of numbers [fa]) doesn't work. Previously both didn't work.

#Comment by Krinkle (talk | contribs)   11:26, 2 January 2012
#Comment by Nikerabbit (talk | contribs)   11:53, 2 January 2012

Hey that page is awesome with the list of version information.

#Comment by SPQRobin (talk | contribs)   14:50, 2 January 2012

Thanks for updating. (And it seems the docs for wgSeparatorTransformTable/wgDigitTransformTable were a bit wrong, they weren't according to the user language)

Status & tagging log