Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -207,6 +207,7 @@ |
208 | 208 | 'translations-summary' => 'Enter a message name below to show all available translations.', |
209 | 209 | 'translate-translations-no-message' => '"$1" is not a translatable message', |
210 | 210 | 'translate-translations-none' => 'There are no translations for "$1"', |
| 211 | + 'translate-translations-count' => 'Found {{PLURAL:$1|one translation|$1 translations}}.', |
211 | 212 | 'translate-translations-fieldset-title' => 'Message', |
212 | 213 | 'translate-translations-messagename' => 'Name:', |
213 | 214 | 'translate-translations-project' => 'Project:', |
Index: trunk/extensions/Translate/SpecialTranslations.php |
— | — | @@ -71,20 +71,18 @@ |
72 | 72 | * @return \string HTML for fieldset. |
73 | 73 | */ |
74 | 74 | function namespaceMessageForm( Title $title = null ) { |
75 | | - global $wgContLang, $wgScript, $wgTranslateMessageNamespaces; |
| 75 | + global $wgScript; |
76 | 76 | |
77 | | - $t = $this->getTitle(); |
78 | | - |
79 | 77 | $namespaces = new XmlSelect( 'namespace', 'namespace' ); |
80 | 78 | $namespaces->setDefault( $title->getNamespace() ); |
81 | 79 | |
82 | | - foreach ( $wgTranslateMessageNamespaces as $ns ) { |
83 | | - $namespaces->addOption( $wgContLang->getFormattedNsText( $ns ), $ns ); |
| 80 | + foreach ( $this->getSortedNamespaces() as $text => $index ) { |
| 81 | + $namespaces->addOption( $text, $index ); |
84 | 82 | } |
85 | 83 | |
86 | 84 | $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); |
87 | 85 | $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
88 | | - $out .= Html::hidden( 'title', $t->getPrefixedText() ); |
| 86 | + $out .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ); |
89 | 87 | $out .= Xml::openElement( 'fieldset' ); |
90 | 88 | $out .= Xml::element( 'legend', null, wfMsg( 'translate-translations-fieldset-title' ) ); |
91 | 89 | $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) ); |
— | — | @@ -114,13 +112,30 @@ |
115 | 113 | } |
116 | 114 | |
117 | 115 | /** |
| 116 | + * Returns sorted array of namespaces. |
| 117 | + * |
| 118 | + * @return \arrayof{String,Integer} |
| 119 | + */ |
| 120 | + public function getSortedNamespaces() { |
| 121 | + global $wgTranslateMessageNamespaces, $wgContLang; |
| 122 | + |
| 123 | + $nslist = array(); |
| 124 | + foreach ( $wgTranslateMessageNamespaces as $ns ) { |
| 125 | + $nslist[$wgContLang->getFormattedNsText( $ns )] = $ns; |
| 126 | + } |
| 127 | + ksort( $nslist ); |
| 128 | + |
| 129 | + return $nslist; |
| 130 | + } |
| 131 | + |
| 132 | + /** |
118 | 133 | * Builds a table with all translations of $title. |
119 | 134 | * |
120 | 135 | * @param $title Title (default: null) |
121 | 136 | * @return void |
122 | 137 | */ |
123 | 138 | function showTranslations( Title $title ) { |
124 | | - global $wgOut, $wgUser; |
| 139 | + global $wgOut, $wgUser, $wgLang; |
125 | 140 | |
126 | 141 | $sk = $wgUser->getSkin(); |
127 | 142 | |
— | — | @@ -131,7 +146,6 @@ |
132 | 147 | |
133 | 148 | if ( !$inMessageGroup ) { |
134 | 149 | $wgOut->addWikiMsg( 'translate-translations-no-message', $title->getPrefixedText() ); |
135 | | - |
136 | 150 | return; |
137 | 151 | } |
138 | 152 | |
— | — | @@ -152,13 +166,12 @@ |
153 | 167 | |
154 | 168 | if ( !$res->numRows() ) { |
155 | 169 | $wgOut->addWikiMsg( 'translate-translations-no-message', $title->getPrefixedText() ); |
156 | | - |
157 | 170 | return; |
| 171 | + } else { |
| 172 | + $wgOut->addWikiMsg( 'translate-translations-count', $wgLang->formatNum( $res->numRows() ) ); |
158 | 173 | } |
159 | 174 | |
160 | | - /** |
161 | | - * Normal output. |
162 | | - */ |
| 175 | + // Normal output. |
163 | 176 | $titles = array(); |
164 | 177 | |
165 | 178 | foreach ( $res as $s ) { |
— | — | @@ -168,7 +181,7 @@ |
169 | 182 | $pageInfo = TranslateUtils::getContents( $titles, $namespace ); |
170 | 183 | |
171 | 184 | $tableheader = Xml::openElement( 'table', array( |
172 | | - 'class' => 'mw-sp-translate-table' |
| 185 | + 'class' => 'mw-sp-translate-table sortable' |
173 | 186 | ) ); |
174 | 187 | |
175 | 188 | $tableheader .= Xml::openElement( 'tr' ); |
— | — | @@ -176,23 +189,24 @@ |
177 | 190 | $tableheader .= Xml::element( 'th', null, wfMsg( 'allmessagescurrent' ) ); |
178 | 191 | $tableheader .= Xml::closeElement( 'tr' ); |
179 | 192 | |
180 | | - /** |
181 | | - * Adapted version of TranslateUtils:makeListing() by Nikerabbit. |
182 | | - */ |
| 193 | + // Adapted version of TranslateUtils:makeListing() by Nikerabbit. |
183 | 194 | $out = $tableheader; |
184 | 195 | |
185 | 196 | $canTranslate = $wgUser->isAllowed( 'translate' ); |
186 | 197 | |
187 | 198 | $ajaxPageList = array(); |
188 | | - $historyText = " <sup>" . wfMsg( 'translate-translations-history-short' ) . "</sup> "; |
| 199 | + $historyText = " <sup>" . wfMsgHtml( 'translate-translations-history-short' ) . "</sup> "; |
189 | 200 | |
190 | 201 | foreach ( $res as $s ) { |
191 | 202 | $key = $s->page_title; |
192 | 203 | $tTitle = Title::makeTitle( $s->page_namespace, $key ); |
193 | 204 | $ajaxPageList[] = $tTitle->getDBkey(); |
194 | 205 | |
195 | | - $text = htmlspecialchars( $this->getCode( $s->page_title ) ); |
| 206 | + $code = $this->getCode( $s->page_title ); |
196 | 207 | |
| 208 | + $text = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() ) . " ($code)"; |
| 209 | + $text = htmlspecialchars( $text ); |
| 210 | + |
197 | 211 | if ( $canTranslate ) { |
198 | 212 | $tools['edit'] = TranslationHelpers::ajaxEditLink( |
199 | 213 | $tTitle, |