Index: trunk/phase3/languages/Language.php |
— | — | @@ -2565,16 +2565,8 @@ |
2566 | 2566 | $this->namespaceNames[NS_PROJECT_TALK] = $wgMetaNamespaceTalk; |
2567 | 2567 | } else { |
2568 | 2568 | $talk = $this->namespaceNames[NS_PROJECT_TALK]; |
2569 | | - $talk = str_replace( '$1', $wgMetaNamespace, $talk ); |
2570 | | - |
2571 | | - # Allow grammar transformations |
2572 | | - # Allowing full message-style parsing would make simple requests |
2573 | | - # such as action=raw much more expensive than they need to be. |
2574 | | - # This will hopefully cover most cases. |
2575 | | - $talk = preg_replace_callback( '/{{grammar:(.*?)\|(.*?)}}/i', |
2576 | | - array( &$this, 'replaceGrammarInNamespace' ), $talk ); |
2577 | | - $talk = str_replace( ' ', '_', $talk ); |
2578 | | - $this->namespaceNames[NS_PROJECT_TALK] = $talk; |
| 2569 | + $this->namespaceNames[NS_PROJECT_TALK] = |
| 2570 | + $this->fixVariableInNamespace( $talk ); |
2579 | 2571 | } |
2580 | 2572 | |
2581 | 2573 | # The above mixing may leave namespaces out of canonical order. |
— | — | @@ -2591,6 +2583,9 @@ |
2592 | 2584 | } |
2593 | 2585 | if ( $this->namespaceAliases ) { |
2594 | 2586 | foreach ( $this->namespaceAliases as $name => $index ) { |
| 2587 | + if ( $index === NS_PROJECT_TALK ) { |
| 2588 | + $name = $this->fixVariableInNamespace( $name ); |
| 2589 | + } |
2595 | 2590 | $this->mNamespaceIds[$this->lc($name)] = $index; |
2596 | 2591 | } |
2597 | 2592 | } |
— | — | @@ -2606,6 +2601,21 @@ |
2607 | 2602 | wfProfileOut( __METHOD__ ); |
2608 | 2603 | } |
2609 | 2604 | |
| 2605 | + function fixVariableInNamespace( $talk ) { |
| 2606 | + if ( strpos( $talk, '$1' ) === false ) return $talk; |
| 2607 | + |
| 2608 | + global $wgMetaNamespace; |
| 2609 | + $talk = str_replace( '$1', $wgMetaNamespace, $talk ); |
| 2610 | + |
| 2611 | + # Allow grammar transformations |
| 2612 | + # Allowing full message-style parsing would make simple requests |
| 2613 | + # such as action=raw much more expensive than they need to be. |
| 2614 | + # This will hopefully cover most cases. |
| 2615 | + $talk = preg_replace_callback( '/{{grammar:(.*?)\|(.*?)}}/i', |
| 2616 | + array( &$this, 'replaceGrammarInNamespace' ), $talk ); |
| 2617 | + return str_replace( ' ', '_', $talk ); |
| 2618 | + } |
| 2619 | + |
2610 | 2620 | function replaceGrammarInNamespace( $m ) { |
2611 | 2621 | return $this->convertGrammar( trim( $m[2] ), trim( $m[1] ) ); |
2612 | 2622 | } |