Merge "add type check and bail out when title could not be created"
[lhc/web/wiklou.git] / resources / jquery / jquery.localize.js
index 97072e2..42554e0 100644 (file)
@@ -37,11 +37,23 @@ $.fn.localize = function( options ) {
                return mw.msg.apply( mw, args );
        };
        return $(this)
-               .find( 'html\\:msg' )
+               // Ok, so here's the story on this selector.
+               // In IE 6/7, searching for 'msg' turns up the 'html:msg', but searching for 'html:msg' does not.
+               // In later IE and other browsers, searching for 'html:msg' turns up the 'html:msg', but searching for 'msg' does not.
+               // So searching for both 'msg' and 'html:msg' seems to get the job done.
+               // This feels pretty icky, though.
+               .find( 'msg,html\\:msg' )
                        .each( function() {
                                var $el = $(this);
+                               var msgText = msg( $el.attr( 'key' ) );
+
+                               if ( $el.attr('raw') ) {
+                                       $el.html(msgText);
+                               } else {
+                                       $el.text(msgText);
+                               }
+                               
                                $el
-                                       .text( msg( $el.attr( 'key' ) ) )
                                        .replaceWith( $el.html() );
                        } )
                        .end()