fetchLanguageNames: fallback to default instead of false
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.jqueryMsg.js
index a8d4a3a..043ebce 100644 (file)
        };
 
        var parserDefaults = { 
-               'magic' : {},
+               'magic' : {
+                       'SITENAME' : mw.config.get( 'wgSiteName' )
+               },
                'messages' : mw.messages,
                'language' : mw.language
        };
                        }
                        var forms = nodes.slice(1);
                        return this.language.gender( gender, forms );
-               }
+               },
 
+               /**
+                * Transform parsed structure into grammar conversion.
+                * Invoked by putting {{grammar:form|word}} in a message
+                * @param {Array} of nodes [{Grammar case eg: genitive}, {String word}]
+                * @return {String} selected grammatical form according to current language
+                */
+               grammar: function( nodes ) {
+                       var form = nodes[0];
+                       var word = nodes[1];
+                       return word && form && this.language.convertGrammar( word, form );
+               }
        };
 
-       // TODO figure out a way to make magic work with common globals like wgSiteName, without requiring init from library users...
-       // var options = { magic: { 'SITENAME' : mw.config.get( 'wgSiteName' ) } };
-
        // deprecated! don't rely on gM existing.
        // the window.gM ought not to be required - or if required, not required here. But moving it to extensions breaks it (?!)
        // Need to fix plugin so it could do attributes as well, then will be okay to remove this.