r84079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84078‎ | r84079 | r84080 >
Date:05:44, 16 March 2011
Author:purodha
Status:ok
Tags:
Comment:
Temporary fix: Make standard (BCP47) capitalizations recognized, and allow users to use arbitrary capitalizations.
Modified paths:
  • /trunk/extensions/Babel/Babel.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/Babel.class.php
@@ -140,8 +140,9 @@
141141 global $wgBabelDefaultLevel, $wgBabelCategoryNames;
142142 $return = array();
143143
 144+ $babelcode = strtolower( $parameter );
144145 // Try treating the paramter as a language code (for default level).
145 - $code = BabelLanguageCodes::getCode( $parameter );
 146+ $code = BabelLanguageCodes::getCode( $babelcode );
146147 if ( $code !== false ) {
147148 $return['code'] = $code;
148149 $return['level'] = $wgBabelDefaultLevel;
@@ -155,8 +156,9 @@
156157 $code = substr( $parameter, 0, $lastSplit );
157158 $level = substr( $parameter, $lastSplit + 1 );
158159
 160+ $babelcode = strtolower( $code );
159161 // Validate code.
160 - $return['code'] = BabelLanguageCodes::getCode( $code );
 162+ $return['code'] = BabelLanguageCodes::getCode( $babelcode );
161163 if ( $return['code'] === false ) {
162164 return false;
163165 }
@@ -182,6 +184,7 @@
183185 $lang = wfBCP47( $code );
184186 $header = "[[$portal|" . $lang . "]]<span class=\"mw-babel-box-level-$level\">-$level</span>";
185187
 188+ $code = strtolower( $code );
186189 $name = BabelLanguageCodes::getName( $code );
187190 $code = BabelLanguageCodes::getCode( $code );
188191 $text = self::mGetText( $name, $code, $level );

Status & tagging log