r53742 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53741‎ | r53742 | r53743 >
Date:07:23, 25 July 2009
Author:shinjiman
Status:ok
Tags:
Comment:
Tweak to use lowercase on other cases, which follows r53720 and r53722.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -3191,23 +3191,26 @@
31923192 return $array;
31933193 }
31943194
3195 -/* Get the normalised IETF language tag */
 3195+/* Get the normalised IETF language tag
 3196+ * @param $code String: The language code.
 3197+ * @return $langCode String: The language code which complying with BCP 47 standards.
 3198+ */
31963199 function wfBCP47( $code ) {
31973200 $codeSegment = explode( '-', $code );
31983201 foreach ( $codeSegment as $segNo => $seg ) {
31993202 if ( count( $codeSegment ) > 0 ) {
32003203 // ISO 3166 country code
32013204 if ( ( strlen( $seg ) == 2 ) && ( $segNo > 0 ) )
3202 - $codeBCP[$segNo] = strtoupper ( $seg );
 3205+ $codeBCP[$segNo] = strtoupper( $seg );
32033206 // ISO 15924 script code
32043207 else if ( ( strlen( $seg ) == 4 ) && ( $segNo > 0 ) )
32053208 $codeBCP[$segNo] = ucfirst( $seg );
 3209+ // Use lowercase for other cases
32063210 else
3207 - // Keep casing for other cases
3208 - $codeBCP[$segNo] = $seg;
 3211+ $codeBCP[$segNo] = strtolower( $seg );
32093212 } else {
3210 - // Keep casing for single segment
3211 - $codeBCP[$segNo] = $seg;
 3213+ // Use lowercase for single segment
 3214+ $codeBCP[$segNo] = strtolower( $seg );
32123215 }
32133216 }
32143217 $langCode = implode ( '-' , $codeBCP );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53720Tweak the language code display more comply with the BCP 47 standards, using ...shinjiman17:41, 24 July 2009
r53722fix E_NOTICE on r53720 and r53721.shinjiman18:35, 24 July 2009

Status & tagging log