Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3190,3 +3190,22 @@ |
3191 | 3191 | |
3192 | 3192 | return $array; |
3193 | 3193 | } |
| 3194 | + |
| 3195 | +/* get the noramised IETF language tag */ |
| 3196 | +function wfBCP47( $code ) { |
| 3197 | + $codeSegment = explode( '-', $code ); |
| 3198 | + foreach ( $codeSegment as $segNo => $seg ) { |
| 3199 | + // ISO 3166 country code |
| 3200 | + if ( ( strlen( $seg ) == 2 ) && ( $segNo > 0 ) ) |
| 3201 | + $codeBCP[$segNo] = strtoupper ( $seg ); |
| 3202 | + // ISO 15924 script code |
| 3203 | + else if ( ( strlen( $seg ) == 4 ) && ( $segNo > 0 ) ) |
| 3204 | + $codeBCP[$segNo] = ucfirst( $seg ); |
| 3205 | + // Keep casing for other cases |
| 3206 | + else |
| 3207 | + $codeBCP[$segNo] = $seg; |
| 3208 | + } |
| 3209 | + $langCode = implode ( '-' , $codeBCP ); |
| 3210 | + return $langCode; |
| 3211 | +} |
| 3212 | + |
Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | |
210 | 210 | $options = array(); |
211 | 211 | foreach( $languages as $code => $name ) { |
212 | | - $display = "$code - $name"; |
| 212 | + $display = wfBCP47( $code ) . ' - ' . $name; |
213 | 213 | $options[$display] = $code; |
214 | 214 | } |
215 | 215 | $defaultPreferences['language'] = |
— | — | @@ -237,7 +237,7 @@ |
238 | 238 | |
239 | 239 | $options = array(); |
240 | 240 | foreach( $variantArray as $code => $name ) { |
241 | | - $display = "$code - $name"; |
| 241 | + $display = wfBCP47( $code ) . ' - ' . $name; |
242 | 242 | $options[$display] = $code; |
243 | 243 | } |
244 | 244 | |
Index: trunk/phase3/config/index.php |
— | — | @@ -2094,7 +2094,7 @@ |
2095 | 2095 | if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) { |
2096 | 2096 | $code = str_replace( '_', '-', strtolower( $m[1] ) ); |
2097 | 2097 | if( isset( $wgLanguageNames[$code] ) ) { |
2098 | | - $name = $code . ' - ' . $wgLanguageNames[$code]; |
| 2098 | + $name = wfBCP47( $code ) . ' - ' . $wgLanguageNames[$code]; |
2099 | 2099 | } else { |
2100 | 2100 | $name = $code; |
2101 | 2101 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -324,7 +324,9 @@ |
325 | 325 | * (bug 16877) Moving a page over a redirect no longer leaves an orphan entry in |
326 | 326 | the recentchanges table |
327 | 327 | * (bug 16009) Limit selection forms based on Pager now links to the correct page |
328 | | - when using long urls |
| 328 | + when using long urls |
| 329 | +* The display of the language list on the preferences is more comply with the |
| 330 | + BCP 47 standards. |
329 | 331 | |
330 | 332 | == API changes in 1.16 == |
331 | 333 | |