Index: trunk/phase3/languages/Language.php |
— | — | @@ -61,6 +61,7 @@ |
62 | 62 | |
63 | 63 | var $mVariants, $mCode, $mLoaded = false; |
64 | 64 | var $mMagicExtensions = array(), $mMagicHookDone = false; |
| 65 | + private $mHtmlCode = null; |
65 | 66 | |
66 | 67 | var $mNamespaceIds, $namespaceNames, $namespaceAliases; |
67 | 68 | var $dateFormatStrings = array(); |
— | — | @@ -3467,9 +3468,13 @@ |
3468 | 3469 | /** |
3469 | 3470 | * Get the code in Bcp47 format which we can use |
3470 | 3471 | * inside of html lang="" tags. |
| 3472 | + * @since 1.19 |
3471 | 3473 | */ |
3472 | 3474 | function getHtmlCode() { |
3473 | | - return wfBcp47( $this->getCode() ); |
| 3475 | + if ( is_null( $this->mHtmlCode ) ) { |
| 3476 | + $this->mHtmlCode = wfBCP47( $this->getCode() ); |
| 3477 | + } |
| 3478 | + return $this->mHtmlCode; |
3474 | 3479 | } |
3475 | 3480 | |
3476 | 3481 | /** |
— | — | @@ -3477,6 +3482,8 @@ |
3478 | 3483 | */ |
3479 | 3484 | function setCode( $code ) { |
3480 | 3485 | $this->mCode = $code; |
| 3486 | + // Ensure we don't leave an incorrect html code lying around |
| 3487 | + unset( $this->mHtmlCode ); |
3481 | 3488 | } |
3482 | 3489 | |
3483 | 3490 | /** |