Index: trunk/tools/ToolserverI18N/TsIntuition.php |
— | — | @@ -612,9 +612,25 @@ |
613 | 613 | return is_array( $this->langNames ) ? $this->langNames : array(); |
614 | 614 | } |
615 | 615 | |
616 | | - public function getAvailableLangs() { |
| 616 | + /** |
| 617 | + * Return all languages loaded in at least one domain |
| 618 | + * @param $domain |
| 619 | + * false - Show languages for which there is a translation in the current domain |
| 620 | + * 'any' - Show languages for which there is a translation in at least one domain |
| 621 | + * domain name - Show languages for which there is a translation in the given domain |
| 622 | + */ |
| 623 | + public function getAvailableLangs($domain = 'any') { |
| 624 | + if ( $domain == 'any' ) { |
| 625 | + $from = $this->availableLanguages; |
| 626 | + } else { |
| 627 | + if ( $domain === false ) |
| 628 | + $domain = $this->getDomain(); |
| 629 | + |
| 630 | + $from = $messageBlob[$domain]; |
| 631 | + } |
| 632 | + |
617 | 633 | $return = array(); |
618 | | - foreach( array_keys( $this->availableLanguages ) as $lang ) { |
| 634 | + foreach( array_keys( $from ) as $lang ) { |
619 | 635 | $return[$lang] = $this->getLangName( $lang ); |
620 | 636 | } |
621 | 637 | ksort( $return ); |
Index: trunk/tools/ToolserverI18N/public_html/index.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | |
35 | 35 | $I18N = new TsIntuition( $opts ); |
36 | 36 | |
37 | | -// Load all domains so can get some statistics later on and |
| 37 | +// Load all domains so we can get some statistics later on and |
38 | 38 | // make sure "getAvailableLangs" is compelte |
39 | 39 | foreach ( $I18N->getAllRegisteredDomains() as $domainKey => $domainInfo ) { |
40 | 40 | $I18N->loadTextdomain( $domainKey ); |
— | — | @@ -213,7 +213,7 @@ |
214 | 214 | // XXX: Quick way to build the form |
215 | 215 | $dropdown = '<select name="fpLang">'; |
216 | 216 | $selected = ' selected="selected"'; |
217 | | -foreach ( $I18N->getAvailableLangs() as $langCode => $langName ) { |
| 217 | +foreach ( $I18N->getAvailableLangs( 'any' ) as $langCode => $langName ) { |
218 | 218 | $attr = $langCode == $I18N->getLang() ? $selected : ''; |
219 | 219 | $dropdown .= '<option value="' . $langCode . '"' . $attr . '>' . "$langCode - $langName" . '</option>'; |
220 | 220 | } |