Index: trunk/extensions/Translate/scripts/createCheckIndex.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | $checker = MessageChecks::getInstance(); |
38 | 38 | |
39 | 39 | foreach ( $groups as $g ) { |
| 40 | + |
40 | 41 | $id = $g->getId(); |
41 | 42 | |
42 | 43 | // Skip groups that are not requested |
— | — | @@ -44,7 +45,6 @@ |
45 | 46 | continue; |
46 | 47 | } |
47 | 48 | |
48 | | - $problematic = array(); |
49 | 49 | $type = $g->getType(); |
50 | 50 | if ( !$checker->hasChecks( $type ) ) { |
51 | 51 | unset( $g ); |
— | — | @@ -52,15 +52,17 @@ |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Initialise messages, using unique definitions if appropriate |
56 | | - $collection_skel = $g->initCollection( 'en', true ); |
57 | | - if ( !count( $collection_skel ) ) continue; |
| 56 | + $collection = $g->initCollection( 'en', true ); |
| 57 | + if ( !count( $collection ) ) continue; |
58 | 58 | |
59 | 59 | STDOUT( "Working with $id: ", $id ); |
60 | 60 | |
61 | 61 | foreach ( $codes as $code ) { |
62 | 62 | STDOUT( "$code ", $id ); |
63 | 63 | |
64 | | - $collection->reset( $code ); |
| 64 | + $problematic = array(); |
| 65 | + |
| 66 | + $collection->resetForNewLanguage( $code ); |
65 | 67 | $collection->loadTranslations(); |
66 | 68 | |
67 | 69 | foreach ( $collection as $key => $message ) { |
— | — | @@ -74,15 +76,35 @@ |
75 | 77 | } |
76 | 78 | |
77 | 79 | // Add it to the array |
78 | | - $problematic[$code][] = $key; |
| 80 | + $problematic[] = array( $g->namespaces[0], $key ); |
79 | 81 | } |
80 | 82 | } |
| 83 | + |
| 84 | + tagFuzzy( $problematic ); |
81 | 85 | } |
| 86 | +} |
82 | 87 | |
83 | | - // Store the results |
84 | | - $file = TRANSLATE_CHECKFILE . "-$id"; |
85 | | - wfMkdirParents( dirname( $file ) ); |
86 | | - file_put_contents( $file, serialize( $problematic ) ); |
| 88 | + |
| 89 | +function tagFuzzy( $problematic ) { |
| 90 | + if ( !count($problematic) ) return; |
| 91 | + |
| 92 | + $db = wfGetDB( DB_MASTER ); |
| 93 | + $id = $db->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 94 | + foreach ( $problematic as $p ) { |
| 95 | + $title = Title::makeTitleSafe( $p[0], $p[1] ); |
| 96 | + $titleText = $title->getDBKey(); |
| 97 | + $res = $db->select( 'page', array( 'page_id', 'page_latest' ), |
| 98 | + array( 'page_namespace' => $p[0], 'page_title' => $titleText ), __METHOD__ ); |
| 99 | + |
| 100 | + $inserts = array(); |
| 101 | + foreach ( $res as $r ) { |
| 102 | + $inserts = array( |
| 103 | + 'rt_page' => $r->page_id, |
| 104 | + 'rt_revision' => $r->page_latest, |
| 105 | + 'rt_type' => $id |
| 106 | + ); |
| 107 | + } |
| 108 | + $db->replace( 'revtag', 'rt_type_page_revision', $inserts, __METHOD__ ); |
| 109 | + } |
87 | 110 | } |
88 | 111 | |
89 | | -unset( $checker ); |
\ No newline at end of file |
Index: trunk/extensions/Translate/scripts/groupStatistics.php |
— | — | @@ -145,10 +145,10 @@ |
146 | 146 | $cache->set( $groupName, $code, array( $fuzzy, $translated, $total ) ); |
147 | 147 | } |
148 | 148 | |
149 | | - $rows[$code][] = array( $translated, $total ); |
| 149 | + $rows[$code][] = array( false, $translated, $total ); |
150 | 150 | |
151 | 151 | if ( isset( $options['fuzzy'] ) ) { |
152 | | - $rows[$code][] = array( $fuzzy, $total ); |
| 152 | + $rows[$code][] = array( true, $fuzzy, $total ); |
153 | 153 | } |
154 | 154 | |
155 | 155 | } |
— | — | @@ -177,8 +177,8 @@ |
178 | 178 | $out->element( $code ); |
179 | 179 | $out->element( $name ); |
180 | 180 | foreach ( $columns as $fields ) { |
181 | | - list( $upper, $total ) = $fields; |
182 | | - $c = $out->formatPercent( $upper, $total, /* Inverted color */ false, /* Decimals */ 2 ); |
| 181 | + list( $invert, $upper, $total ) = $fields; |
| 182 | + $c = $out->formatPercent( $upper, $total, $invert, /* Decimals */ 2 ); |
183 | 183 | $out->element( $c ); |
184 | 184 | } |
185 | 185 | $out->blockend(); |
Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -30,22 +30,6 @@ |
31 | 31 | public function getIgnored() { return $this->ignored; } |
32 | 32 | public function setIgnored( $value ) { $this->ignored = $value; } |
33 | 33 | |
34 | | - protected $problematic = null; |
35 | | - public function getProblematic( $code ) { |
36 | | - if ( $this->problematic === null ) { |
37 | | - $this->problematic = array(); |
38 | | - $file = TRANSLATE_CHECKFILE . '-' . $this->id; |
39 | | - if ( file_exists( $file ) ) { |
40 | | - $problematic = unserialize( file_get_contents( $file ) ); |
41 | | - if ( isset( $problematic[$code] ) ) { |
42 | | - $this->problematic = $problematic[$code]; |
43 | | - } |
44 | | - } |
45 | | - } |
46 | | - return $this->problematic; |
47 | | - } |
48 | | - |
49 | | - public function setProblematic( $value ) { $this->problematic = $value ; } |
50 | 34 | /** |
51 | 35 | * Returns a list of optional and ignored messages in 2-d array. |
52 | 36 | */ |
— | — | @@ -438,6 +422,7 @@ |
439 | 423 | |
440 | 424 | function getDefinitions() { |
441 | 425 | $data = file_get_contents( dirname( __FILE__ ) . '/wikimedia-mostused-2009.txt' ); |
| 426 | + $data = str_replace( "\r", '', $data ); |
442 | 427 | $messages = explode( "\n", $data ); |
443 | 428 | $contents = Language::getMessagesFor( 'en' ); |
444 | 429 | $definitions = array(); |