MediaWiki:Gadget-I18n-js.js: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
show message name for "qqx" language (with "i18njs-ScriptName-" prefix for easy identification); one return in msg()
(add msg().exists; don't duplicate escape code)
(show message name for "qqx" language (with "i18njs-ScriptName-" prefix for easy identification); one return in msg())
Line 4: Line 4:
  *
  *
  * @author Cqm <https://dev.wikia.com/User:Cqm>
  * @author Cqm <https://dev.wikia.com/User:Cqm>
  * @version 0.4.2
  * @version 0.4.3
  *
  *
  * @notes Also used by VSTF wiki for their reporting forms (with a non-dev i18n.json page)
  * @notes Also used by VSTF wiki for their reporting forms (with a non-dev i18n.json page)
Line 242: Line 242:
         if (overrides[messageKey] && overrides[messageKey][name]) {
         if (overrides[messageKey] && overrides[messageKey][name]) {
             return overrides[messageKey][name];
             return overrides[messageKey][name];
        }
        // https://www.mediawiki.org/wiki/Help:System_message#Finding_messages_and_documentation
        if (lang === 'qqx') {
            return '(i18njs-' + messageKey + '-' + name + ')';
         }
         }


Line 508: Line 513:
                 return mw.html.escape(msg);
                 return mw.html.escape(msg);
             },
             },
           
 
             /*
             /*
             * Return the message as is.
             * Return the message as is.
Line 597: Line 602:
             msg: function () {
             msg: function () {
                 var args = Array.prototype.slice.call(arguments),
                 var args = Array.prototype.slice.call(arguments),
                     lang;
                     lang = defaultLang;


                 if (tempLang !== null) {
                 if (tempLang !== null) {
                     lang = tempLang;
                     lang = tempLang;
                     tempLang = null;
                     tempLang = null;
                }


                    return message(messages, lang, args, messageKey);
                return message(messages, lang, args, messageKey);
                }
               
                return message(messages, defaultLang, args, messageKey);
             },
             },


Cookies help us deliver our services. By using our services, you agree to our use of cookies.