# If $wgMessageCache isn't initialised yet, try to return something sensible.
if( is_object( $wgMessageCache ) ) {
$message = $wgMessageCache->get( $key, $useDB, $langCode );
- if ( $transform ) {
+ if( $message === false ){
+ $message = '<' . htmlspecialchars( $key ) . '>';
+ } elseif ( $transform ) {
$message = $wgMessageCache->transform( $message );
}
} else {
* looked up didn't exist but a XHTML string, this function checks for the
* nonexistance of messages by looking at wfMsg() output
*
- * @param $msg String: the message key looked up
- * @param $wfMsgOut String: the output of wfMsg*()
- * @return Boolean
+ * @param $key String: the message key looked up
+ * @return Boolean True if the message *doesn't* exist.
*/
-function wfEmptyMsg( $msg, $wfMsgOut ) {
- return $wfMsgOut === htmlspecialchars( "<$msg>" );
+function wfEmptyMsg( $key ) {
+ global $wgMessageCache;
+ return $wgMessageCache->get( $key ) === false;
}
/**
if ( strval( $key ) === '' ) {
# Shortcut: the empty key is always missing
- return '<>';
+ return false;
}
$lang = wfGetLangObj( $langcode );
# Final fallback
if( $message === false ) {
- return '<' . htmlspecialchars($key) . '>';
+ return false;
}
# Fix whitespace
if ( strpos( $code, '/' ) === false ) {
$txt = $wgMessageCache->get( 'Conversiontable', true, $code );
+ if( $txt === false ){
+ # FIXME: this method doesn't seem to be expecting
+ # this possible outcome...
+ $txt = '<Conversiontable>';
+ }
} else {
$title = Title::makeTitleSafe( NS_MEDIAWIKI,
"Conversiontable/$code" );