r93968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93967‎ | r93968 | r93969 >
Date:13:34, 5 August 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 18634) Create API to fetch MediaWiki's language fallback tree structure

Patch by "merl"

Tested with pt-br, seems to work fine, listing pt and en for the fallback languages
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -45,6 +45,7 @@
4646 * siprop=interwikimap and siprop=languages can use silanguagecode to have
4747 a best effort language name translation. Use CLDR extension for best result.
4848 * (bug 30230) action=expandtemplates should not silently override invalid title inputs
 49+* (bug 18634) Create API to fetch MediaWiki's language fallback tree structure
4950
5051 === Languages updated in 1.19 ===
5152
Index: trunk/phase3/CREDITS
@@ -122,6 +122,7 @@
123123 * Matthew Britton
124124 * mati
125125 * Max Sikström
 126+* merl
126127 * Michael Dale
127128 * Michael De La Rue
128129 * Michael M.
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -138,6 +138,16 @@
139139 }
140140 $data['rights'] = $GLOBALS['wgRightsText'];
141141 $data['lang'] = $GLOBALS['wgLanguageCode'];
 142+
 143+ $fallbackLang = $wgContLang->getFallbackLanguageCode();
 144+ $fallbackLangArray = array();
 145+ while( $fallbackLang ) {
 146+ $fallbackLangArray[] = array( 'code' => $fallbackLang );
 147+ $fallbackLang = Language::getFallbackFor( $fallbackLang );
 148+ }
 149+ $data['fallback'] = $fallbackLangArray;
 150+ $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
 151+
142152 if ( $wgContLang->isRTL() ) {
143153 $data['rtl'] = '';
144154 }

Status & tagging log