getGrammarForms(); } /** * @param $context ResourceLoaderContext * @return string: Javascript code */ public function getScript( ResourceLoaderContext $context ) { global $wgContLang; return Xml::encodeJsCall( 'mw.language.setData', array( $wgContLang->getCode(), array( 'grammarForms' => $this->getSiteLangGrammarForms() ) ) ); } /** * @param $context ResourceLoaderContext * @return array|int|Mixed */ public function getModifiedTime( ResourceLoaderContext $context ) { $cache = wfGetCache( CACHE_ANYTHING ); $key = wfMemcKey( 'resourceloader', 'langdatamodule', 'changeinfo' ); $forms = $this->getSiteLangGrammarForms(); $hash = md5( serialize( $forms ) ); $result = $cache->get( $key ); if ( is_array( $result ) && $result['hash'] === $hash ) { return $result['timestamp']; } $timestamp = wfTimestamp(); $cache->set( $key, array( 'hash' => $hash, 'timestamp' => $timestamp, ) ); return $timestamp; } /** * @return array */ public function getDependencies() { return array( 'mediawiki.language.init' ); } }