Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -509,10 +509,15 @@ |
510 | 510 | |
511 | 511 | $message = false; |
512 | 512 | |
513 | | - # Normalise title-case input |
| 513 | + # Normalise title-case input (with some inlining) |
514 | 514 | $lckey = str_replace( ' ', '_', $key ); |
515 | | - $lckey[0] = strtolower( $lckey[0] ); |
516 | | - $uckey = ucfirst( $lckey ); |
| 515 | + if ( ord( $key ) < 128 ) { |
| 516 | + $lckey[0] = strtolower( $lckey[0] ); |
| 517 | + $uckey = ucfirst( $lckey ); |
| 518 | + } else { |
| 519 | + $lckey = $wgContLang->lcfirst( $lckey ); |
| 520 | + $uckey = $wgContLang->ucfirst( $lckey ); |
| 521 | + } |
517 | 522 | |
518 | 523 | # Try the MediaWiki namespace |
519 | 524 | if( !$this->mDisable && $useDB ) { |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1509,9 +1509,15 @@ |
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | function ucfirst( $str ) { |
1513 | | - if ( empty($str) ) return $str; |
1514 | | - if ( ord($str[0]) < 128 ) return ucfirst($str); |
1515 | | - else return self::uc($str,true); // fall back to more complex logic in case of multibyte strings |
| 1513 | + $o = ord( $str ); |
| 1514 | + if ( $o < 96 ) { |
| 1515 | + return $str; |
| 1516 | + } elseif ( $o < 128 ) { |
| 1517 | + return ucfirst($str); |
| 1518 | + } else { |
| 1519 | + // fall back to more complex logic in case of multibyte strings |
| 1520 | + return self::uc($str,true); |
| 1521 | + } |
1516 | 1522 | } |
1517 | 1523 | |
1518 | 1524 | function uc( $str, $first = false ) { |
— | — | @@ -1541,13 +1547,17 @@ |
1542 | 1548 | } |
1543 | 1549 | |
1544 | 1550 | function lcfirst( $str ) { |
1545 | | - if ( empty($str) ) return $str; |
1546 | | - if ( is_string( $str ) && ord($str[0]) < 128 ) { |
1547 | | - // editing string in place = cool |
1548 | | - $str[0]=strtolower($str[0]); |
| 1551 | + $o = ord( $str ); |
| 1552 | + if ( !$o ) { |
| 1553 | + return strval( $str ); |
| 1554 | + } elseif ( $o >= 128 ) { |
| 1555 | + return self::lc( $str, true ); |
| 1556 | + } elseif ( $o > 96 ) { |
1549 | 1557 | return $str; |
| 1558 | + } else { |
| 1559 | + $str[0] = strtolower( $str[0] ); |
| 1560 | + return $str; |
1550 | 1561 | } |
1551 | | - else return self::lc( $str, true ); |
1552 | 1562 | } |
1553 | 1563 | |
1554 | 1564 | function lc( $str, $first = false ) { |