throw new MWException( "Invalid fallback sequence for language '$code'" );
}
+ /**
+ * Intended for tests that may change configuration in a way that invalidates caches.
+ *
+ * @since 1.32
+ */
+ public static function clearCaches() {
+ if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
+ throw new MWException( __METHOD__ . ' must not be used outside tests' );
+ }
+ self::$dataCache = null;
+ // Reinitialize $dataCache, since it's expected to always be available
+ self::getLocalisationCache();
+ self::$mLangObjCache = [];
+ self::$fallbackLanguageCache = [];
+ self::$grammarTransformations = null;
+ self::$languageNameCache = null;
+ }
+
/**
* Checks whether any localisation is available for that language tag
* in MediaWiki (MessagesXx.php exists).
* Get a namespace value by key
*
* <code>
- * $mw_ns = $wgContLang->getNsText( NS_MEDIAWIKI );
+ * $mw_ns = $lang->getNsText( NS_MEDIAWIKI );
* echo $mw_ns; // prints 'MediaWiki'
* </code>
*
* producing output.
*
* <code>
- * $mw_ns = $wgContLang->getFormattedNsText( NS_MEDIAWIKI_TALK );
+ * $mw_ns = $lang->getFormattedNsText( NS_MEDIAWIKI_TALK );
* echo $mw_ns; // prints 'MediaWiki talk'
* </code>
*