This won't do what you think it does. Checking return of wfMsgForContent() and making sure it's not disabled should be done as follows:
if( wfEmptyMsg( 'coll-bookscategory', $t ) || $t == '-' ) {
Thanks for the hint, fixed in r60787.