r33938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r33937‎ | r33938 | r33939 >
Date:14:50, 27 April 2008
Author:minuteelectron
Status:old
Tags:
Comment:
Revert r33918, no longer works given new fallback caching and there are alternate methods for determining message fallback.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/MessageCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -447,17 +447,15 @@
448448 * @param string $langcode Code of the language to get the message for, or
449449 * behaves as a content language switch if it is a
450450 * boolean.
451 - * @param bool $fallback Whether or not to fallback to a different language if
452 - * it is not found in the selected one.
453451 * @return string
454452 * @private
455453 */
456 -function wfMsgGetKey( $key, $useDB, $langCode = false, $transform = true, $fallback = true ) {
 454+function wfMsgGetKey( $key, $useDB, $langCode = false, $transform = true ) {
457455 global $wgParser, $wgContLang, $wgMessageCache, $wgLang;
458456
459457 # If $wgMessageCache isn't initialised yet, try to return something sensible.
460458 if( is_object( $wgMessageCache ) ) {
461 - $message = $wgMessageCache->get( $key, $useDB, $langCode, false, $fallback );
 459+ $message = $wgMessageCache->get( $key, $useDB, $langCode );
462460 if ( $transform ) {
463461 $message = $wgMessageCache->transform( $message );
464462 }
@@ -566,7 +564,6 @@
567565 * <i>replaceafter</i>: parameters are substituted after parsing or escaping
568566 * <i>parsemag</i>: transform the message using magic phrases
569567 * <i>content</i>: fetch message for content language instead of interface
570 - * <i>nofallback</i>: do not fallback to a different language
571568 * <i>language</i>: language code to fetch message for (overriden by <i>content</i>), its behaviour
572569 * with parser, parseinline and parsemag is undefined.
573570 * Behavior for conflicting options (e.g., parse+parseinline) is undefined.
@@ -597,10 +594,8 @@
598595 $langCode = false;
599596 }
600597
601 - $fallback = !in_array('nofallback', $options);
 598+ $string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false );
602599
603 - $string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false, /*Fallback*/$fallback );
604 -
605600 if( !in_array('replaceafter', $options) ) {
606601 $string = wfMsgReplaceArgs( $string, $args );
607602 }
Index: trunk/phase3/includes/MessageCache.php
@@ -407,10 +407,8 @@
408408 * use the wikis content language (also as a
409409 * fallback).
410410 * @param bool $isFullKey Specifies whether $key is a two part key "lang/msg".
411 - * @param bool $fallback Whether or not to fallback to a different language if
412 - * it is not found in the selected one.
413411 */
414 - function get( $key, $useDB = true, $langcode = true, $isFullKey = false, $fallback = true ) {
 412+ function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
415413 global $wgContLanguageCode, $wgContLang, $wgLang;
416414
417415 # Identify which language to get or create a language object for.
@@ -478,11 +476,6 @@
479477 }
480478 }
481479
482 - # Don't fall back if asked not to.
483 - if( !$fallback ) {
484 - return '&lt;' . htmlspecialchars($key) . '&gt;';
485 - }
486 -
487480 # Try the array of another language
488481 $pos = strrpos( $lckey, '/' );
489482 if( $message === false && $pos !== false) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r33918* Add parameter to MessageCache::get() to allow prevention of using a fallbac...minuteelectron18:05, 26 April 2008

Status & tagging log