Index: trunk/phase3/maintenance/language/transstat.php |
— | — | @@ -71,6 +71,7 @@ |
72 | 72 | $output->blockstart(); |
73 | 73 | $output->element( 'Language', true ); |
74 | 74 | $output->element( 'Code', true ); |
| 75 | +$output->element( 'Fallback', true ); |
75 | 76 | $output->element( 'Translated', true ); |
76 | 77 | $output->element( '%', true ); |
77 | 78 | $output->element( 'Obsolete', true ); |
— | — | @@ -90,6 +91,7 @@ |
91 | 92 | |
92 | 93 | # Calculate the numbers |
93 | 94 | $language = $wgContLang->getLanguageName( $code ); |
| 95 | + $fallback = $wgLanguages->getFallback( $code ); |
94 | 96 | $messages = $wgLanguages->getMessages( $code ); |
95 | 97 | $messagesNumber = count( $messages['translated'] ); |
96 | 98 | $requiredMessagesNumber = count( $messages['required'] ); |
— | — | @@ -108,6 +110,7 @@ |
109 | 111 | $output->blockstart(); |
110 | 112 | $output->element( "$language" ); |
111 | 113 | $output->element( "$code" ); |
| 114 | + $output->element( "$fallback" ); |
112 | 115 | $output->element( "$requiredMessagesNumber/$wgRequiredMessagesNumber" ); |
113 | 116 | $output->element( $requiredMessagesPercent ); |
114 | 117 | $output->element( "$obsoleteMessagesNumber/$messagesNumber" ); |
Index: trunk/phase3/maintenance/language/languages.inc |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | |
16 | 16 | protected $mRawMessages; # Raw list of the messages in each language |
17 | 17 | protected $mMessages; # Messages in each language (except for English), divided to groups |
| 18 | + protected $mFallback; # Fallback language in each language |
18 | 19 | protected $mGeneralMessages; # General messages in English, divided to groups |
19 | 20 | protected $mIgnoredMessages; # All the messages which should be exist only in the English file |
20 | 21 | protected $mOptionalMessages; # All the messages which may be translated or not, depending on the language |
— | — | @@ -76,6 +77,7 @@ |
77 | 78 | */ |
78 | 79 | protected function loadFile( $code ) { |
79 | 80 | if ( isset( $this->mRawMessages[$code] ) && |
| 81 | + isset( $this->mFallback[$code] ) && |
80 | 82 | isset( $this->mNamespaceNames[$code] ) && |
81 | 83 | isset( $this->mNamespaceAliases[$code] ) && |
82 | 84 | isset( $this->mMagicWords[$code] ) && |
— | — | @@ -83,6 +85,7 @@ |
84 | 86 | return; |
85 | 87 | } |
86 | 88 | $this->mRawMessages[$code] = array(); |
| 89 | + $this->mFallback[$code] = ''; |
87 | 90 | $this->mNamespaceNames[$code] = array(); |
88 | 91 | $this->mNamespaceAliases[$code] = array(); |
89 | 92 | $this->mMagicWords[$code] = array(); |
— | — | @@ -93,6 +96,9 @@ |
94 | 97 | if ( isset( $messages ) ) { |
95 | 98 | $this->mRawMessages[$code] = $messages; |
96 | 99 | } |
| 100 | + if ( isset( $fallback ) ) { |
| 101 | + $this->mFallback[$code] = $fallback; |
| 102 | + } |
97 | 103 | if ( isset( $namespaceNames ) ) { |
98 | 104 | $this->mNamespaceNames[$code] = $namespaceNames; |
99 | 105 | } |
— | — | @@ -207,6 +213,18 @@ |
208 | 214 | } |
209 | 215 | |
210 | 216 | /** |
| 217 | + * Get fallback language code for a specific language. |
| 218 | + * |
| 219 | + * @param $code The language code. |
| 220 | + * |
| 221 | + * @return Fallback code. |
| 222 | + */ |
| 223 | + public function getFallback( $code ) { |
| 224 | + $this->loadFile( $code ); |
| 225 | + return $this->mFallback[$code]; |
| 226 | + } |
| 227 | + |
| 228 | + /** |
211 | 229 | * Get namespace names for a specific language. |
212 | 230 | * |
213 | 231 | * @param $code The language code. |