Index: trunk/extensions/Translate/SpecialMyLanguage.php |
— | — | @@ -22,9 +22,9 @@ |
23 | 23 | $title = null; |
24 | 24 | if ( strval($par) !== '' ) { |
25 | 25 | $title = Title::newFromText( $par ); |
26 | | - if ( $title && ( $title->exists() || $title->isAlwaysKnown() ) ) { |
| 26 | + if ( $title && $title->exists() ) { |
27 | 27 | $local = Title::newFromText( "$par/" . $wgLang->getCode() ); |
28 | | - if ( $local && ( $local->exists() || $local->isAlwaysKnown() ) ) { |
| 28 | + if ( $local && $local->exists() ) { |
29 | 29 | $title = $local; |
30 | 30 | } |
31 | 31 | } |
Index: trunk/extensions/Translate/SpecialLanguageStats.php |
— | — | @@ -31,16 +31,22 @@ |
32 | 32 | $code = $wgRequest->getVal( 'code', $par ); |
33 | 33 | $suppressComplete = $wgRequest->getVal( 'suppresscomplete', $par ); |
34 | 34 | $wgOut->addHTML( $this->buildLanguageForm( $code, $suppressComplete ) ); |
35 | | -/* |
36 | | - $form = $this->buildLanguageForm( $code, $suppressComplete ); |
37 | | - $form->show(); |
38 | | -*/ |
39 | 35 | } else { |
40 | 36 | $paramArray = explode( '/', $par, 2 ); |
41 | 37 | $code = $paramArray[0]; |
42 | 38 | $suppressComplete = isset( $paramArray[1] ) && (bool)$paramArray[1]; |
43 | 39 | } |
44 | 40 | |
| 41 | + if ( !$code ) { |
| 42 | + global $wgUser; |
| 43 | + |
| 44 | + if ( $wgUser->isLoggedIn() ) { |
| 45 | + global $wgLnng; |
| 46 | + |
| 47 | + $code = $wgLang->getCode(); |
| 48 | + } |
| 49 | + } |
| 50 | + |
45 | 51 | $out = ''; |
46 | 52 | |
47 | 53 | if ( array_key_exists( $code, Language::getLanguageNames() ) ) { |
— | — | @@ -60,28 +66,10 @@ |
61 | 67 | */ |
62 | 68 | function buildLanguageForm( $code = '', $suppressComplete = false ) { |
63 | 69 | global $wgScript; |
| 70 | + |
64 | 71 | $t = $this->getTitle(); |
65 | 72 | |
66 | | -/* |
67 | | - $formFields = array( |
68 | | - 'code' => array( |
69 | | - 'type' => 'text', |
70 | | - 'label-message' => 'translate-language-code-field-name', |
71 | | - 'size' => '30' |
72 | | - ), |
73 | | - 'suppresscomplete' => array( |
74 | | - 'type' => 'toggle', |
75 | | - 'label-message' => 'translate-suppress-complete', |
76 | | - ), |
77 | | - ); |
78 | | - |
79 | | - $form = new HTMLForm( $formFields ); |
80 | | - $form->setTitle( SpecialPage::getTitleFor( 'LanguageStats' ) ); |
81 | | - |
82 | | - return $form; |
83 | | -*/ |
84 | | - |
85 | | - $out = Xml::openElement( 'div', array( 'class' => 'languagecode' ) ); |
| 73 | + $out = Xml::openElement( 'div', array( 'class' => 'languagecode' ) ); |
86 | 74 | $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); |
87 | 75 | $out .= Xml::hidden( 'title', $t->getPrefixedText() ); |
88 | 76 | $out .= Xml::openElement( 'fieldset' ); |
— | — | @@ -89,10 +77,10 @@ |
90 | 78 | $out .= Xml::openElement( 'table', array( 'id' => 'langcodeselect', 'class' => 'allpages' ) ); |
91 | 79 | |
92 | 80 | $out .= Xml::openElement( 'tr' ); |
93 | | - $out .= Xml::openElement( 'td', array( 'class' => 'mw-label' ) ); |
| 81 | + $out .= Xml::openElement( 'td', array( 'class' => 'mw-label' ) ); |
94 | 82 | $out .= Xml::label( wfMsg( 'translate-language-code-field-name' ), 'code' ); |
95 | 83 | $out .= Xml::closeElement( 'td' ); |
96 | | - $out .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ); |
| 84 | + $out .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ); |
97 | 85 | $out .= Xml::input( 'code', 30, str_replace( '_', ' ', $code ), array( 'id' => 'code' ) ); |
98 | 86 | $out .= Xml::closeElement( 'td' ); |
99 | 87 | $out .= Xml::closeElement( 'tr' ); |
Index: trunk/extensions/Translate/SpecialTranslationStats.php |
— | — | @@ -50,7 +50,6 @@ |
51 | 51 | if ( $this->including() ) { |
52 | 52 | $wgOut->addHTML( $this->image( $opts ) ); |
53 | 53 | } elseif ( $opts['graphit'] ) { |
54 | | - |
55 | 54 | // Cache for two hours |
56 | 55 | if ( !$opts['preview'] ) { |
57 | 56 | $lastMod = $wgOut->checkLastModified( wfTimestamp( TS_MW, time() - 2 * 3600 ) ); |
— | — | @@ -193,7 +192,7 @@ |
194 | 193 | |
195 | 194 | ksort( $languages ); |
196 | 195 | |
197 | | - $selector = new XmlSelect( 'mw-language-selector', 'mw-language-selector' ); |
| 196 | + $selector = new XmlSelect( 'mw-language-selector', 'mw-language-selector' ); |
198 | 197 | foreach ( $languages as $code => $name ) { |
199 | 198 | $selector->addOption( "$code - $name", $code ); |
200 | 199 | } |
— | — | @@ -232,7 +231,7 @@ |
233 | 232 | |
234 | 233 | ksort( $groups ); |
235 | 234 | |
236 | | - $selector = new XmlSelect( 'mw-group-selector', 'mw-group-selector' ); |
| 235 | + $selector = new XmlSelect( 'mw-group-selector', 'mw-group-selector' ); |
237 | 236 | foreach ( $groups as $code => $name ) { |
238 | 237 | $selector->addOption( $name->getLabel(), $code ); |
239 | 238 | } |