Use MessageCache::getMsgFromNamespace() to fetch conversion tables.
authorLiangent <liangent@gmail.com>
Tue, 26 Mar 2013 15:42:48 +0000 (23:42 +0800)
committerLiangent <liangent@gmail.com>
Thu, 28 Mar 2013 05:47:56 +0000 (13:47 +0800)
After Iaaf6cceb, MessageCache::get() goes through the fallback chain,
which is unwanted for conversion tables (for example, we don't want
zh-hans table for zh, where zh means "no conversion"). Since the only
needed feature is to fetch text from MediaWiki namespace (conversion
tables in PHP are stored somewhere else), it is now changed to use
MessageCache::getMsgFromNamespace() instead to avoid fallbacks.

Change-Id: I46e0be31c9c0fe0a6e4923fc1aff0fbbadbf1d67

includes/cache/MessageCache.php
languages/LanguageConverter.php

index 7425978..dd29b21 100644 (file)
@@ -729,6 +729,10 @@ class MessageCache {
         * Get a message from the MediaWiki namespace, with caching. The key must
         * first be converted to two-part lang/msg form if necessary.
         *
+        * Unlike self::get(), this function doesn't resolve fallback chains, and
+        * some callers require this behavior. LanguageConverter::parseCachedTable()
+        * and self::get() are some examples in core.
+        *
         * @param string $title Message cache key with initial uppercase letter.
         * @param string $code code denoting the language to try.
         *
index 43afe65..e36c085 100644 (file)
@@ -941,7 +941,7 @@ class LanguageConverter {
                $parsed[$key] = true;
 
                if ( $subpage === '' ) {
-                       $txt = MessageCache::singleton()->get( 'conversiontable', true, $code );
+                       $txt = MessageCache::singleton()->getMsgFromNamespace( $key, $code );
                } else {
                        $txt = false;
                        $title = Title::makeTitleSafe( NS_MEDIAWIKI, $key );