Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'TRANSLATE_VERSION', '9 (2008-07-15:1)' ); |
| 15 | +define( 'TRANSLATE_VERSION', '9 (2008-07-15:2)' ); |
16 | 16 | |
17 | 17 | $wgExtensionCredits['specialpage'][] = array( |
18 | 18 | 'name' => 'Translate', |
Index: trunk/extensions/Translate/MessageChecks.php |
— | — | @@ -13,12 +13,13 @@ |
14 | 14 | // Fastest first |
15 | 15 | var $checksForType = array( |
16 | 16 | 'mediawiki' => array( |
17 | | - 'checkPlural', |
| 17 | + /*'checkPlural', |
18 | 18 | 'checkParameters', |
19 | 19 | 'checkUnknownParameters', |
20 | 20 | 'checkBalance', |
21 | 21 | 'checkLinks', |
22 | | - 'checkXHTML', |
| 22 | + 'checkXHTML',*/ |
| 23 | + 'checkPagename', |
23 | 24 | ), |
24 | 25 | 'freecol' => array( |
25 | 26 | 'checkFreeColMissingVars', |
— | — | @@ -271,6 +272,28 @@ |
272 | 273 | } |
273 | 274 | |
274 | 275 | |
| 276 | + /** |
| 277 | + * Checks for page names having untranslated namespace. |
| 278 | + * |
| 279 | + * @param $message Instance of TMessage. |
| 280 | + * @return True if namespace has been tampered with. |
| 281 | + */ |
| 282 | + protected function checkPagename( TMessage $message, $code, &$desc = null ) { |
| 283 | + $definition = $message->definition; |
| 284 | + $translation = $message->translation; |
| 285 | + |
| 286 | + $namespaces = 'help|project|\{\{ns:project}}|mediawiki'; |
| 287 | + $matches = array(); |
| 288 | + if ( preg_match( "/^($namespaces):[\w\s]+$/ui", $definition, $matches ) ) { |
| 289 | + if ( !preg_match( "/^{$matches[1]}:.+$/u", $translation) ) { |
| 290 | + $desc = array( 'translate-checks-pagename' ); |
| 291 | + return true; |
| 292 | + } |
| 293 | + } |
| 294 | + return false; |
| 295 | + } |
| 296 | + |
| 297 | + |
275 | 298 | protected function checkFreeColMissingVars( TMessage $message, $code, &$desc = null ) { |
276 | 299 | if ( !preg_match_all( '/%[^% ]+%/U', $message->definition, $defVars ) ) { |
277 | 300 | return false; |
Index: trunk/extensions/Translate/README |
— | — | @@ -34,7 +34,8 @@ |
35 | 35 | |
36 | 36 | == Changes in version 10 == |
37 | 37 | |
38 | | -* 2008-07-14:1 |
| 38 | +* 2008-07-15:2 new check for unaltered namespaces in pagename messages of MediaWiki |
| 39 | +* 2008-07-15:1 |
39 | 40 | - improved message checks |
40 | 41 | - can now work for meta groups too |
41 | 42 | - fixed messages not shown in the list anymore, but script still needed to find |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | |
25 | 25 | // Cache some amount of titles for speed |
26 | 26 | static $cache = array(); |
27 | | - if ( count($cache)>500 ) $cache = array(); |
| 27 | + if ( count($cache)>5000 ) $cache = array(); |
28 | 28 | if ( !isset($cache[$message]) ) { |
29 | 29 | $cache[$message] = $wgContLang->ucfirst($message); |
30 | 30 | } |