Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | public function factory( $id ) { |
131 | 131 | |
132 | 132 | $info = $this->groups[$id]; |
133 | | - $group = ExtensionMessageGroup::factory( $info['name'] . ' (mw ext)', $id ); |
| 133 | + $group = ExtensionMessageGroup::factory( $info['name'], $id ); |
134 | 134 | $group->setMessageFile( $info['file'] ); |
135 | 135 | if ( !empty($info['var']) ) $group->setVariableName( $info['var'] ); |
136 | 136 | if ( !empty($info['optional']) ) $group->setOptional( $info['optional'] ); |
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-06-30:2)' ); |
| 15 | +define( 'TRANSLATE_VERSION', '9 (2008-06-30:3)' ); |
16 | 16 | |
17 | 17 | $wgExtensionCredits['specialpage'][] = array( |
18 | 18 | 'name' => 'Translate', |
Index: trunk/extensions/Translate/MessageChecks.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | 'mediawiki' => array( |
17 | 17 | array( __CLASS__, 'checkPlural' ), |
18 | 18 | array( __CLASS__, 'checkParameters' ), |
| 19 | + array( __CLASS__, 'checkUnknownParametersParameters' ), |
19 | 20 | array( __CLASS__, 'checkBalance' ), |
20 | 21 | array( __CLASS__, 'checkLinks' ), |
21 | 22 | array( __CLASS__, 'checkXHTML' ), |
— | — | @@ -90,6 +91,32 @@ |
91 | 92 | return false; |
92 | 93 | } |
93 | 94 | |
| 95 | + protected static function checkUnknownParameters( TMessage $message, &$desc = null ) { |
| 96 | + $variables = array( '\$1', '\$2', '\$3', '\$4', '\$5', '\$6', '\$7', '\$8', '\$9' ); |
| 97 | + |
| 98 | + $missing = array(); |
| 99 | + $definition = $message->definition; |
| 100 | + $translation= $message->translation; |
| 101 | + if ( strpos( $definition, '$' ) === false ) return false; |
| 102 | + |
| 103 | + for ( $i = 1; $i < 10; $i++ ) { |
| 104 | + $pattern = '/\$' . $i . '/s'; |
| 105 | + if ( !preg_match( $pattern, $definition ) && preg_match( $pattern, $translation ) ) { |
| 106 | + $missing[] = '$' . $i; |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + if ( $count = count($missing) ) { |
| 111 | + global $wgLang; |
| 112 | + $desc = array( 'translate-checks-parameters-unknown', |
| 113 | + implode( ', ', $missing ), |
| 114 | + $wgLang->formatNum($count) ); |
| 115 | + return true; |
| 116 | + } |
| 117 | + |
| 118 | + return false; |
| 119 | + } |
| 120 | + |
94 | 121 | /** |
95 | 122 | * Checks if the translation has even number of opening and closing |
96 | 123 | * parentheses. {, [ and ( are checked. |
Index: trunk/extensions/Translate/README |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | |
36 | 36 | == Changes in version 10 == |
37 | 37 | |
| 38 | +* 2008-06-30:3 Check for unknown vars for mediawiki type |
38 | 39 | * 2008-06-30:2 Checks for missing and unknown variables for FreeCol |
39 | 40 | * 2008-06-30:1 More contrast in the new default page for Special translate |
40 | 41 | * 2008-06-29:2 Branched core messages now load translations from trunk files too |