Index: branches/wmf/1.18wmf1/extensions/Translate/MessageGroups.php |
— | — | @@ -1186,6 +1186,11 @@ |
1187 | 1187 | public static function getGroup( $id ) { |
1188 | 1188 | // BC with page| which is now page- |
1189 | 1189 | $id = strtr( $id, '|', '-' ); |
| 1190 | + /* Translatable pages use spaces, but MW occasionally likes to |
| 1191 | + * normalize spaces to underscores */ |
| 1192 | + if ( strpos( $id, 'page-' ) === 0 ) { |
| 1193 | + $id = strtr( $id, '_', ' ' ); |
| 1194 | + } |
1190 | 1195 | self::init(); |
1191 | 1196 | |
1192 | 1197 | global $wgTranslateEC, $wgTranslateAC, $wgTranslateCC; |
Index: branches/wmf/1.18wmf1/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -226,10 +226,12 @@ |
227 | 227 | $_title = Title::makeTitle( $title->getNamespace(), $title->getDBkey() . $suffix ); |
228 | 228 | |
229 | 229 | if ( $parser->getTitle()->getText() === $_title->getText() ) { |
230 | | - $languages[] = Html::rawElement( 'b', null, "*$name* $percent" ); |
231 | | - } elseif ( $code === $userLangCode ) { |
232 | | - $languages[] = $linker->linkKnown( $_title, Html::rawElement( 'b', null, "$name $percent" ) ); |
| 230 | + $name = Html::rawElement( 'span', array( 'class' => 'mw-pt-languages-selected' ), $name ); |
| 231 | + $languages[] = "$name $percent"; |
233 | 232 | } else { |
| 233 | + if ( $code === $userLangCode ) { |
| 234 | + $name = Html::rawElement( 'span', array( 'class' => 'mw-pt-languages-ui' ), $name ); |
| 235 | + } |
234 | 236 | $languages[] = $linker->linkKnown( $_title, "$name $percent" ); |
235 | 237 | } |
236 | 238 | } |
— | — | @@ -438,7 +440,7 @@ |
439 | 441 | |
440 | 442 | $legend = Html::rawElement( |
441 | 443 | 'div', |
442 | | - array( 'style' => 'font-size: x-small; text-align: center;' ), |
| 444 | + array( 'class' => 'mw-pt-translate-header' ), |
443 | 445 | $wgLang->semicolonList( $actions ) |
444 | 446 | ) . Html::element( 'hr' ); |
445 | 447 | |
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialMessageGroupStats.php |
— | — | @@ -36,9 +36,12 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | /// Overwritten from SpecialLanguageStats |
40 | | - protected function getAllowedValues() { |
41 | | - $groups = MessageGroups::getAllGroups(); |
42 | | - return array_keys( $groups ); |
| 40 | + protected function isValidValue( $value ) { |
| 41 | + $group = MessageGroups::getGroup( $value ); |
| 42 | + if ( $group ) { |
| 43 | + $this->target = $group->getId(); |
| 44 | + } |
| 45 | + return (bool) $group; |
43 | 46 | } |
44 | 47 | |
45 | 48 | /// Overwritten from SpecialLanguageStats |
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialLanguageStats.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @file |
7 | 7 | * @author Siebrand Mazeland |
8 | 8 | * @author Niklas Laxström |
9 | | - * @copyright Copyright © 2008-2011 Siebrand Mazeland, Niklas Laxström |
| 9 | + * @copyright Copyright © 2008-2012 Siebrand Mazeland, Niklas Laxström |
10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | 11 | */ |
12 | 12 | |
— | — | @@ -109,23 +109,20 @@ |
110 | 110 | $this->noEmpty = (bool)$params[2]; |
111 | 111 | } |
112 | 112 | |
113 | | - // Whether the form has been submitted |
114 | | - $submitted = $request->getVal( 'x' ) === 'D'; |
| 113 | + // Whether the form has been submitted, only relevant if not including |
| 114 | + $submitted = !$this->including() && $request->getVal( 'x' ) === 'D'; |
115 | 115 | |
116 | 116 | // Default booleans to false if the form was submitted |
117 | | - if ( !$this->including() ) { |
118 | | - $this->target = $request->getVal( $this->targetValueName, $this->target ); |
119 | | - $this->noComplete = $request->getBool( 'suppresscomplete', $this->noComplete && !$submitted ); |
120 | | - $this->noEmpty = $request->getBool( 'suppressempty', $this->noEmpty && !$submitted ); |
121 | | - } |
| 117 | + $this->target = $request->getVal( $this->targetValueName, $this->target ); |
| 118 | + $this->noComplete = $request->getBool( 'suppresscomplete', $this->noComplete && !$submitted ); |
| 119 | + $this->noEmpty = $request->getBool( 'suppressempty', $this->noEmpty && !$submitted ); |
122 | 120 | |
123 | 121 | if ( !$this->including() ) { |
124 | 122 | TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Statistics_and_reporting' ); |
125 | 123 | $wgOut->addHTML( $this->getForm() ); |
126 | 124 | } |
127 | 125 | |
128 | | - $allowedValues = $this->getAllowedValues(); |
129 | | - if ( in_array( $this->target, $allowedValues, true ) ) { |
| 126 | + if ( $this->isValidValue( $this->target ) ) { |
130 | 127 | $this->outputIntroduction(); |
131 | 128 | $output = $this->getTable(); |
132 | 129 | if ( $this->incomplete ) { |
— | — | @@ -145,9 +142,9 @@ |
146 | 143 | * Return the list of allowed values for target here. |
147 | 144 | * @return array |
148 | 145 | */ |
149 | | - protected function getAllowedValues() { |
| 146 | + protected function isValidValue( $value ) { |
150 | 147 | $langs = Language::getLanguageNames( false ); |
151 | | - return array_keys( $langs ); |
| 148 | + return isset( $langs[$value] ); |
152 | 149 | } |
153 | 150 | |
154 | 151 | /// Called when the target is unknown. |
Index: branches/wmf/1.18wmf1/extensions/Translate/resources/ext.translate.css |
— | — | @@ -27,3 +27,17 @@ |
28 | 28 | .mw-pt-languages-list { |
29 | 29 | padding: 0.5em; |
30 | 30 | } |
| 31 | + |
| 32 | +.mw-pt-translate-header { |
| 33 | + font-size: x-small; |
| 34 | + text-align: center; |
| 35 | +} |
| 36 | + |
| 37 | +/* The *stars* should be replaceable with bunnies */ |
| 38 | +.mw-pt-languages-selected:before, .mw-pt-languages-selected:after { |
| 39 | + content: '*'; |
| 40 | +} |
| 41 | + |
| 42 | +.mw-pt-languages-selected, .mw-pt-languages-ui { |
| 43 | + font-weight: bold; |
| 44 | +} |