Index: trunk/extensions/Translate/groupStatistics.php |
— | — | @@ -40,6 +40,8 @@ |
41 | 41 | --help : this helpful message |
42 | 42 | --groups : comma separated list of groups |
43 | 43 | --skiplanguages : comma separated list of languages that should be skipped |
| 44 | + --skipzero : skip languages that don't have any localisation at all |
| 45 | + --fuzzy : add column for fuzzy counts |
44 | 46 | --output : select an output engine one of: |
45 | 47 | * 'csv' : Comma Separated Values. |
46 | 48 | * 'wiki' : MediaWiki syntax (default). |
— | — | @@ -111,6 +113,9 @@ |
112 | 114 | foreach ( $groups as $g ) { |
113 | 115 | // Add unprocessed description of group as heading |
114 | 116 | $out->element( $g->getLabel(), true ); |
| 117 | + if ( isset($options['fuzzy']) ) { |
| 118 | + $out->element( 'Fuzzy', true ); |
| 119 | + } |
115 | 120 | } |
116 | 121 | $out->blockend(); |
117 | 122 | |
— | — | @@ -120,11 +125,9 @@ |
121 | 126 | // Skip list |
122 | 127 | if ( in_array( $code, $skipLanguages ) ) continue; |
123 | 128 | |
124 | | - $out->blockstart(); |
125 | | - $out->element( $code ); |
126 | | - $out->element( $name ); |
| 129 | + $allZero = true; |
| 130 | + $columns = array(); |
127 | 131 | |
128 | | - |
129 | 132 | foreach ( $groups as $g ) { |
130 | 133 | // Initialise messages |
131 | 134 | $messages = $g->initCollection( $code ); |
— | — | @@ -139,6 +142,7 @@ |
140 | 143 | |
141 | 144 | // Store the count of real messages for later calculation. |
142 | 145 | $total = count( $messages ); |
| 146 | + $fuzzy = 0; |
143 | 147 | |
144 | 148 | // Get all translations. Could this be done more efficient? |
145 | 149 | $g->fillCollection( $messages ); |
— | — | @@ -148,18 +152,33 @@ |
149 | 153 | if ( $messages[$key]->translation === null ) { |
150 | 154 | unset( $messages[$key] ); |
151 | 155 | } elseif ( $messages[$key]->fuzzy ) { |
| 156 | + $fuzzy++; |
152 | 157 | unset( $messages[$key] ); |
153 | 158 | } |
154 | 159 | } |
155 | 160 | |
156 | 161 | // Count the completion percent and output it |
157 | 162 | $translated = count( $messages ); |
| 163 | + if ( $translated !== 0 ) $allZero = false; |
158 | 164 | |
159 | | - $out->element( $out->formatPercent( $translated, $total, |
160 | | - /* Inverted color */ false, /* Decimals */ 2 ) |
161 | | - ); |
| 165 | + $columns[] = $out->formatPercent( $translated, $total, |
| 166 | + /* Inverted color */ false, /* Decimals */ 2 ); |
| 167 | + |
| 168 | + if ( isset($options['fuzzy']) ) { |
| 169 | + $columns[] = $out->formatPercent( $fuzzy, $total, |
| 170 | + /* Inverted color */ true, /* Decimals */ 2 ); |
| 171 | + } |
| 172 | + |
162 | 173 | } |
163 | 174 | |
| 175 | + if ( $allZero && isset($options['skipzero']) ) continue; |
| 176 | + |
| 177 | + $out->blockstart(); |
| 178 | + $out->element( $code ); |
| 179 | + $out->element( $name ); |
| 180 | + |
| 181 | + foreach ( $columns as $c ) $out->element( $c ); |
| 182 | + |
164 | 183 | $out->blockend(); |
165 | 184 | } |
166 | 185 | |
Index: trunk/extensions/Translate/README |
— | — | @@ -48,6 +48,7 @@ |
49 | 49 | * support for having messages in namespaces other than NS_MEDIAWIKi |
50 | 50 | * try to load qqq from files if not found from the database |
51 | 51 | * added $wgTranslateAuthorBlacklist |
| 52 | +* new options to groupStatistics.php: --fuzzy and --skipzero |
52 | 53 | |
53 | 54 | == Changes in version 8 == |
54 | 55 | * Released 2008-02-06 |