Index: trunk/phase3/maintenance/language/checkExtensioni18n.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $wgDisplayLevel = 2; |
42 | 42 | $wgChecks = array( 'untranslated', 'obsolete', 'variables', 'empty', 'whitespace', 'xhtml', 'chars' ); |
43 | 43 | |
44 | | -$optionsWithArgs = array( 'extdir' ); |
| 44 | +$optionsWithArgs = array( 'extdir', 'mylang' ); |
45 | 45 | |
46 | 46 | require_once( dirname(__FILE__).'/../commandLine.inc' ); |
47 | 47 | require_once( 'languages.inc' ); |
— | — | @@ -130,8 +130,12 @@ |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | | - |
135 | | -function checkExtensionLanguage( $filename, $arrayname ) { |
| 134 | +/** |
| 135 | + * @param $filename Filename containing the extension i18n |
| 136 | + * @param $arrayname The name of the array in the filename |
| 137 | + * @param $filter Optional, restrict check to a given language code (default; null) |
| 138 | + */ |
| 139 | +function checkExtensionLanguage( $filename, $arrayname, $filter = null ) { |
136 | 140 | global $wgGeneralMessages, $wgRequiredMessagesNumber; |
137 | 141 | |
138 | 142 | $extLanguages = new extensionLanguages($filename, $arrayname); |
— | — | @@ -146,15 +150,20 @@ |
147 | 151 | return false; |
148 | 152 | } |
149 | 153 | |
150 | | - print "Found ". count($langs) . " languages : " . implode(' ', $langs) ."\n"; |
151 | | - foreach( $langs as $lang ) { |
152 | | - if( $lang == 'en' ) { |
153 | | - #print "Skipped english language\n"; |
154 | | - continue; |
| 154 | + if( $filter ) { |
| 155 | + checkLanguage( $extLanguages, $filter ); |
| 156 | + } else { |
| 157 | + print "Found ". count($langs) . " languages : " . implode(' ', $langs) ."\n"; |
| 158 | + foreach( $langs as $lang ) { |
| 159 | + if( $lang == 'en' ) { |
| 160 | + #print "Skipped english language\n"; |
| 161 | + continue; |
| 162 | + } |
| 163 | + |
| 164 | + checkLanguage( $extLanguages, $lang ); |
155 | 165 | } |
| 166 | + } |
156 | 167 | |
157 | | - checkLanguage( $extLanguages, $lang ); |
158 | | - } |
159 | 168 | } |
160 | 169 | |
161 | 170 | function checkExtensionRepository( $extdir, $db ) { |
— | — | @@ -188,7 +197,8 @@ |
189 | 198 | |
190 | 199 | $i18n_file = $extdir . '/' . $i18n_file ; |
191 | 200 | |
192 | | - checkExtensionLanguage( $i18n_file, $arrayname ); |
| 201 | + global $myLang; |
| 202 | + checkExtensionLanguage( $i18n_file, $arrayname, $myLang ); |
193 | 203 | |
194 | 204 | print "\n"; |
195 | 205 | } |
— | — | @@ -200,14 +210,19 @@ |
201 | 211 | print <<<END |
202 | 212 | Usage: |
203 | 213 | php checkExtensioni18n.php <filename> <arrayname> |
204 | | - php checkExtensioni18n.php --extdir <exstention repository> |
| 214 | + php checkExtensioni18n.php --extdir <extension repository> |
205 | 215 | |
| 216 | +Common option: |
| 217 | + --mylang <language code> : only check the given language. |
206 | 218 | |
| 219 | + |
207 | 220 | END; |
208 | 221 | die; |
209 | 222 | } |
210 | 223 | |
211 | 224 | // Play with options and arguments |
| 225 | +$myLang = $options['mylang']; |
| 226 | + |
212 | 227 | if( isset( $options['extdir'] ) ) { |
213 | 228 | $extdb = $options['extdir'] . '/' . EXT_I18N_DB ; |
214 | 229 | |
— | — | @@ -235,7 +250,8 @@ |
236 | 251 | usage(); |
237 | 252 | } |
238 | 253 | |
239 | | - checkExtensionLanguage( $filename, $arrayname ); |
| 254 | + global $myLang; |
| 255 | + checkExtensionLanguage( $filename, $arrayname, $myLang ); |
240 | 256 | } else { |
241 | 257 | usage(); |
242 | 258 | } |