Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -550,7 +550,9 @@ |
551 | 551 | throw new MWException( "Bad lang code $langcode given" ); |
552 | 552 | } |
553 | 553 | |
554 | | - $langcode = $lang->getCodeForMessage(); |
| 554 | + // Don't change getPreferredVariant() to getCode() / mCode, for |
| 555 | + // more details, see the comment in Language::getMessage(). |
| 556 | + $langcode = $lang->getPreferredVariant(); |
555 | 557 | |
556 | 558 | $message = false; |
557 | 559 | |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1568,11 +1568,21 @@ |
1569 | 1569 | } |
1570 | 1570 | |
1571 | 1571 | function getMessage( $key ) { |
1572 | | - return self::$dataCache->getSubitem( $this->getCodeForMessage(), 'messages', $key ); |
| 1572 | + // Don't change getPreferredVariant() to getCode() / mCode, because: |
| 1573 | + |
| 1574 | + // 1. Some language like Chinese has multiple variant languages. Only |
| 1575 | + // getPreferredVariant() (in LanguageConverter) could return a |
| 1576 | + // sub-language which would be more suitable for the user. |
| 1577 | + // 2. To languages without multiple variants, getPreferredVariant() |
| 1578 | + // (in FakeConverter) functions exactly same as getCode() / mCode, |
| 1579 | + // it won't break anything. |
| 1580 | + |
| 1581 | + // The same below. |
| 1582 | + return self::$dataCache->getSubitem( $this->getPreferredVariant(), 'messages', $key ); |
1573 | 1583 | } |
1574 | 1584 | |
1575 | 1585 | function getAllMessages() { |
1576 | | - return self::$dataCache->getItem( $this->getCodeForMessage(), 'messages' ); |
| 1586 | + return self::$dataCache->getItem( $this->getPreferredVariant(), 'messages' ); |
1577 | 1587 | } |
1578 | 1588 | |
1579 | 1589 | function iconv( $in, $out, $string ) { |
— | — | @@ -2789,18 +2799,6 @@ |
2790 | 2800 | function getCode() { |
2791 | 2801 | return $this->mCode; |
2792 | 2802 | } |
2793 | | - |
2794 | | - /** |
2795 | | - * Get langcode for message |
2796 | | - * Some language, like Chinese (zh, without any suffix), has multiple |
2797 | | - * interface languages, we could choose a better one for user. |
2798 | | - * Inherit class can override this function if necessary. |
2799 | | - * |
2800 | | - * @return string |
2801 | | - */ |
2802 | | - function getCodeForMessage() { |
2803 | | - return $this->getPreferredVariant(); |
2804 | | - } |
2805 | 2803 | |
2806 | 2804 | function setCode( $code ) { |
2807 | 2805 | $this->mCode = $code; |