return array_keys( $list );
}
+ /**
+ * Get all message keys stored in the message cache for a given language.
+ * If $code is the content language code, this will return all message keys
+ * for which MediaWiki:msgkey exists. If $code is another language code, this
+ * will ONLY return message keys for which MediaWiki:msgkey/$code exists.
+ * @param $code string
+ * @return array of message keys (strings)
+ */
+ public function getAllMessageKeys( $code ) {
+ global $wgContLang;
+ $this->load( $code );
+ if ( !isset( $this->mCache[$code] ) ) {
+ // Apparently load() failed
+ return null;
+ }
+ $cache = $this->mCache[$code]; // Copy the cache
+ unset( $cache['VERSION'] ); // Remove the VERSION key
+ $cache = array_diff( $cache, array( '!NONEXISTENT' ) ); // Remove any !NONEXISTENT keys
+ // Keys may appear with a capital first letter. lcfirst them.
+ return array_map( array( $wgContLang, 'lcfirst' ), array_keys( $cache ) );
+ }
}