diff --git a/unpacked/MathJax.js b/unpacked/MathJax.js index f463ba82c..1e0033d68 100644 --- a/unpacked/MathJax.js +++ b/unpacked/MathJax.js @@ -31,8 +31,8 @@ if (document.getElementById && document.childNodes && document.createElement) { if (!window.MathJax) {window.MathJax= {}} if (!MathJax.Hub) { // skip if already loaded -MathJax.version = "2.1.1"; -MathJax.fileversion = "2.1"; +MathJax.version = "2.1"; +MathJax.fileversion = "2.1.2"; /**********************************************************/ @@ -679,7 +679,7 @@ MathJax.fileversion = "2.1"; } else { this.head = HEAD(this.head); if (this.loader[type]) {this.loader[type].call(this,file,callback)} - else {throw Error("Can't load files of type "+type)} + else {throw Error("Can't load files of type "+type)} } return callback; }, @@ -719,16 +719,18 @@ MathJax.fileversion = "2.1"; // // Create a SCRIPT tag to load the file // - JS: function (file,callback) { + JS: function (file,callback) { var script = document.createElement("script"); var timeout = BASE.Callback(["loadTimeout",this,file]); this.loading[file] = { callback: callback, - message: BASE.Message.File(file), timeout: setTimeout(timeout,this.timeout), status: this.STATUS.OK, script: script }; + // Add this to the structure above after it is created to prevent recursion + // when loading the initial localiation file (before loading messsage is available) + this.loading[file].message = BASE.Message.File(file); script.onerror = timeout; // doesn't work in IE and no apparent substitute script.type = "text/javascript"; script.src = file; @@ -882,10 +884,7 @@ MathJax.fileversion = "2.1"; // The default error hook for file load failures // loadError: function (file) { - BASE.Message.Set( - BASE.Localization._(["Message", "LoadFailed"], - "File failed to load: %1", file), - null,2000); + BASE.Message.Set(["LoadFailed","File failed to load: %1",file],null,2000); BASE.Hub.signal.Post(["file load error",file]); }, @@ -1051,6 +1050,383 @@ MathJax.HTML = { }; +/**********************************************************/ + +MathJax.Localization = { + + locale: "fr", + directory: "[MathJax]/localization", + strings: {fr: {}}, + + _: function (messageId, phrase) { + + // These variables are used in string parsing + var locale = this; + var args = arguments; + var i, s, m, resultString, resultArray; + + function parseNextUnicodePoint(appendToResult) + { + var n = s.charCodeAt(i); + if (n <= 0xD7FF || 0xE000 <= n) { + // Code points U+0000 to U+D7FF and U+E000 to U+FFFF. + // Append the character. + if (appendToResult) resultString += s[i] + i++; + return; + } else if (i+1 < m) { + // Code points U+10000 to U+10FFFF + // Append the surrogate pairs. + if (appendToResult) { resultString += s[i]; resultString += s[i+1]; } + i+=2 + return; + } + // Ignore lead surrogate at the end of the string. + // This should not happen with valid unicode string. + i++; + } + + function parseArgument(appendToResult) + { + if (!(/\d/.test(s[0]))) return false; + + // %INTEGER argument substitution + var argIndex = s.match(/^\d+/)[0]; + i += argIndex.length; + var key = +argIndex+1; + if (key in args) { + if (appendToResult) { + var e = args[key]; + if (e instanceof Array) { + // if that's an array, concatenate it to the result array + resultArray.push(resultString); + resultArray = resultArray.concat(e); + resultString = ""; + } else if (typeof e === "number") { + // if that's a number, append a localized version. + resultString += locale.number(e.toString()) + } else { + // otherwise, just concatenate it to the result string + resultString += e; + } + } + return true; + } + + // invalid index: just %INTEGER and continue + if (appendToResult) { resultString += "%" + argIndex; } + i++; + return true; + } + + function parseInteger(appendToResult) + { + var number = s.match(/^\{(\d+)\}/); + if (!number) return false; + + // %{INTEGER} escaped integer + if (appendToResult) { resultString += number[1]; } + i += number[0].length; + return true; + } + + function parseChoiceBlock(blockName, choiceFunction) + { + var pattern = "^\\{"+blockName+":%(\\d)+\\|"; + var blockStart = s.match(pattern); + if (!blockStart) return false; + + var key = +blockStart[1]+1; + if (!(key in args)) return false; + + // %\{blockName:%INTEGER|form1|form2 ... \} + i = blockStart[0].length; + + var choiceIndex = choiceFunction(args[key]), j = 1; + var isChosenBlock = (j === choiceIndex); + var blockFound = isChosenBlock; + + while (i < m) { + if (s[i] == "|") { + // new choice block + i++; j++; + isChosenBlock = (j === choiceIndex); + if (isChosenBlock) blockFound = true; + continue; + } + if (s[i] == "}") { + // closing brace + i++; + break; + } + if (s[i] != "%" || i+1 == m) { + // normal char or % at the end of the string + parseNextUnicodePoint(isChosenBlock); + continue; + } + + // keep only the substring after the % + i++; s = s.substr(i); m -= i; i = 0; + + // %INTEGER argument substitution + if (parseArgument(isChosenBlock)) continue; + + // %{INTEGER} escaped integer + if (parseInteger(isChosenBlock)) continue; + + // %CHAR: escaped character + parseNextUnicodePoint(isChosenBlock); + continue; + } + + if (!blockFound) { + i = 0; + return false; + } + + return true; + } + + function transformString(string) + { + s = string; + i = 0; + m = s.length; + resultString = ""; + resultArray = []; + + while (i < m) { + if (s[i] != "%" || i+1 == m) { + // normal char or % at the end of the string + parseNextUnicodePoint(true); + continue; + } + + // keep only the substring after the % + i++; s = s.substr(i); m -= i; i = 0; + + // %INTEGER argument substitution + if (parseArgument(true)) continue; + + // %{INTEGER} escaped integer + if (parseInteger(true)) continue; + + // %\{plural:%INTEGER|form1|form2 ... \} plural forms + if (parseChoiceBlock("plural", locale.plural)) continue; + + // %CHAR: escaped character + parseNextUnicodePoint(true); + continue; + } + + if (resultArray.length == 0) return resultString; + + return resultArray; + } + + function transformHTMLSnippet(snippet) + { + for (var key in snippet) { + var e = snippet[key]; + if (typeof e === "string") { + // transform the string content + snippet[key] = transformString(e); + continue; + } + if (e[1]) { + // transform attribute values + for (var key2 in e[1]) { + snippet[key][1][key2] = transformString(e[1][key2]); + } + } + if (e[2]) { + // transform the HTML content + snippet[key][2] = transformHTMLSnippet(e[2]); + } + } + return snippet; + } + + // + // Get the domain and messageID + // + var domain = "_"; + if (messageId instanceof Array) { + domain = (messageId[0] || "_"); + messageId = (messageId[1] || ""); + } + // + // Check if the data is available and if not, + // load it and throw a restart error so the calling + // code can wait for the load and try again. + // + var load = this.loadDomain(domain); + if (load) {MathJax.Hub.RestartAfter(load)} + // + // Look up the message in the localization data + // (if not found, the original English is used) + // + var localeData = this.strings[this.locale]; + if (localeData) { + if (localeData.domains && domain in localeData.domains) { + var domainData = localeData.domains[domain]; + if (domainData.strings && messageId in domainData.strings) + {phrase = domainData.strings[messageId]} + } + } + + if (typeof phrase === "string") { + // handle the phrase as a simple string + return transformString(phrase); + } + + // handle the phrase as a HTML snippet + return transformHTMLSnippet(phrase); + }, + + // + // Load a langauge data file from the proper + // directory and file. + // + loadFile: function (file,data) { + file = (data.file || file); // the data's file name or the default name + if (!file.match(/\.js$/)) {file += ".js"} // add .js if needed + // + // Add the directory if the file doesn't + // contain a full URL already. + // + if (!file.match(/^([a-z]+:|\[MathJax\])/)) { + var dir = (this.strings[this.locale].directory || + this.directory + "/" + this.locale || + "[MathJax]/localization/" + this.locale); + file = dir + "/" + file; + } + // + // Load the file and mark the data as loaded (even if it + // failed to load, so we don't continue to try to load it + // over and over). + // + var load = MathJax.Ajax.Require(file,function () {data.isLoaded = true}); + // + // Return the callback if needed, otherwise null. + // + return (load.called ? null : load); + }, + + // + // Check to see if the localization data are loaded + // for the given domain; if not, load the data file, + // and return a callback for the loading operation. + // Otherwise return null (data are loaded). + // + loadDomain: function (domain) { + var load; + var localeData = this.strings[this.locale]; + if (localeData) { + if (!localeData.isLoaded) { + load = this.loadFile(this.locale,localeData); + if (load) {return load} + } + if (localeData.domains && domain in localeData.domains) { + var domainData = localeData.domains[domain]; + if (!domainData.isLoaded) { + load = this.loadFile(domain,domainData); + if (load) {return load} + } + } + } + return null; // localization data are loaded + }, + + // + // Perform a function, properly handling + // restarts due to localization file loads. + // + // Note that this may return before the function + // has been called successfully, so you should + // consider fn as running asynchronously. (Callbacks + // can be used to synchronize it with other actions.) + // + Try: function (fn) { + fn = MathJax.Callback(fn); fn.autoReset = true; + try {fn()} catch (err) { + if (!err.restart) {throw err} + MathJax.Callback.After(["Try",this,fn],err.restart); + } + }, + + // + // Set the current language + // + setLocale: function(locale) { + // don't set it if there isn't a definition for it + if (this.strings[locale]) {this.locale = locale} + }, + + // + // Add or update a language or domain + // + addTranslation: function (locale,domain,definition) { + var data = this.strings[locale]; + if (!data) {data = this.strings[locale] = {}} + if (!data.domains) {data.domains = {}} + if (domain) { + if (!data.domains[domain]) {data.domains[domain] = {}} + data = data.domains[domain]; + } + MathJax.Hub.Insert(data,definition); + }, + + // + // Set CSS for an element based on font requirements + // + setCSS: function (div) { + var locale = this.strings[this.locale]; + if (locale) { + if (locale.fontFamily) {div.style.fontFamily = locale.fontFamily} + if (locale.fontDirection) { + div.style.direction = locale.fontDirection; + if (locale.fontDirection === "rtl") {div.style.textAlign = "right"} + } + } + return div; + }, + + // + // Get the language's font family or direction + // + fontFamily: function () { + var locale = this.strings[this.locale]; + return (locale ? locale.fontFamily : null); + }, + fontDirection: function () { + var locale = this.strings[this.locale]; + return (locale ? locale.fontDirection : null); + }, + + // + // Get the language's plural index for a number + // + plural: function (n) { + var locale = this.strings[this.locale]; + if (locale && locale.plural) {return locale.plural(n)} + // default + if (n == 1) {return 1} // one + return 2; // other + }, + + // + // Convert a number to language-specific form + // + number: function(n) { + var locale = this.strings[this.locale]; + if (locale && locale.number) {return locale.number(n)} + // default + return n; + } +}; + + /**********************************************************/ MathJax.Message = { @@ -1135,24 +1511,21 @@ MathJax.Message = { frame = frame.firstChild; frame.style.height = body.clientHeight + 'px'; }, + + localize: function (message) { + return MathJax.Localization._(message,message); + }, - // Localization: - // - This will be a bit tedious, because some regexp matching and other - // concatenations are done. - // - In RTL languages: perhaps a "direction: rtl" style is needed somewhere ; - // the message box may need to be placed on the right hand side. - // - Perhaps related to the other messages "Loading", "Processing", - // "Typesetting" elsewhere. - filterText: function (text,n) { + filterText: function (text,n,id) { if (MathJax.Hub.config.messageStyle === "simple") { - if (text.match(/^Loading /)) { - if (!this.loading) {this.loading = "Loading "} + if (id === "LoadFile") { + if (!this.loading) {this.loading = this.localize("Loading") + " "} text = this.loading; this.loading += "."; - } else if (text.match(/^Processing /)) { - if (!this.processing) {this.processing = "Processing "} + } else if (id === "ProcessMath") { + if (!this.processing) {this.processing = this.localize("Processing") + " "} text = this.processing; this.processing += "."; - } else if (text.match(/^Typesetting /)) { - if (!this.typesetting) {this.typesetting = "Typesetting "} + } else if (id === "TypesetMath") { + if (!this.typesetting) {this.typesetting = this.localize("Typesetting") + " "} text = this.typesetting; this.typesetting += "."; } } @@ -1160,14 +1533,49 @@ MathJax.Message = { }, Set: function (text,n,clearDelay) { - if (this.timer) {clearTimeout(this.timer); delete this.timeout} if (n == null) {n = this.log.length; this.log[n] = {}} - this.log[n].text = text; this.log[n].filteredText = text = this.filterText(text,n); + // + // Translate message if it is [id,message,arguments] + // + var id = ""; + if (text instanceof Array) { + id = text[0]; if (id instanceof Array) {id = id[1]} + // + // Localization._() will throw a restart error if a localization file + // needs to be loaded, so trap that and redo the Set() call + // after it is loaded. + // + try { + text = MathJax.Localization._.apply(MathJax.Localization,text); + } catch (err) { + if (!err.restart) {throw err} + if (!err.restart.called) { + this.log[n].restarted = true; // mark it so we can tell if the Clear() comes before the message is up + MathJax.Callback.After(["Set",this,text,n,clearDelay],err.restart); + return n; + } + } + } + // + // Clear the timout timer. + // + if (this.timer) {clearTimeout(this.timer); delete this.timer} + // + // Save the message and filtered message. + // + this.log[n].text = text; this.log[n].filteredText = text = this.filterText(text,n,id); + // + // Hook the message into the message list so we can tell + // what message to put up when this one is removed. + // if (typeof(this.log[n].next) === "undefined") { this.log[n].next = this.current; if (this.current != null) {this.log[this.current].prev = n} this.current = n; } + // + // Show the message if it is the currently active one. + // if (this.current === n && MathJax.Hub.config.messageStyle !== "none") { if (this.Init()) { if (this.textNodeBug) {this.div.innerHTML = text} else {this.text.nodeValue = text} @@ -1178,24 +1586,50 @@ MathJax.Message = { this.status = true; } } + // + // Check if the message was resetarted to load a localization file + // and if it has been cleared in the meanwhile. + // + if (this.log[n].restarted) { + if (this.log[n].cleared) {clearDelay = 0} + delete this.log[n].restarted, this.log[n].cleared; + } + // + // Check if we need to clear the message automatically. + // if (clearDelay) {setTimeout(MathJax.Callback(["Clear",this,n]),clearDelay)} else if (clearDelay == 0) {this.Clear(n,0)} + // + // Return the message number. + // return n; }, Clear: function (n,delay) { + // + // Detatch the message from the active list. + // if (this.log[n].prev != null) {this.log[this.log[n].prev].next = this.log[n].next} if (this.log[n].next != null) {this.log[this.log[n].next].prev = this.log[n].prev} + // + // If it is the current message, get the next one to show. + // if (this.current === n) { this.current = this.log[n].next; if (this.text) { if (this.div.parentNode == null) {this.Init()} // see ASCIIMathML comments above if (this.current == null) { - if (this.timer) {clearTimeout(this.timer); delete this.timer} + // + // If there are no more messages, remove the message box. + // + if (this.timer) {clearTimeout(this.timer); delete this.timer} if (delay == null) {delay = 600} if (delay === 0) {this.Remove()} else {this.timer = setTimeout(MathJax.Callback(["Remove",this]),delay)} } else if (MathJax.Hub.config.messageStyle !== "none") { + // + // If there is an old message, put it in place + // if (this.textNodeBug) {this.div.innerHTML = this.log[this.current].filteredText} else {this.text.nodeValue = this.log[this.current].filteredText} } @@ -1204,8 +1638,16 @@ MathJax.Message = { window.status = (this.current == null ? "" : this.log[this.current].text); } } + // + // Clean up the log data no longer needed + // delete this.log[n].next; delete this.log[n].prev; delete this.log[n].filteredText; + // + // If this is a restarted localization message, mark that it has been cleared + // while waiting for the file to load. + // + if (this.log[n].restarted) {this.log[n].cleared = true} }, Remove: function () { @@ -1217,10 +1659,7 @@ MathJax.Message = { File: function (file) { var root = MathJax.Ajax.config.root; if (file.substr(0,root.length) === root) {file = "[MathJax]"+file.substr(root.length)} - // Localization: - // This is used in the HTML output jax, - // MathJax.Message.File("Web-Font "+...) and so needs to be adapted. - return this.Set("Loading "+file); + return this.Set(["LoadFile","Loading %1",file],null,null); }, Log: function () { @@ -1279,9 +1718,8 @@ MathJax.Hub = { }, errorSettings: { - // Localization: not defined at that point. - // should be updated when the language is changed message: ["[Math Processing Error]"], // HTML snippet structure for message to use + messageId: "MathProcessingErrorHTML", // ID of snippet for localization style: {color: "#CC0000", "font-style":"italic"} // style for message } }, @@ -1567,7 +2005,7 @@ MathJax.Hub = { // if (state.scripts.length && this.config.showProcessingMessages) // Localization: see filterText - {MathJax.Message.Set("Processing math: 100%",0)} + {MathJax.Message.Set(["ProcessMath","Processing math: %1%%",100],0)} state.start = new Date().getTime(); state.i = state.j = 0; return null; }, @@ -1619,7 +2057,7 @@ MathJax.Hub = { } } catch (err) { if (!err.restart) { - MathJax.Message.Set("Error preparing "+id+" output ("+method+")",null,600); + MathJax.Message.Set(["PrepError","Error preparing %1 output (%2)",id,method],null,600); MathJax.Hub.lastPrepError = err; state.j++; } @@ -1666,8 +2104,7 @@ MathJax.Hub = { // Put up the typesetting-complete message // if (state.scripts.length && this.config.showProcessingMessages) { - // Localization: see filterText - MathJax.Message.Set("Typesetting math: 100%",0); + MathJax.Message.Set(["TypesetMath","Typesetting math: %1%%",100],0); MathJax.Message.Clear(0); } state.i = state.j = 0; @@ -1676,9 +2113,9 @@ MathJax.Hub = { processMessage: function (state,type) { var m = Math.floor(state.i/(state.scripts.length)*100); - // Localization: see filterText - var message = (type === "Output" ? "Typesetting" : "Processing"); - if (this.config.showProcessingMessages) {MathJax.Message.Set(message+" math: "+m+"%",0)} + var message = (type === "Output" ? ["TypesetMath","Typesetting math: %1%%"] : + ["ProcessMath","Processing math: %1%%"]); + if (this.config.showProcessingMessages) {MathJax.Message.Set(message.concat(m),0)} }, processError: function (err,state,type) { @@ -1691,7 +2128,9 @@ MathJax.Hub = { }, formatError: function (script,err) { - var error = MathJax.HTML.Element("span",{className:"MathJax_Error"},this.config.errorSettings.message); + var errorSettings = this.config.errorSettings; + var errorText = MathJax.Localization._(errorSettings.messageId,errorSettings.message); + var error = MathJax.HTML.Element("span",{className:"MathJax_Error"},errorText); error.jaxID = "Error"; if (MathJax.Extension.MathEvents) { error.oncontextmenu = MathJax.Extension.MathEvents.Event.Menu; @@ -2138,6 +2577,7 @@ MathJax.Hub.Startup = { BASE.InputJax = JAX.Subclass({ elementJax: "mml", // the element jax to load for this input jax + sourceMenuTitle: /*_(MathMenu)*/ ["OriginalForm","Original Form"], copyTranslate: true, Process: function (script,state) { var queue = CALLBACK.Queue(), file; @@ -2317,14 +2757,16 @@ MathJax.Hub.Startup = { id: "Error", version: "2.1", config: {}, ContextMenu: function () {return BASE.Extension.MathEvents.Event.ContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)}, Mousedown: function () {return BASE.Extension.MathEvents.Event.AltContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)}, - // Localization: should this be translated? - getJaxFromMath: function () {return {inputJax:"Error", outputJax:"Error", originalText:"Math Processing Error"}} + getJaxFromMath: function () { + return { + inputJax: "Error", outputJax: "Error", + originalText: BASE.Localization._("MathProcessingError","Math Processing Error") + }; + } }; BASE.InputJax.Error = { id: "Error", version: "2.1", config: {}, - // Localization: should this be translated? - // should be updated when the language is changed - sourceMenuTitle: "Error Message" + sourceMenuTitle: /*_(MathMenu)*/ ["ErrorMessage","Error Message"] }; })("MathJax"); @@ -2498,625 +2940,3 @@ MathJax.Hub.Startup = { })("MathJax"); }} - -/**********************************************************/ - -MathJax.Localization = { - - locale: "en", - directory: "[MathJax]/localization", - strings: { - fr: { - isLoaded: true, - domains: { - "_": { - isLoaded: true, - strings: { - CookieConfig: - "MathJax a trouvé un cookie de configuration utilisateur qui inclut"+ - "du code à exécuter. Souhaitez vous l'exécuter?\n\n"+ - "(Choisissez Annuler sauf si vous avez créé ce cookie vous-même", - MathProcessingError: - "Erreur de traitement de la formule mathématique", - MathError: - "Erreur dans la formule mathématique" - } - }, - Message: { - isLoaded: true, - strings: { - LoadFailed: "Échec du téléchargement de %1", - CantLoadWebFont: "Impossible de télécharcharger la police Web %1", - FirefoxCantLoadWebFont: - "Firefox ne peut télécharger les polices Web à partir d'un hôte"+ - "distant", - CantFindFontUsing: - "Impossible de trouver une police valide en utilisant %1", - WebFontsNotAvailable: - "Polices Web non disponibles -- des images de caractères vont être"+ - "utilisées à la place", - MathJaxNotSupported: - "Votre navigateur ne supporte pas MathJax" - } - }, - FontWarnings: { - isLoaded: true, - strings: { - webFont: - "MathJax utilise les polices Web pour afficher les expressions " + - "mathématiques sur cette page. Celles-ci mettent du temps à être "+ - "téléchargées et la page serait affichée plus rapidement si vous "+ - "installiez les polices mathématiques directement dans le dossier "+ - "des polices de votre système.", - - imageFonts: - "MathJax utilise des images de caractères plutôt que les polices "+ - "Web ou locales. Ceci rend le rendu plus lent que la normale et "+ - "les expressions mathématiques peuvent ne pas s'imprimer à la "+ - "résolution maximale de votre imprimante", - - noFonts: - "MathJax n'est pas parvenu à localiser une police pour afficher "+ - "les expressions mathématiques et les images de caractères ne "+ - "sont pas disponibles. Comme solution de dernier recours, il "+ - "utilise des caractères Unicode génériques en espérant que votre "+ - "navigateur sera capable de les afficher. Certains pourront ne "+ - "être rendus de façon incorrect voire pas du tout.", - - webFonts: - "La plupart des navigateurs modernes permettent de télécharger "+ - "des polices à partir du Web. En mettant à jour pour une version "+ - "plus récente de votre navigateur (ou en changeant de navigateur) "+ - "la qualité des expressions mathématiques sur cette page pourrait "+ - "être améliorée.", - - fonts: - "%1 MathJax peut utiliser les %2 ou bien les %3. Téléchargez et"+ - "installez l'une de ces familles de polices pour améliorer votre"+ - "expérience avec MathJax.", - - PageDesigned: - "%1 Cette page est conçue pour utiliser les %2. Téléchargez "+ - " et installez ces polices pour améliorer votre expérience "+ - "avec MathJax", - - STIXfonts: - "Polices STIX", - - TeXfonts: - "Polices TeX de MathJax", - } - }, - - Menu: { - isLoaded: true, - strings: { - AboutBox: - "%1 utilisant %2", - - WebkitNativeMMLWarning: - - "Votre navigateur ne semble pas comporter de support MathML, " + - "changer le mode de rendu pourrait rendre illisibles " + - "les expressions mathématiques.", - - MSIENativeMMLWarning: - - "Internet Explorer a besoin de module complémentaire MathPlayer " + - "pour afficher le MathML.", - - OperaNativeMMLWarning: - - "Le support MathML d'Opera est limité, changer le mode de rendu " + - "pourrait entrainer un affichage médiocre de certaines expressions.", - - SafariNativeMMLWarning: - - "Le support MathML natif de votre navigateur ne comporte pas " + - "toutes les fonctionnalités requises par MathJax, certaines " + - "expressions pourront donc ne pas s'afficher correctement.", - - FirefoxNativeMMLWarning: - - "Le support MathML natif de votre navigateur ne comporte pas " + - "toutes les fonctionnalités requises par MathJax, certaines " + - "expressions pourront donc ne pas s'afficher correctement.", - - SwitchAnyway: - "Êtes vous certain de vouloir changer le mode de rendu ?\n\n" + - "Appuyez sur OK pour valider ou Annuler pour continuer avec le " + - "mode de rendu actuellement sélectionné.", - - ScaleMath: - "Mise à l'échelle des expressions mathématiques (par rapport au " + - "text environnant) de %1%%", - - NonZeroScale: - "L'échelle ne peut être nulle", - - PercentScale: - "L'échelle doit être un pourcentage (e.g. 120%%)", - - IE8warning: - "Ceci désactivera le menu de MathJax et les fonctionalités de " + - "zoom mais vous pourrez toujours obtenir le menu de MathJax " + - "en utilisant la commande Alt+Clic sur une expression.\n\n" + - "Êtes vous certain de vouloir choisir les options de MathPlayer?", - - IE9warning: - "Le menu contextuel de MathJax sera désactivé, " + - "mais vous pourrez toujours obtenir le menu de MathJax " + - "en utilisant la commande Alt-Clic sur une expression.", - - NoOriginalForm: - "Aucune forme d'origine disponible.", - - Close: - "Fermer", - - EqSource: - "Source de l'équation MathJax" - } - }, - - ConfigWarning: { - isLoaded: true, - strings: { - MissingConfig: - "%1 MathJax ne charge plus de fichier de configuration par défaut"+ - " ; vous devez spécifier ces fichiers de façons explicites. Cette"+ - " page semble utiliser l'ancien fichier de configuration par "+ - "défaut %2 and doit donc être mise à jour. Ceci est expliqué "+ - "en détails à l'addresse suivante: %3" - } - }, - - Tex: { - isLoaded: true, - strings: { - ExtraCloseMissingOpen: - "Accolade fermante non attendue ou accolade ouvrante manquante", - MissingLeftExtraRight: - "Commande \\left manquante or ou commande \\right non attendue", - MissingScript: - "Argument en exposant ou en indice manquant", - ExtraLeftMissingRight: - "Commande \\left inattendue or ou commande \\right manquante", - Misplaced: "Mauvaise position pour la commande %1", - MissingOpenForScript: - "Accolade ouvrante manquante pour le script %1", - AmbiguousUseOf: - "Usage ambigu de la commande %1", - EnvBadEnd: - "\\begin{%1} s'est terminé par un \\end{%2}", - EnvMissingEnd: - "\\end{%1} manquant", - MissingBoxFor: - "Boite manquante pour la commande %1", - MissingCloseBrace: - "Accolade fermante manquante", - UndefinedControlSequence: - "Commande %1 non définie", - IllegalControlSequenceName: - "Nom de contrôle de séquence non autorisé pour la commande %1", - IllegalParamNumber: - "Nombre de paramètres incorrect pour la commande %1", - DoubleExponent: - "Double exposant: utilisez des accolades pour clarifier", - DoubleSubscripts: - "Double indice: utilisez des accolades pour clarifier", - DoubleExponentPrime: - "Un prime entraine un double exposant: utilisez"+ - "des accolades pour clarifier", - CantUseHash1: - "Vous ne pouvez pas utilisez le caractère #, indiquant un "+ - "paramètre de macro, dans le mode mathématique", - CantUseHash2: - "Usage du caractère # non autorisé dans le modèle pour la séquence"+ - "de contrôle %1", - MisplacedMiddle: - "La commande %1 doit être placée à l'intérieur d'une section"+ - "\\left ... \right", - MisplacedLimits: - "La commande %1 n'est autorisée que sur les opérateurs", - MisplacedMoveRoot: - "La commande %1 n'est autorisée qu'à l'intérieur d'une racine", - MultipleMoveRoot: - "Commande %1 redondante", - IntegerArg: - "L'argument de la commande %1 doit être un entier", - PositiveIntegerArg: - "L'argument de la commande %1 doit être un entier strictement"+ - "positif", - NotMathMLToken: - "L'élément %1 n'est pas un élément MathML élémentaire", - InvalidMathMLAttr: - "Attribut MathML non valide: %1", - UnknownAttrForElement: - "Attribut %1 inconnu pour l'élément %2", - MaxMacroSub1: - "Le nombre maximal de substitution de macro autorisé par MathJax "+ - "a été dépassé. Il y a t'il un appel de macro récursif?", - MaxMacroSub2: - "Le nombre maximal de substitution de macro autorisé par MathJax "+ - "a été dépassé. Il y a t'il un environnement LaTeX récursif?", - MissingArgFor: - "Argument manquant pour la commande %1", - ExtraAlignTab: - "Tabulation d'alignement non attendu pour le texte de la commande"+ - "\\cases", - BracketMustBeDimension: - "L'argument entre crochets de la commande %1 doit être une"+ - "dimension", - InvalidEnv: - "Nom d'environnement '%1' non valide", - UnknownEnv: - "Environnement '%1' inconnu", - ExtraClose: - "Accolade fermante non attendue", - ExtraCloseInBrackets: - "Accolade fermante non attendue avant le crochet fermant.", - MissingCloseBracket: - "Impossible de trouver le crochet fermant pour l'argument de la "+ - "commande %1", - MissingOrUnrecognizedDelim: - "Délimiteur manquant ou non reconnu pour la commande %1", - MissingDimOrUnits: - "Dimension ou unité manquante pour la commande %1", - ExtraCloseBraceInUpTo: - "Accolade fermante non attendue avant la commande %1", - TokenNotFoundForCommand: - "Impossible de trouver la commande %1 pour la commande %2", - MathNotTerminated: - "Expression mathématique non terminée à l'intérieur de cette boite"+ - " de texte", - IllegalMacroParam: - "Paramètre de référence de macro non autorisé", - MaxBufferSize: - "Taille maximale du tampon interne de MathJax dépassée. " + - "Il y a t'il un appel de macro récursif?", - CommandNotAllowedInEnv: - "La commande %1 n'est pas autorisé à l'intérieur de"+ - "l'environnement %2", - MultipleCommand: "Usage multiple de la commande %1", - MultipleLabel: "Étiquette '%1' déjà définie", - CommandAtTheBeginingOfLine: - "La commande %1 doit être placée en début de ligne", - IllegalAlign: "Alignement non autorisé pour la commande %1", - BadMathStyleFor: - "Style mathématique non valide pour la commande %1", - ErroneousNestingEq: - "Emboitement incorrect des structures d'équation", - MultipleRowsOneCol: - "Les lignes multiples doivent avoir exactement une colonne", - NoClosingDelim: - "Impossible de trouver le délimiteur fermant pour la commande %1", - NoClosingChar: - "Impossible de trouver le délimiteur '%1' fermant", - MultipleBBoxProperty: - "La propriété %1 de la commande %2 spécifiée deux fois", - InvalidBboxProperty: - "La valeur '%1' ne semble pas être une couleur, une dimension ou"+ - "de marge intérieur ou un style.", - ExtraEndMissingBegin: - "Commande %1 non attendue ou commande \\begingroup manquante", - GlobalNotFollowedBy: - "Command %1 non suivie d'une commande \\let, \\def ou \newcommand", - NewextarrowArg1: - "Le premier argument de la commande %1 doit être le nom d'une"+ - "séquence de contrôle", - NewextarrowArg2: - "Le second argument de la commande %1 doit être deux entiers"+ - "séparés par une virgule", - NewextarrowArg3: - "Le troisième argument de la commande %1 doit être la valeur d'un"+ - "caractère unicode", - UndefinedColorModel: - "Le modèle de couleur '%1' n'est pas défini", - rgbArg1: - "Les couleurs rgb nécéssitent 3 nombres décimaux", - InvalidDecimalNumber: "Nombre décimal non valide", - rgbArg2: "Les valeurs rgb doivent être comprises entre 0 et 1", - RGBArg1: "Les couleurs RGB nécéssitent 3 nombres", - InvalidNumber: "Nombre non valide", - RGBArg2: "Les valeurs RGB doivent être comprises entre 0 et 255", - GrayScalerArg: - "Les valeurs de dégradé de gris doivent être comprises entre 0 et 1", - DoubleBackSlash: - "\\ doit être suivi d'une séquence de contrôle", - SequentialParam: - "Les paramètres de la séquence de contrôle %1 doivent être"+ - "énumérés de façon séquentielle", - MissingReplacementString: - "Chaine de caractère de remplacement manquante pour la définition %1", - MismatchUseDef: - "L'utilisation de la commande %1 ne correspond pas à sa définition", - RunawayArgument: - "Argument manquant pour la commande %1 ?" - } - }, - - MathML: { - isLoaded: true, - strings: { - BadMglyph: "Élement mglyph incorrect: %1", - BadMglyphFont: "Police de caractère incorrecte: %1", - MathPlayer: - "MathJax n'est pas parvenu à configurer MathPlayer.\n\n"+ - "Vous devez d'abord installer MathPlayer. Si c'est déjà le cas,\n"+ - "vos paramètres de sécurités peuvent empêcher l'exécution des\n"+ - "contrôles ActiveX. Sélectionnez Options Internet dans le menu\n"+ - "Outils et sélectionnez l'onglet Sécurité. Appuyez ensuite sur\n"+ - "le menu Niveau Personalisé. Assurez vous que les paramètres\n"+ - "Exécution des contrôles ActiveX et Comportements des exécutables\n"+ - "et des scripts sont activés.\n\n"+ - "Actuellement, vous verez des messages d'erreur à la place des"+ - "expressions mathématiques.", - CantCreateXMLParser: - "MathJax ne peut créer un analyseur grammatical XML pour le MathML", - UnknownNodeType: "Type de noeud inconnu: %1", - UnexpectedTextNode: "Noeud de texte inattendu: %1", - ErrorParsingMathML: - "Erreur lors de l'analyse grammaticale du code MathML", - MathMLSingleElement: - "Le code MathML doit être formé d'un unique élément", - MathMLRootElement: - "Le code MathML doit être formé d'un élément et non un"+ - "élément %1" - } - } - }, - - plural: function(n) { - if (0 <= n && n < 2) return 1; // one - return 2; // other - }, - - number: function(n) { - return n.replace(".", ","); // replace dot by comma - } - - } - }, - - _: function (messageId, englishPhrase) { - - // These variables are used in string parsing - var locale = this; - var args = arguments; - var i, s, resultString, resultArray; - - function parseNextUnicodePoint(appendToResult) - { - var n = s.charCodeAt(i); - if (n <= 0xD7FF || 0xE000 <= n) { - // Code points U+0000 to U+D7FF and U+E000 to U+FFFF. - // Append the character. - if (appendToResult) resultString += s[i] - i++; - return; - } else if (i+1 < m) { - // Code points U+10000 to U+10FFFF - // Append the surrogate pairs. - if (appendToResult) { resultString += s[i]; resultString += s[i+1]; } - i+=2 - return; - } - // Ignore lead surrogate at the end of the string. - // This should not happen with valid unicode string. - i++; - } - - function parseArgument(appendToResult) - { - if (!(/\d/.test(s[0]))) return false; - - // %INTEGER argument substitution - var argIndex = s.match(/^\d+/)[0]; - i += argIndex.length; - var key = +argIndex+1; - if (key in args) { - if (appendToResult) { - var e = args[key]; - if (e instanceof Array) { - // if that's an array, concatenate it to the result array - resultArray.push(resultString); - resultArray = resultArray.concat(e); - resultString = ""; - } else if (typeof e === "number") { - // if that's a number, append a localized version. - resultString += locale.number(e.toString()) - } else { - // otherwise, just concatenate it to the result string - resultString += e; - } - } - return true; - } - - // invalid index: just %INTEGER and continue - if (appendToResult) { resultString += "%" + argIndex; } - i++; - return true; - } - - function parseInteger(appendToResult) - { - var number = s.match(/^\{(\d+)\}/); - if (!number) return false; - - // %{INTEGER} escaped integer - if (appendToResult) { resultString += number[1]; } - i += number[0].length; - return true; - } - - function parseChoiceBlock(blockName, choiceFunction) - { - var pattern = "^\\{"+blockName+":%(\\d)+\\|"; - var blockStart = s.match(pattern); - if (!blockStart) return false; - - var key = +blockStart[1]+1; - if (!(key in args)) return false; - - // %\{blockName:%INTEGER|form1|form2 ... \} - i = blockStart[0].length; - - var choiceIndex = choiceFunction(args[key]), j = 1; - var isChosenBlock = (j === choiceIndex); - var blockFound = isChosenBlock; - - while (i < m) { - if (s[i] == "|") { - // new choice block - i++; j++; - isChosenBlock = (j === choiceIndex); - if (isChosenBlock) blockFound = true; - continue; - } - if (s[i] == "}") { - // closing brace - i++; - break; - } - if (s[i] != "%" || i+1 == m) { - // normal char or % at the end of the string - parseNextUnicodePoint(isChosenBlock); - continue; - } - - // keep only the substring after the % - i++; s = s.substr(i); m -= i; i = 0; - - // %INTEGER argument substitution - if (parseArgument(isChosenBlock)) continue; - - // %{INTEGER} escaped integer - if (parseInteger(isChosenBlock)) continue; - - // %CHAR: escaped character - parseNextUnicodePoint(isChosenBlock); - continue; - } - - if (!blockFound) { - i = 0; - return false; - } - - return true; - } - - function transformString(string) - { - s = string; - i = 0; - m = s.length; - resultString = ""; - resultArray = []; - - while (i < m) { - if (s[i] != "%" || i+1 == m) { - // normal char or % at the end of the string - parseNextUnicodePoint(true); - continue; - } - - // keep only the substring after the % - i++; s = s.substr(i); m -= i; i = 0; - - // %INTEGER argument substitution - if (parseArgument(true)) continue; - - // %{INTEGER} escaped integer - if (parseInteger(true)) continue; - - // %\{plural:%INTEGER|form1|form2 ... \} plural forms - if (parseChoiceBlock("plural", locale.plural)) continue; - - // %CHAR: escaped character - parseNextUnicodePoint(true); - continue; - } - - if (resultArray.length == 0) return resultString; - - return resultArray; - } - - function transformHTMLSnippet(snippet) - { - for (var key in snippet) { - var e = snippet[key]; - if (typeof e === "string") { - // transform the string content - snippet[key] = transformString(e); - continue; - } - if (e[1]) { - // transform attribute values - for (var key2 in e[1]) { - snippet[key][1][key2] = transformString(e[1][key2]); - } - } - if (e[2]) { - // transform the HTML content - snippet[key][2] = transformHTMLSnippet(e[2]); - } - } - return snippet; - } - - // try to get the translated phrase or use the englishPhrase fallback - var phrase = englishPhrase; - var translationData = this.strings[this.locale]; - if (translationData) { - if (translationData.isLoaded) { - var domain = "_"; - if (messageId instanceof Array && messageId.length == 2) { - domain = messageId[0]; - messageId = messageId[1]; - } - if (domain in translationData.domains) { - domain = translationData.domains[domain] - if (domain.isLoaded && messageId in domain.strings) { - phrase = domain.strings[messageId]; - } - } - } - } - - if (typeof phrase === "string") { - // handle the phrase as a simple string - return transformString(phrase); - } - - // handle the phrase as a HTML snippet - return transformHTMLSnippet(phrase); - }, - - setLocale: function(locale) { - this.locale = locale; - this.plural = this.strings[locale].plural; - this.number = this.strings[locale].number; - // TODO - }, - - addTranslation: function (locale, domain, definition) { - // TODO - }, - - fontFamily: function () { - return null; - }, - - plural: function(n) { - if (n == 1) return 1; // one - return 2; // other - }, - - number: function(n) { - return n; - } -}; diff --git a/unpacked/config/Accessible-full.js b/unpacked/config/Accessible-full.js index 4aa8b06c2..b1e5bed3b 100644 --- a/unpacked/config/Accessible-full.js +++ b/unpacked/config/Accessible-full.js @@ -24,8 +24,8 @@ MathJax.Hub.Config({ mpMouse: true }, errorSettings: { - // Localization: should be updated when the language is changed - message: ["["+MathJax.Localization._("MathError", "Math Error")+"]"] + message: ["[Math Error]"], + messageId: "MathErrorHTML" } }); diff --git a/unpacked/config/Accessible.js b/unpacked/config/Accessible.js index 384c60102..41a2820e6 100644 --- a/unpacked/config/Accessible.js +++ b/unpacked/config/Accessible.js @@ -24,8 +24,8 @@ MathJax.Hub.Config({ mpMouse: true }, errorSettings: { - // Localization: should be updated when the language is changed - message: ["["+MathJax.Localization._("MathError", "Math Error")+"]"] + message: ["[Math Error]"], + messageId: "MathErrorHTML" } }); diff --git a/unpacked/config/MMLorHTML.js b/unpacked/config/MMLorHTML.js index 124d4cc7c..623acfea0 100644 --- a/unpacked/config/MMLorHTML.js +++ b/unpacked/config/MMLorHTML.js @@ -98,9 +98,9 @@ HUB.PreProcess.disabled = true; HUB.prepareScripts.disabled = true; MathJax.Message.Set( - MathJax.Localization._(["Message", MathJaxNotSupported], - "Your browser does not support MathJax"), - null,4000); + ["MathJaxNotSupported","Your browser does not support MathJax"], + null,4000 + ); HUB.Startup.signal.Post("MathJax not supported"); } }); diff --git a/unpacked/config/default.js b/unpacked/config/default.js index 008f00f31..06f1cc5a3 100644 --- a/unpacked/config/default.js +++ b/unpacked/config/default.js @@ -236,10 +236,8 @@ MathJax.Hub.Config({ // jax that prevents it from operating properly). // errorSettings: { - // Localization: - // TODO - // should be updated when the language is changed - message: ["[MathProcessingError]"], // HTML snippet structure for message to use + message: ["[Math Processing Error]"], // HTML snippet structure for message to use + messageId: "MathProcessingError", // ID of snippet for localization style: {color: "#CC0000", "font-style":"italic"} // style for message }, diff --git a/unpacked/extensions/FontWarnings.js b/unpacked/extensions/FontWarnings.js index a1cf936e2..3da586a33 100644 --- a/unpacked/extensions/FontWarnings.js +++ b/unpacked/extensions/FontWarnings.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/FontWarnings.js @@ -85,11 +86,11 @@ */ (function (HUB,HTML) { - var VERSION = "2.1"; + var VERSION = "2.1.1"; var _ = function (id) { return MathJax.Localization._.apply(MathJax.Localization, - [ ["FontWarnings",id] ].concat([].slice.call(arguments,1)) + [["FontWarnings",id]].concat([].slice.call(arguments,1)) ); } @@ -194,7 +195,7 @@ ], fonts: _("fonts", - "%1 MathJax can use either the %2 or the % "+ + "%1 MathJax can use either the %2 or the %3 "+ ". Download and install either one to improve your MathJax experience.", [["p"]], [["a",{href:"http://www.stixfonts.org/",target:"_blank"}, diff --git a/unpacked/extensions/MathEvents.js b/unpacked/extensions/MathEvents.js index 54b9119a2..074b057a2 100644 --- a/unpacked/extensions/MathEvents.js +++ b/unpacked/extensions/MathEvents.js @@ -22,8 +22,8 @@ * limitations under the License. */ -(function (HUB,HTML,AJAX,CALLBACK,OUTPUT,INPUT) { - var VERSION = "2.1"; +(function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) { + var VERSION = "2.1.1"; var EXTENSION = MathJax.Extension; var ME = EXTENSION.MathEvents = {version: VERSION}; @@ -141,33 +141,46 @@ } // - // If the menu code is loaded, post the menu - // Otherwse lad the menu code and try again + // If the menu code is loaded, + // Check if localization needs loading; + // If not, post the menu, and return. + // Otherwise wait for the localization to load + // Otherwse load the menu code. + // Try again after the file is loaded. // - var MENU = MathJax.Menu; + var MENU = MathJax.Menu; var load, fn; if (MENU) { - MENU.jax = jax; - var source = MENU.menu.Find("Show Math As").menu; - source.items[1].name = (INPUT[jax.inputJax].sourceMenuTitle||"Original Form"); - source.items[0].hidden = (jax.inputJax === "Error"); // hide MathML choice for error messages - var MathPlayer = MENU.menu.Find("Math Settings","MathPlayer"); - MathPlayer.hidden = !(jax.outputJax === "NativeMML" && HUB.Browser.hasMathPlayer); - return MENU.menu.Post(event); - } else { - if (!AJAX.loadingMathMenu) { - AJAX.loadingMathMenu = true; - var ev = { - pageX:event.pageX, pageY:event.pageY, - clientX:event.clientX, clientY:event.clientY - }; - CALLBACK.Queue( - AJAX.Require("[MathJax]/extensions/MathMenu.js"), - function () {delete AJAX.loadingMathMenu; if (!MathJax.Menu) {MathJax.Menu = {}}}, - ["ContextMenu",this,ev,math,force] // call this function again - ); + if (MENU.loadingDomain) {return EVENT.False(event)} + load = LOCALE.loadDomain("MathMenu"); + if (!load) { + MENU.jax = jax; + var source = MENU.menu.Find("Show Math As").menu; + source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle; + source.items[0].hidden = (jax.inputJax === "Error"); // hide MathML choice for error messages + var MathPlayer = MENU.menu.Find("Math Settings","MathPlayer"); + MathPlayer.hidden = !(jax.outputJax === "NativeMML" && HUB.Browser.hasMathPlayer); + return MENU.menu.Post(event); + } + MENU.loadingDomain = true; + fn = function () {delete MENU.loadingDomain}; + } else { + if (AJAX.loadingMathMenu) {return EVENT.False(event)} + AJAX.loadingMathMenu = true; + load = AJAX.Require("[MathJax]/extensions/MathMenu.js"); + fn = function () { + delete AJAX.loadingMathMenu; + if (!MathJax.Menu) {MathJax.Menu = {}} } - return EVENT.False(event); } + var ev = { + pageX:event.pageX, pageY:event.pageY, + clientX:event.clientX, clientY:event.clientY + }; + CALLBACK.Queue( + load, fn, // load the file and delete the marker when done + ["ContextMenu",EVENT,ev,math,force] // call this function again + ); + return EVENT.False(event); }, // @@ -530,4 +543,5 @@ ["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"] ); -})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,MathJax.OutputJax,MathJax.InputJax); +})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback, + MathJax.Localization,MathJax.OutputJax,MathJax.InputJax); diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js index f83d5a11a..d619ee3ee 100644 --- a/unpacked/extensions/MathMenu.js +++ b/unpacked/extensions/MathMenu.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/MathMenu.js @@ -26,7 +27,7 @@ */ (function (HUB,HTML,AJAX,CALLBACK,OUTPUT) { - var VERSION = "2.1"; + var VERSION = "2.1.1"; var SIGNAL = MathJax.Callback.Signal("menu") // signal for menu events @@ -38,7 +39,7 @@ var _ = function (id) { return MathJax.Localization._.apply( MathJax.Localization, - [ ["Menu", id] ].concat([].slice.call(arguments,1)) + [["MathMenu",id]].concat([].slice.call(arguments,1)) ); }; @@ -184,7 +185,6 @@ */ Post: function (event,parent) { if (!event) {event = window.event}; - var title = (!this.title ? null : [["div",{className: "MathJax_MenuTitle"},[this.title]]]); var div = document.getElementById("MathJax_MenuFrame"); if (!div) { div = MENU.Background(this); @@ -196,7 +196,8 @@ onmouseup: MENU.Mouseup, ondblclick: FALSE, ondragstart: FALSE, onselectstart: FALSE, oncontextmenu: FALSE, menuItem: this, className: "MathJax_Menu" - },title); + }); + MathJax.Localization.setCSS(menu); for (var i = 0, m = this.items.length; i < m; i++) {this.items[i].Create(menu)} if (MENU.isMobile) { @@ -260,16 +261,17 @@ }, /* - * Find a named item in a menu (or submenu). - * A list of names means descend into submenus. + * Find an item in a menu (or submenu) by name (Find) or ID (FindID). + * A list of names or IDs means descend into submenus. */ - Find: function (name) { - var names = [].slice.call(arguments,1); + Find: function (name) {return this.FindN(1,name,[].slice.call(arguments,1))}, + FindId: function (name) {return this.FindN(0,name,[].slice.call(arguments,1))}, + FindN: function (n,name,names) { for (var i = 0, m = this.items.length; i < m; i++) { - if (this.items[i].name === name) { + if (this.items[i].name[n] === name) { if (names.length) { if (!this.items[i].menu) {return null} - return this.items[i].menu.Find.apply(this.items[i].menu,names); + return this.items[i].menu.FindN(n,names[0],names.slice(1)); } return this.items[i]; } @@ -280,9 +282,11 @@ /* * Find the index of a menu item (so we can insert before or after it) */ - IndexOf: function (name) { + IndexOf: function (name) {return this.IndexOfN(1,name)}, + IndexOfId: function (name) {return this.IndexOfN(0,name)}, + IndexOfN: function (n,name) { for (var i = 0, m = this.items.length; i < m; i++) - {if (this.items[i].name === name) {return i}} + {if (this.items[i].name[n] === name) {return i}} return null; } @@ -370,7 +374,7 @@ * The menu item root subclass */ var ITEM = MENU.ITEM = MathJax.Object.Subclass({ - name: "", // the menu item's label + name: "", // the menu item's label as [id,label] pair Create: function (menu) { if (!this.hidden) { @@ -385,6 +389,7 @@ HTML.addElement(menu,"div",def,this.Label(def,menu)); } }, + Name: function () {return _(this.name[0],this.name[1])}, Mouseover: function (event,menu) { if (!this.disabled) {this.Activate(menu)} @@ -442,11 +447,12 @@ action: function () {}, Init: function (name,action,def) { + if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair this.name = name; this.action = action; this.With(def); }, - Label: function (def,menu) {return [this.name]}, + Label: function (def,menu) {return [this.Name()]}, Mouseup: function (event,menu) { if (!this.disabled) { this.Remove(event,menu); @@ -466,13 +472,14 @@ marker: (isPC && !HUB.Browser.isSafari ? "\u25B6" : "\u25B8"), // the menu arrow Init: function (name,def) { + if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair this.name = name; var i = 1; if (!(def instanceof MENU.ITEM)) {this.With(def), i++} this.menu = MENU.apply(MENU,[].slice.call(arguments,i)); }, Label: function (def,menu) { this.menu.posted = false; - return [this.name+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]]; + return [this.Name()+" ",["span",{className:"MathJax_MenuArrow"},[this.marker]]]; }, Timer: function (event,menu) { if (this.timer) {clearTimeout(this.timer)} @@ -515,13 +522,14 @@ marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark Init: function (name,variable,def) { + if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair this.name = name; this.variable = variable; this.With(def); - if (this.value == null) {this.value = this.name} + if (this.value == null) {this.value = this.name[0]} }, Label: function (def,menu) { var span = {className:"MathJax_MenuRadioCheck"}; if (CONFIG.settings[this.variable] !== this.value) {span = {style:{display:"none"}}} - return [["span",span,[this.marker]]," "+this.name]; + return [["span",span,[this.marker]]," "+this.Name()]; }, Mouseup: function (event,menu) { if (!this.disabled) { @@ -551,12 +559,13 @@ marker: "\u2713", // the checkmark Init: function (name,variable,def) { + if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair this.name = name; this.variable = variable; this.With(def); }, Label: function (def,menu) { var span = {className:"MathJax_MenuCheck"}; if (!CONFIG.settings[this.variable]) {span = {style:{display:"none"}}} - return [["span",span,[this.marker]]," "+this.name]; + return [["span",span,[this.marker]]," "+this.Name()]; }, Mouseup: function (event,menu) { if (!this.disabled) { @@ -576,11 +585,14 @@ * A menu item that is a label */ MENU.ITEM.LABEL = MENU.ITEM.Subclass({ - Init: function (name,def) {this.name = name; this.With(def)}, + Init: function (name,def) { + if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair + this.name = name; this.With(def); + }, Label: function (def,menu) { delete def.onmouseover, delete def.onmouseout; delete def.onmousedown; def.className += " MathJax_MenuLabel"; - return [this.name]; + return [this.Name()]; } }); @@ -604,36 +616,33 @@ */ // Localization: need to be reorganized. currently, there are concatenation // of HTMLCSS.fontInUse and English strings based on the values of - // HTMLCSS.webFonts and HTMLCSS.imgFonts, HTMLCSS.allowWebFonts etc Update - // MENU.About.GetJax too. + // HTMLCSS.webFonts and HTMLCSS.imgFonts, HTMLCSS.allowWebFonts etc MENU.About = function () { - var HTMLCSS = OUTPUT["HTML-CSS"] || {fontInUse: ""}; - var local = (HTMLCSS.webFonts ? "" : "local "), web = (HTMLCSS.webFonts ? " web" : ""); - var font = (HTMLCSS.imgFonts ? "Image" : local+HTMLCSS.fontInUse+web) + " fonts"; - if (font === "local fonts" && OUTPUT.SVG) {font = "web SVG fonts"} + var HTMLCSS = OUTPUT["HTML-CSS"] || {}; + var font = + (HTMLCSS.imgFonts ? "image" : + (HTMLCSS.fontInUse ? + (HTMLCSS.webFonts ? "web" : "local")+" "+HTMLCSS.fontInUse : + (OUTPUT.SVG ? "web SVG" : "generic")) ) + " fonts"; + var format = (!HTMLCSS.webFonts || HTMLCSS.imgFonts ? null : + HTMLCSS.allowWebFonts.replace(/otf/,"woff or otf") + " fonts"); var jax = ["MathJax.js v"+MathJax.fileversion,["br"]]; jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); - MENU.About.GetJax(jax,MathJax.InputJax,"Input Jax"); - MENU.About.GetJax(jax,MathJax.OutputJax,"Output Jax"); - MENU.About.GetJax(jax,MathJax.ElementJax,"Element Jax"); + MENU.About.GetJax(jax,MathJax.InputJax,_("InputJax","Input Jax")); + MENU.About.GetJax(jax,MathJax.OutputJax,_("OutputJax","Output Jax")); + MENU.About.GetJax(jax,MathJax.ElementJax,_("ElementJax","Element Jax")); jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); - MENU.About.GetJax(jax,MathJax.Extension,"Extension",true); + MENU.About.GetJax(jax,MathJax.Extension,_("Extension","Extension"),true); jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[ - HUB.Browser + " v"+HUB.Browser.version + - (HTMLCSS.webFonts && !HTMLCSS.imgFonts ? " \u2014 " + - HTMLCSS.allowWebFonts.replace(/otf/,"woff or otf") + " fonts" : "") + HUB.Browser + " v"+HUB.Browser.version + (format ? + " \u2014 " + _(format.replace(/ /g,""),format) : "") ]]); - // Localization: - // - decide HTML snippet format - // - how do we ensure it is updated when the language is changed? MENU.About.div = MENU.Background(MENU.About); var about = HTML.addElement(MENU.About.div,"div",{ id: "MathJax_About" - }, - _("AboutBox", "%1 using %2", - [["b",{style:{fontSize:"120%"}},["MathJax"]], - " v"+MathJax.version,["br"]], - [font,["br"],["br"], + },[ + ["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"], + _(font.replace(/ /g,""),"using "+font),["br"],["br"], ["span",{style:{ display:"inline-block", "text-align":"left", "font-size":"80%", "max-height":"20em", overflow:"auto", @@ -644,8 +653,9 @@ src: CONFIG.closeImg, style: {width:"21px", height:"21px", position:"absolute", top:".2em", right:".2em"}, onclick: MENU.About.Remove - }]]) - ); + }] + ]); + MathJax.Localization.setCSS(about); var doc = (document.documentElement||{}); var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; if (MENU.prototype.msieAboutBug) { @@ -709,7 +719,7 @@ } } else { if (MENU.jax.originalText == null) { - alert(_("NoOriginalForm", "No original form available")); + alert(_("NoOriginalForm","No original form available")); return; } MENU.ShowSource.Text(MENU.jax.originalText,event); @@ -727,12 +737,12 @@ var w = MENU.ShowSource.Window(event); delete MENU.ShowSource.w; text = text.replace(/^\s*/,"").replace(/\s*$/,""); text = text.replace(/&/g,"&").replace(//g,">"); - var title = _("EqSource", "MathJax Equation Source"); + var title = _("EqSource","MathJax Equation Source"); if (MENU.isMobile) { w.document.open(); w.document.write(""+title+""); w.document.write("
"+text+"
"); - w.document.write("
"); + w.document.write("
"); w.document.write(""); w.document.close(); } else { @@ -774,7 +784,7 @@ MENU.cookie.scale = scale; MENU.saveCookie(); HUB.Reprocess(); } - } else {alert(_("NonZeroScale", "The scale should not be zero"))} + } else {alert(_("NonZeroScale","The scale should not be zero"))} } else {alert(_("PercentScale", "The scale should be a percentage (e.g., 120%%)"))} } @@ -800,7 +810,8 @@ switch (CONFIG.settings.renderer) { case "NativeMML": if (!CONFIG.settings.warnedMML) { - if (BROWSER.isChrome || (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0"))) {message = MESSAGE.MML.WebKit} + if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit} + else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit} else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}} else {message = MESSAGE.MML[BROWSER]} warned = "warnedMML"; @@ -814,7 +825,7 @@ break; } if (message) { - // Localization: concatenation, new line + message = _(message[0],message[1]); message += "\n\n"; message += _("SwitchAnyway", "Switch the renderer anyway?\n\n" + @@ -831,36 +842,34 @@ }; MENU.Renderer.Messages = { MML: { - // Localization: should be updated when the language is changed - // concatenation - WebKit: _("WebkitNativeMMLWarning", + WebKit: ["WebkitNativeMMLWarning", "Your browser doesn't seem to support MathML natively, " + "so switching to MathML output may cause the mathematics " + - "on the page to become unreadable."), + "on the page to become unreadable."], - MSIE: _("MSIENativeMMLWarning", + MSIE: ["MSIENativeMMLWarning", "Internet Explorer requires the MathPlayer plugin " + - "in order to process MathML output."), + "in order to process MathML output."], - Opera: _("OperaNativeMMLWarning", + Opera: ["OperaNativeMMLWarning", "Opera's support for MathML is limited, so switching to " + - "MathML output may cause some expressions to render poorly."), + "MathML output may cause some expressions to render poorly."], - Safari: _("SafariNativeMMLWarning", + Safari: ["SafariNativeMMLWarning", "Your browser's native MathML does not implement all the features " + - "used by MathJax, so some expressions may not render properly."), + "used by MathJax, so some expressions may not render properly."], - Firefox: _("FirefoxNativeMMLWarning", + Firefox: ["FirefoxNativeMMLWarning", "Your browser's native MathML does not implement all the features " + - "used by MathJax, so some expressions may not render properly.") + "used by MathJax, so some expressions may not render properly."] }, SVG: { - MSIE: _("MSIESVGWarning", + MSIE: ["MSIESVGWarning", "SVG is not implemented in Internet Explorer prior to " + "IE9, or when the browser is emulating IE8 or below. " + "Switching to SVG output will cause the mathemtics to " + - "not display properly.") + "not display properly."] } }; @@ -879,7 +888,7 @@ var discoverable = CONFIG.settings.discoverable, MESSAGE = MENU.MPEvents.Messages; if (!isIE9) { - if (CONFIG.settings.mpMouse && !confirm(MESSAGE.IE8warning)) { + if (CONFIG.settings.mpMouse && !confirm(_.apply(_,MESSAGE.IE8warning))) { delete MENU.cookie.mpContext; delete CONFIG.settings.mpContext; delete MENU.cookie.mpMouse; delete CONFIG.settings.mpMouse; MENU.saveCookie(); @@ -889,23 +898,20 @@ MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse; MENU.saveCookie(); MathJax.Hub.Queue(["Rerender",MathJax.Hub]) - } else if (!discoverable && item.name === "Menu Events" && CONFIG.settings.mpContext) { - alert(MESSAGE.IE9warning); + } else if (!discoverable && item.name[0] === "Menu Events" && CONFIG.settings.mpContext) { + alert(_.apply(_,MESSAGE.IE9warning)); } }; - // Localization: should be updated when the language is changed - // concatenation + MENU.MPEvents.Messages = { - IE8warning: - _("IE8warning", + IE8warning: ["IE8warning", "This will disable the MathJax menu and zoom features, " + "but you can Alt-Click on an expression to obtain the MathJax " + - "menu instead.\n\nReally change the MathPlayer settings?"), + "menu instead.\n\nReally change the MathPlayer settings?"], - IE9warning: - _("IE9warning", + IE9warning: ["IE9warning", "The MathJax contextual menu will be disabled, but you can " + - "Alt-Click on an expression to obtain the MathJax menu instead.") + "Alt-Click on an expression to obtain the MathJax menu instead."] }; /*************************************************************/ @@ -954,27 +960,27 @@ */ // Localization: items used as key, should be refactored. MENU.menu = MENU( - ITEM.SUBMENU("Show Math As", - ITEM.COMMAND("MathML Code", MENU.ShowSource, {nativeTouch: true, format: "MathML"}), - ITEM.COMMAND("Original Form", MENU.ShowSource, {nativeTouch: true}), + ITEM.SUBMENU(["Show","Show Math As"], + ITEM.COMMAND(["MathMLcode","MathML Code"], MENU.ShowSource, {nativeTouch: true, format: "MathML"}), + ITEM.COMMAND(["Original","Original Form"], MENU.ShowSource, {nativeTouch: true}), ITEM.RULE(), - ITEM.CHECKBOX("Show TeX hints in MathML", "texHints") + ITEM.CHECKBOX(["texHints","Show TeX hints in MathML"], "texHints") ), ITEM.RULE(), - ITEM.SUBMENU("Math Settings", - ITEM.SUBMENU("Zoom Trigger", - ITEM.RADIO("Hover", "zoom", {action: MENU.Zoom}), - ITEM.RADIO("Click", "zoom", {action: MENU.Zoom}), - ITEM.RADIO("Double-Click", "zoom", {action: MENU.Zoom}), - ITEM.RADIO("No Zoom", "zoom", {value: "None"}), + ITEM.SUBMENU(["Settings","Math Settings"], + ITEM.SUBMENU(["ZoomTrigger","Zoom Trigger"], + ITEM.RADIO(["Hover","Hover"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["Click","Click"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["DoubleClick","Double-Click"], "zoom", {action: MENU.Zoom}), + ITEM.RADIO(["NoZoom","No Zoom"], "zoom", {value: "None"}), ITEM.RULE(), - ITEM.LABEL("Trigger Requires:"), - ITEM.CHECKBOX((HUB.Browser.isMac ? "Option" : "Alt"), "ALT"), - ITEM.CHECKBOX("Command", "CMD", {hidden: !HUB.Browser.isMac}), - ITEM.CHECKBOX("Control", "CTRL", {hidden: HUB.Browser.isMac}), - ITEM.CHECKBOX("Shift", "Shift") + ITEM.LABEL(["TriggerRequires","Trigger Requires:"]), + ITEM.CHECKBOX((HUB.Browser.isMac ? ["Option","Option"] : ["Alt","Alt"]), "ALT"), + ITEM.CHECKBOX(["Command","Command"], "CMD", {hidden: !HUB.Browser.isMac}), + ITEM.CHECKBOX(["Control","Control"], "CTRL", {hidden: HUB.Browser.isMac}), + ITEM.CHECKBOX(["Shift","Shift"], "Shift") ), - ITEM.SUBMENU("Zoom Factor", + ITEM.SUBMENU(["ZoomFactor","Zoom Factor"], ITEM.RADIO("125%", "zscale"), ITEM.RADIO("133%", "zscale"), ITEM.RADIO("150%", "zscale"), @@ -985,40 +991,39 @@ ITEM.RADIO("400%", "zscale") ), ITEM.RULE(), - ITEM.SUBMENU("Math Renderer", {hidden:!CONFIG.showRenderer}, + ITEM.SUBMENU(["Renderer","Math Renderer"], {hidden:!CONFIG.showRenderer}, ITEM.RADIO("HTML-CSS", "renderer", {action: MENU.Renderer}), ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"}), ITEM.RADIO("SVG", "renderer", {action: MENU.Renderer}) ), - ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || - !CONFIG.showMathPlayer, - disabled:!HUB.Browser.hasMathPlayer}, - ITEM.LABEL("Let MathPlayer Handle:"), - ITEM.CHECKBOX("Menu Events", "mpContext", {action: MENU.MPEvents, hidden:!isIE9}), - ITEM.CHECKBOX("Mouse Events", "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}), - ITEM.CHECKBOX("Mouse and Menu Events", "mpMouse", {action: MENU.MPEvents, hidden:isIE9}) + ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || !CONFIG.showMathPlayer, + disabled:!HUB.Browser.hasMathPlayer}, + ITEM.LABEL(["MPHandles","Let MathPlayer Handle:"]), + ITEM.CHECKBOX(["MenuEvents","Menu Events"], "mpContext", {action: MENU.MPEvents, hidden:!isIE9}), + ITEM.CHECKBOX(["MouseEvents","Mouse Events"], "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}), + ITEM.CHECKBOX(["MenuAndMouse","Mouse and Menu Events"], "mpMouse", {action: MENU.MPEvents, hidden:isIE9}) ), - ITEM.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu}, - ITEM.LABEL("For HTML-CSS:"), - ITEM.RADIO("Auto", "font", {action: MENU.Font}), + ITEM.SUBMENU(["FontPrefs","Font Preference"], {hidden:!CONFIG.showFontMenu}, + ITEM.LABEL(["ForHTMLCSS","For HTML-CSS:"]), + ITEM.RADIO(["Auto","Auto"], "font", {action: MENU.Font}), ITEM.RULE(), - ITEM.RADIO("TeX (local)", "font", {action: MENU.Font}), - ITEM.RADIO("TeX (web)", "font", {action: MENU.Font}), - ITEM.RADIO("TeX (image)", "font", {action: MENU.Font}), + ITEM.RADIO(["TeXLocal","TeX (local)"], "font", {action: MENU.Font}), + ITEM.RADIO(["TeXWeb","TeX (web)"], "font", {action: MENU.Font}), + ITEM.RADIO(["TeXImage","TeX (image)"], "font", {action: MENU.Font}), ITEM.RULE(), - ITEM.RADIO("STIX (local)", "font", {action: MENU.Font}) + ITEM.RADIO(["STIXlocal","STIX (local)"], "font", {action: MENU.Font}) ), - ITEM.SUBMENU("Contextual Menu", {hidden:!CONFIG.showContext}, + ITEM.SUBMENU(["ContextMenu","Contextual Menu"], {hidden:!CONFIG.showContext}, ITEM.RADIO("MathJax", "context"), - ITEM.RADIO("Browser", "context") + ITEM.RADIO(["Browser","Browser"], "context") ), - ITEM.COMMAND("Scale All Math ...",MENU.Scale), - ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:"discover_rule"}), - ITEM.CHECKBOX("Highlight on Hover", "discoverable", {hidden:!CONFIG.showDiscoverable}) + ITEM.COMMAND(["Scale","Scale All Math ..."],MENU.Scale), + ITEM.RULE().With({hidden:!CONFIG.showDiscoverable, name:["","discover_rule"]}), + ITEM.CHECKBOX(["Discoverable","Highlight on Hover"], "discoverable", {hidden:!CONFIG.showDiscoverable}) ), ITEM.RULE(), - ITEM.COMMAND("About MathJax",MENU.About), - ITEM.COMMAND("MathJax Help",MENU.Help) + ITEM.COMMAND(["About","About MathJax"],MENU.About), + ITEM.COMMAND(["Help","MathJax Help"],MENU.Help) ); if (MENU.isMobile) { diff --git a/unpacked/extensions/TeX/AMSmath.js b/unpacked/extensions/TeX/AMSmath.js index 133f35464..c5bc4ce86 100644 --- a/unpacked/extensions/TeX/AMSmath.js +++ b/unpacked/extensions/TeX/AMSmath.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/AMSmath.js @@ -24,7 +25,7 @@ */ MathJax.Extension["TeX/AMSmath"] = { - version: "2.1", + version: "2.1.1", number: 0, // current equation number startNumber: 0, // current starting equation number (for when equation is restarted) @@ -162,15 +163,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (!star) {arg = CONFIG.formatTag(arg)} var global = this.stack.global; global.tagID = tag; if (global.notags) { - TEX.Error(MathJax.Localization._(["TeX", "CommandNotAllowedInEnv"], - "%1 not allowed in %2 environment", - name, global.notags) - ) - } - if (global.tag) { - TEX.Error(MathJax.Localization._(["TeX", "MultipleCommand"], - "Multiple %1", name)) + TEX.Error(["CommandNotAllowedInEnv", + "%1 not allowed in %2 environment", + name,global.notags] + ); } + if (global.tag) {TEX.Error(["MultipleCommand","Multiple %1",name])} global.tag = MML.mtd.apply(MML,this.InternalMath(arg)).With({id:CONFIG.formatID(tag)}); }, HandleNoTag: function (name) { @@ -185,16 +183,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { var global = this.stack.global, label = this.GetArgument(name); if (label === "") return; if (!AMS.refUpdate) { - if (global.label) { - TEX.Error(MathJax.Localization._(["TeX", "MultipleCommand"], - "Multiple %1", name)) - } + if (global.label) {TEX.Error(["MultipleCommand","Multiple %1",name])} global.label = label; - if (AMS.labels[label] || AMS.eqlabels[label]) { - TEX.Error(MathJax.Localization._(["TeX", "MultipleLabel"], - "Label '%1' mutiply defined", - label) - } + if (AMS.labels[label] || AMS.eqlabels[label]) + {TEX.Error(["MultipleLabel","Label '%1' mutiply defined",label])} AMS.eqlabels[label] = "???"; // will be replaced by tag value later } }, @@ -239,8 +231,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { HandleShove: function (name,shove) { var top = this.stack.Top(); if (top.type !== "multline" || top.data.length) { - TEX.Error(MathJax.Localization._(["TeX", "CommandAtTheBeginingOfLine", - "%1 must come at the beginning of the line")) + TEX.Error(["CommandAtTheBeginingOfLine", + "%1 must come at the beginning of the line",name]); } top.data.shove = shove; }, @@ -255,11 +247,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { var frac = MML.mfrac(TEX.Parse('\\strut\\textstyle{'+num+'}',this.stack.env).mml(), TEX.Parse('\\strut\\textstyle{'+den+'}',this.stack.env).mml()); lr = ({l:MML.ALIGN.LEFT, r:MML.ALIGN.RIGHT,"":""})[lr]; - if (lr == null) { - TEX.Error(MathJax.Localization._(["TeX", "IllegalAlign"], - "Illegal alignment specified in %1", - name)) - } + if (lr == null) + {TEX.Error(["IllegalAlign","Illegal alignment specified in %1",name])} if (lr) {frac.numalign = frac.denomalign = lr} this.Push(frac); }, @@ -279,10 +268,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (left || right) {frac = MML.mfenced(frac).With({open: left, close: right})} if (style !== "") { var STYLE = (["D","T","S","SS"])[style]; - if (STYLE == null) { - TEX.Error(MathJax.Localization._(["TeX", "BadMathStyleFor"], - "Bad math style for %1", name) - } + if (STYLE == null) + {TEX.Error(["BadMathStyleFor","Bad math style for %1",name])} frac = MML.mstyle(frac); if (STYLE === "D") {frac.displaystyle = true; frac.scriptlevel = 0} else {frac.displaystyle = false; frac.scriptlevel = style - 1} @@ -334,9 +321,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (!taggable) {valign = this.GetBrackets("\\begin{"+begin.name+"}")} n = this.GetArgument("\\begin{"+begin.name+"}"); if (n.match(/[^0-9]/)) { - TEX.Error(MathJax.Localization._(["TeX", "PositiveIntegerArg"], - "Argument to %1 must me a positive integer"), - "\\begin{"+begin.name+"}") + TEX.Error(["PositiveIntegerArg","Argument to %1 must me a positive integer", + "\\begin{"+begin.name+"}"]); } while (n > 0) {align += "rl"; spacing.push("0em 0em"); n--} spacing = spacing.join(" "); @@ -362,12 +348,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { * Check for bad nesting of equation environments */ checkEqnEnv: function () { - if (this.stack.global.eqnenv) { - TEX.Error( - MathJax.Localization._(["TeX", "ErroneousNestingEq"], - "Erroneous nesting of equation structures") - ) - } + if (this.stack.global.eqnenv) + {TEX.Error(["ErroneousNestingEq","Erroneous nesting of equation structures"])} this.stack.global.eqnenv = true; }, @@ -413,9 +395,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { var c = this.trimSpaces(this.GetArgument(name)); if (c == "") {return null} if (TEXDEF.delimiter[c] == null) { - TEX.Error(MathJax.Localization._(["TeX", - "MissingOrUnrecognizedDelim"], - "Missing or unrecognized delimiter for %1", name)) + TEX.Error(["MissingOrUnrecognizedDelim", + "Missing or unrecognized delimiter for %1",name]); } return this.convertDelimiter(c); }, @@ -479,10 +460,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { }, EndRow: function () { if (this.row.length != 1) { - TEX.Error( - MathJax.Localization._(["TeX", "MultipleRowsOneCol"], - "multline rows must have exactly one column") - ) + TEX.Error(["MultipleRowsOneCol", + "multline rows must have exactly one column"]); } this.table.push(this.row); this.row = []; }, diff --git a/unpacked/extensions/TeX/bbox.js b/unpacked/extensions/TeX/bbox.js index d30026d24..86fdc2018 100644 --- a/unpacked/extensions/TeX/bbox.js +++ b/unpacked/extensions/TeX/bbox.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/bbox.js @@ -45,7 +46,7 @@ */ MathJax.Extension["TeX/bbox"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { @@ -64,39 +65,24 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { var part = parts[i].replace(/^\s+/,'').replace(/\s+$/,''); var match = part.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/); if (match) { + if (def) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",name])} var pad = match[1]+match[3]; - if (def) { - TEX.Error( - MathJax.Localization._( - ["TeX", "MultipleBboxProperty"], - "%1 specified twice in %2", "Padding", name) - ) - } def = {height:"+"+pad, depth:"+"+pad, lspace:pad, width:"+"+(2*match[1])+match[3]}; } else if (part.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)) { - if (background) { - TEX.Error( - MathJax.Localization._( - ["TeX", "MultipleBboxProperty"], - "%1 specified twice in %2", "Background", name) - ) - } + if (background) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",name])} background = part; } else if (part.match(/^[-a-z]+:/i)) { - if (style) { - TEX.Error( - MathJax.Localization._( - ["TeX", "MultipleBboxProperty"], - "%1 specified twice in %2", "Style", name) - ) - } + if (style) + {TEX.Error(["MultipleBBoxProperty","%1 specified twice in %2", "Style",name])} style = part; } else if (part !== "") { TEX.Error( - MathJax.Localization._( - ["TeX", "InvalidBboxProperty"], - "'%1' doesn't look like a color, a padding dimension, or a style", - part); + ["InvalidBBoxProperty", + "'%1' doesn't look like a color, a padding dimension, or a style", + part] + ); } } if (def) {math = MML.mpadded(math).With(def)} diff --git a/unpacked/extensions/TeX/begingroup.js b/unpacked/extensions/TeX/begingroup.js index 11126f7d9..20f1cb4ab 100644 --- a/unpacked/extensions/TeX/begingroup.js +++ b/unpacked/extensions/TeX/begingroup.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/begingroup.js @@ -25,7 +26,7 @@ */ MathJax.Extension["TeX/begingroup"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { @@ -215,12 +216,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (TEX.eqnStack.top > 1) { TEX.eqnStack.Pop(); } else if (TEX.rootStack.top === 1) { - TEX.Error( - MathJax.Localization._( - ["TeX", "ExtraEndMissingBegin"], - "Extra %1 or missing \\begingroup", name - ) - ) + TEX.Error(["ExtraEndMissingBegin","Extra %1 or missing \\begingroup",name]); } else { TEX.eqnStack.Clear(); TEX.rootStack.Pop(); @@ -296,11 +292,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { Global: function (name) { var i = this.i; var cs = this.GetCSname(name); this.i = i; if (cs !== "let" && cs !== "def" && cs !== "newcommand") { - TEX.Error( - MathJax.Localization._( - ["TeX", "GlobalNotFollowedBy"], - "%1 not followed by \\let, \\def, or \\newcommand", name) - ) + TEX.Error(["GlobalNotFollowedBy", + "%1 not followed by \\let, \\def, or \\newcommand",name]); } this.stack.env.isGlobal = true; } diff --git a/unpacked/extensions/TeX/color.js b/unpacked/extensions/TeX/color.js index 696e223ab..7b5bab00c 100644 --- a/unpacked/extensions/TeX/color.js +++ b/unpacked/extensions/TeX/color.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/color.js @@ -30,7 +31,7 @@ // The configuration defaults, augmented by the user settings // MathJax.Extension["TeX/color"] = { - version: "2.1", + version: "2.1.1", config: MathJax.Hub.CombineConfig("TeX.color",{ padding: "5px", @@ -114,12 +115,7 @@ MathJax.Extension["TeX/color"] = { getColor: function (model,def) { if (!model) {model = "named"} var fn = this["get_"+model]; - if (!fn) { - this.TEX.Error( - MathJax.Localization._(["TeX", "UndefinedColorModel"], - "Color model '%1' not defined", model) - ) - } + if (!fn) {this.TEX.Error(["UndefinedColorModel","Color model '%1' not defined",model])} return fn.call(this,def); }, @@ -128,24 +124,14 @@ MathJax.Extension["TeX/color"] = { */ get_rgb: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; - if (rgb.length !== 3) { - this.TEX.Error(MathJax.Localization._(["TeX", "rgbArg1"], - "rgb colors require 3 decimal numbers")) - } + if (rgb.length !== 3) + {this.TEX.Error(["rgbArg1","rgb colors require 3 decimal numbers"])} for (var i = 0; i < 3; i++) { - if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) { - this.TEX.Error( - MathJax.Localization._(["TeX", "InvalidDecimalNumber"], - "Invalid decimal number") - ) - } + if (!rgb[i].match(/^(\d+(\.\d*)?|\.\d+)$/)) + {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} var n = parseFloat(rgb[i]); - if (n < 0 || n > 1) { - this.TEX.Error( - MathJax.Localization._(["TeX", "rgbArg2"], - "rgb values must be between 0 and 1") - ) - } + if (n < 0 || n > 1) + {this.TEX.Error(["rgbArg2","rgb values must be between 0 and 1"])} n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -157,22 +143,14 @@ MathJax.Extension["TeX/color"] = { */ get_RGB: function (rgb) { rgb = rgb.split(/,/); var RGB = "#"; - if (rgb.length !== 3) { - this.TEX.Error(MathJax.Localization._(["TeX", "RGBArg1"], - "RGB colors require 3 numbers")) - } + if (rgb.length !== 3) + {this.TEX.Error(["RGBArg1","RGB colors require 3 numbers"])} for (var i = 0; i < 3; i++) { - if (!rgb[i].match(/^\d+$/)) { - this.TEX.Error(MathJax.Localization._(["TeX", "InvalidNumber"], - "Invalid number")) - } + if (!rgb[i].match(/^\d+$/)) + {this.TEX.Error(["InvalidNumber","Invalid number"])} var n = parseInt(rgb[i]); - if (n > 255) { - this.TEX.Error( - MathJax.Localization._(["TeX", "RGBArg2"], - "RGB values must be between 0 and 255") - ) - } + if (n > 255) + {this.TEX.Error(["RGBArg2","RGB values must be between 0 and 255"])} n = n.toString(16); if (n.length < 2) {n = "0"+n} RGB += n; } @@ -183,18 +161,11 @@ MathJax.Extension["TeX/color"] = { * Get a gray-scale value */ get_gray: function (gray) { - if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) { - this.TEX.Error( - MathJax.Localization._(["TeX", "InvalidDecimalNumber"], - "Invalid decimal number") - ) - } + if (!gray.match(/^(\d+(\.\d*)?|\.\d+)$/)) + {this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])} var n = parseFloat(gray); - if (n < 0 || n > 1) { - this.TEX.Error( - MathJax.Localization._(["TeX", "GrayScalerArg"], - "Grey-scale values must be between 0 and 1")) - } + if (n < 0 || n > 1) + {this.TEX.Error(["GrayScalerArg","Grey-scale values must be between 0 and 1"])} n = Math.floor(n*255).toString(16); if (n.length < 2) {n = "0"+n} return "#"+n+n+n; }, diff --git a/unpacked/extensions/TeX/extpfeil.js b/unpacked/extensions/TeX/extpfeil.js index 717ca75ac..8a047f54e 100644 --- a/unpacked/extensions/TeX/extpfeil.js +++ b/unpacked/extensions/TeX/extpfeil.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/extpfeil.js @@ -24,7 +25,7 @@ */ MathJax.Extension["TeX/extpfeil"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { @@ -73,23 +74,22 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { space = this.GetArgument(name), chr = this.GetArgument(name); if (!cs.match(/^\\([a-z]+|.)$/i)) { - TEX.Error( - MathJax.Localization._(["TeX", "NewextarrowArg1"] - "First argument to %1 must be a control sequence name", name) - ) + TEX.Error(["NewextarrowArg1", + "First argument to %1 must be a control sequence name",name]); } if (!space.match(/^(\d+),(\d+)$/)) { TEX.Error( - MathJax.Localization._(["TeX", "NewextarrowArg2"] - "Second argument to %1 must be two integers separated by a comma", - name) - ) + ["NewextarrowArg2", + "Second argument to %1 must be two integers separated by a comma", + name] + ); } if (!chr.match(/^(\d+|0x[0-9A-F]+)$/i)) { TEX.Error( - MathJax.Localization._(["TeX", "NewextarrowArg3"] - "Third argument to %1 must be a unicode character number", name) - ) + ["NewextarrowArg3", + "Third argument to %1 must be a unicode character number", + name] + ); } cs = cs.substr(1); space = space.split(","); chr = parseInt(chr); TEXDEF.macros[cs] = ['xArrow',chr,parseInt(space[0]),parseInt(space[1])]; diff --git a/unpacked/extensions/TeX/mhchem.js b/unpacked/extensions/TeX/mhchem.js index 02007806e..2e2e1fd42 100644 --- a/unpacked/extensions/TeX/mhchem.js +++ b/unpacked/extensions/TeX/mhchem.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/mhchem.js @@ -25,7 +26,7 @@ */ MathJax.Extension["TeX/mhchem"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { @@ -353,21 +354,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (C === "}") { if (braces) {braces--} else { - TEX.Error( - MathJax.Localization._( - ["TeX", "ExtraCloseMissingOpen"], - "Extra close brace or missing open brace" - ) - ) + TEX.Error(["ExtraCloseMissingOpen","Extra close brace or missing open brace"]) } } } - if (braces) { - TEX.Error(MathJax.Localization._(["TeX", "MissingCloseBrace"], - "Missing close brace")) - }; - TEX.Error(MathJax.Localization._(["TeX", "NoClosingChar"], - "Can't find closing %1", c) + if (braces) {TEX.Error(["MissingCloseBrace","Missing close brace"])} + TEX.Error(["NoClosingChar","Can't find closing %1",c]); } }); diff --git a/unpacked/extensions/TeX/newcommand.js b/unpacked/extensions/TeX/newcommand.js index a0eb655be..420ec19fe 100644 --- a/unpacked/extensions/TeX/newcommand.js +++ b/unpacked/extensions/TeX/newcommand.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/newcommand.js @@ -25,16 +26,11 @@ */ MathJax.Extension["TeX/newcommand"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { - var _ = function (id) { - return MathJax.Localization._.apply(MathJax.Localization, - [ ["TeX", id] ].concat([].slice.call(arguments,1))) - }; - var TEX = MathJax.InputJax.TeX; var TEXDEF = TEX.Definitions; @@ -61,14 +57,14 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { def = this.GetArgument(name); if (cs.charAt(0) === "\\") {cs = cs.substr(1)} if (!cs.match(/^(.|[a-z]+)$/i)) { - TEX.Error(_("IllegalControlSequenceName", - "Illegal control sequence name for %1", name)) + TEX.Error(["IllegalControlSequenceName", + "Illegal control sequence name for %1",name]); } if (n) { n = this.trimSpaces(n); if (!n.match(/^[0-9]+$/)) { - TEX.Error(_("IllegalParamNumber" - "Illegal number of parameters specified in %1", name)) + TEX.Error(["IllegalParamNumber", + "Illegal number of parameters specified in %1",name]); } } this.setDef(cs,['Macro',def,n,opt]); @@ -85,8 +81,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (n) { n = this.trimSpaces(n); if (!n.match(/^[0-9]+$/)) { - TEX.Error(_("IllegalParamNumber" - "Illegal number of parameters specified in %1", name)) + TEX.Error(["IllegalParamNumber", + "Illegal number of parameters specified in %1",name]); } } this.setEnv(env,['BeginEnv','EndEnv',bdef,edef,n]); @@ -145,8 +141,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { GetCSname: function (cmd) { var c = this.GetNext(); if (c !== "\\") { - TEX.Error(_("DoubleBackSlash", - "\\ must be followed by a control sequence")) + TEX.Error(["DoubleBackSlash", + "\\ must be followed by a control sequence"]) } var cs = this.trimSpaces(this.GetArgument(cmd)); return cs.substr(1); @@ -164,13 +160,12 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (i !== this.i) {params[n] = this.string.substr(i,this.i-i)} c = this.string.charAt(++this.i); if (!c.match(/^[1-9]$/)) { - TEX.Error(_("CantUseHash2", - "Illegal use of # in template for %1", cs)) + TEX.Error(["CantUseHash2", + "Illegal use of # in template for %1",cs]); } if (parseInt(c) != ++n) { - TEX.Error(_( - "SequentialParam", - "Parameters for %1 must be numbered sequentially", cs)) + TEX.Error(["SequentialParam", + "Parameters for %1 must be numbered sequentially",cs]); } i = this.i+1; } else if (c === '{') { @@ -179,8 +174,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { } this.i++; } - TEX.Error(_("MissingReplacementString", - "Missing replacement string for definition of %1", cmd)); + TEX.Error(["MissingReplacementString", + "Missing replacement string for definition of %1",cmd]); }, /* @@ -190,10 +185,8 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { if (n) { var args = []; this.GetNext(); if (params[0] && !this.MatchParam(params[0])) { - TEX.Error( - _("MismatchUseDef", - "Use of %1 doesn't match its definition", name)) - ) + TEX.Error(["MismatchUseDef", + "Use of %1 doesn't match its definition",name]); } for (var i = 0; i < n; i++) {args.push(this.GetParameter(name,params[i+1]))} text = this.SubstituteArgs(args,text); @@ -201,10 +194,9 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { this.string = this.AddArgs(text,this.string.slice(this.i)); this.i = 0; if (++this.macroCount > TEX.config.MAXMACROS) { - TEX.Error( - _("MaxMacroSub1", - "MathJax maximum macro substitution count exceeded; is there a recursive macro call?") - ) + TEX.Error(["MaxMacroSub1", + "MathJax maximum macro substitution count exceeded; " + + "is there a recursive macro call?"]); } }, @@ -244,9 +236,7 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { this.i++; j++; hasBraces = 0; } } - TEX.Error( - _("RunawayArgument", "Runaway argument for %1?", name) - ); + TEX.Error(["RunawayArgument","Runaway argument for %1?",name]); }, /* diff --git a/unpacked/extensions/TeX/verb.js b/unpacked/extensions/TeX/verb.js index 2fc756e27..10a07abb4 100644 --- a/unpacked/extensions/TeX/verb.js +++ b/unpacked/extensions/TeX/verb.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/extensions/TeX/verb.js @@ -25,7 +26,7 @@ */ MathJax.Extension["TeX/verb"] = { - version: "2.1" + version: "2.1.1" }; MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { @@ -43,19 +44,10 @@ MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { */ Verb: function (name) { var c = this.GetNext(); var start = ++this.i; - if (c == "" ) { - TEX.Error( - MathJax.Localization._( - ["TeX", "MissingArgFor"], - "Argument manquant pour la commande %1", name)) - } + if (c == "" ) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} while (this.i < this.string.length && this.string.charAt(this.i) != c) {this.i++} - if (this.i == this.string.length) { - TEX.Error( - MathJax.Localization._( - ["TeX", "NoClosinDelim"], - "Can't find closing delimiter for %1", name)) - } + if (this.i == this.string.length) + {TEX.Error(["NoClosingDelim","Can't find closing delimiter for %1", name])} var text = this.string.slice(start,this.i); this.i++; this.Push(MML.mtext(text).With({mathvariant:MML.VARIANT.MONOSPACE})); } diff --git a/unpacked/jax/input/AsciiMath/config.js b/unpacked/jax/input/AsciiMath/config.js index 94f4e473a..5b198432f 100644 --- a/unpacked/jax/input/AsciiMath/config.js +++ b/unpacked/jax/input/AsciiMath/config.js @@ -27,7 +27,7 @@ MathJax.InputJax.AsciiMath = MathJax.InputJax({ id: "AsciiMath", - version: "2.1", + version: "2.1.1", directory: MathJax.InputJax.directory + "/AsciiMath", extensionDir: MathJax.InputJax.extensionDir + "/AsciiMath", diff --git a/unpacked/jax/input/AsciiMath/jax.js b/unpacked/jax/input/AsciiMath/jax.js index eb32db3bc..7748342d3 100644 --- a/unpacked/jax/input/AsciiMath/jax.js +++ b/unpacked/jax/input/AsciiMath/jax.js @@ -1268,7 +1268,7 @@ junk = null; var MML; ASCIIMATH.Augment({ - sourceMenuTitle: "AsciiMath Input", + sourceMenuTitle: /*_(MathMenu)*/ ["AsciiMathInput","AsciiMath Input"], prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing AsciiMath postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing AsciiMath diff --git a/unpacked/jax/input/MathML/config.js b/unpacked/jax/input/MathML/config.js index 77d7e0217..508cfdfb9 100644 --- a/unpacked/jax/input/MathML/config.js +++ b/unpacked/jax/input/MathML/config.js @@ -24,7 +24,7 @@ MathJax.InputJax.MathML = MathJax.InputJax({ id: "MathML", - version: "2.1", + version: "2.1.1", directory: MathJax.InputJax.directory + "/MathML", extensionDir: MathJax.InputJax.extensionDir + "/MathML", entityDir: MathJax.InputJax.directory + "/MathML/entities", diff --git a/unpacked/jax/input/MathML/jax.js b/unpacked/jax/input/MathML/jax.js index 31f3bcf13..dcb3ef2d2 100644 --- a/unpacked/jax/input/MathML/jax.js +++ b/unpacked/jax/input/MathML/jax.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/jax/input/MathML/jax.js @@ -29,8 +30,8 @@ var MML; var _ = function (id) { - return MathJax.Localization._.apply(MathJax.Localization,[ - ["MathML",id] ].concat([].slice.call(arguments,1))) + return MathJax.Localization._.apply(MathJax.Localization, + [["MathML",id]].concat([].slice.call(arguments,1))) }; MATHML.Parse = MathJax.Object.Subclass({ @@ -54,33 +55,23 @@ math = math.replace(/^\s*(?:\/\/)?\s*$/,"$2"); math = math.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); doc = MATHML.ParseXML(math); - if (doc == null) { - MATHML.Error(_("ErrorParsingMathML", "Error parsing MathML")) - } + if (doc == null) {MATHML.Error(["ErrorParsingMathML","Error parsing MathML"])} } var err = doc.getElementsByTagName("parsererror")[0]; - // Localization: This seems to replace error messages produced - // by browsers. Does that work in all languages? - if (err) MATHML.Error("Error parsing MathML: "+err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")); - if (doc.childNodes.length !== 1) { - MATHML.Error( - _("MathMLSingleElement", "MathML must be formed by a single element") - ); - } + if (err) MATHML.Error(["ParsingError","Error parsing MathML: %1", + err.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,"")]); + if (doc.childNodes.length !== 1) + {MATHML.Error(["MathMLSingleElement","MathML must be formed by a single element"])} if (doc.firstChild.nodeName.toLowerCase() === "html") { var h1 = doc.getElementsByTagName("h1")[0]; if (h1 && h1.textContent === "XML parsing error" && h1.nextSibling) - // Localization: This seems to replace error messages produced - // by browsers. Does that work in all languages? - MATHML.Error("Error parsing MathML: "+String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,"")); + MATHML.Error(["ParsingError","Error parsing MathML: %1", + String(h1.nextSibling.nodeValue).replace(/fatal parsing error: /,"")]); } - if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== - "math") { - MATHML.Error( - _("MathMLRootElement", + if (doc.firstChild.nodeName.toLowerCase().replace(/^[a-z]+:/,"") !== "math") { + MATHML.Error(["MathMLRootElement", "MathML must be formed by a element, not %1", - "<"+doc.firstChild.nodeName+">") - ); + "<"+doc.firstChild.nodeName+">"]); } this.mml = this.MakeMML(doc.firstChild); }, @@ -96,10 +87,7 @@ mml = this.TeXAtom(match[2]); } else if (!(MML[type] && MML[type].isa && MML[type].isa(MML.mbase))) { MathJax.Hub.signal.Post(["MathML Jax - unknown node type",type]); - return MML.merror( - MathJax.Localization._( - "UnknownNodeType", "Unknown node type: %1", type) - ); + return MML.merror(_("UnknownNodeType","Unknown node type: %1",type)); } else { mml = MML[type](); } @@ -175,10 +163,8 @@ var text = child.nodeValue.replace(/&([a-z][a-z0-9]*);/ig,this.replaceEntity); mml.Append(MML.chars(this.trimSpace(text))); } else if (child.nodeValue.match(/\S/)) { - MATHML.Error( - _("UnexpectedTextNode", "Unexpected text node: %1", - "'"+child.nodeValue+"'") - ); + MATHML.Error(["UnexpectedTextNode", + "Unexpected text node: %1","'"+child.nodeValue+"'"]); } } else if (mml.type === "annotation-xml") { mml.Append(MML.xml(child)); @@ -223,7 +209,7 @@ /************************************************************************/ MATHML.Augment({ - sourceMenuTitle: "Original MathML", + sourceMenuTitle: /*_(MathMenu)*/ ["OriginalMathML","Original MathML"], prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing MathML postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing MathML @@ -257,6 +243,10 @@ return MML.merror(message); }, Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (message instanceof Array) {message = _.apply(_,message)} throw MathJax.Hub.Insert(Error(message),{mathmlError: true}); }, // @@ -282,12 +272,7 @@ for (var i = 0, m = xml.length; i < m && !this.parser; i++) {try {this.parser = new ActiveXObject(xml[i])} catch (err) {}} if (!this.parser) { - alert("MathJax can't create an XML parser for MathML. Check that\n"+ - "the 'Script ActiveX controls marked safe for scripting' security\n"+ - "setting is enabled (use the Internet Options item in the Tools\n"+ - "menu, and select the Security panel, then press the Custom Level\n"+ - "button to check this).\n\n"+ - "MathML equations will not be able to be processed by MathJax."); + MathJax.Localization.Try(this.parserCreationError); return(this.parseError); } this.parser.async = false; @@ -301,6 +286,15 @@ else {document.body.insertBefore(this.div,document.body.firstChild)} return(this.parseDIV); }, + parserCreationError: function () { + alert(_("MathPlayer", + "MathJax can't create an XML parser for MathML. Check that\n"+ + "the 'Script ActiveX controls marked safe for scripting' security\n"+ + "setting is enabled (use the Internet Options item in the Tools\n"+ + "menu, and select the Security panel, then press the Custom Level\n"+ + "button to check this).\n\n"+ + "MathML equations will not be able to be processed by MathJax.")); + }, // // Initialize the parser object (whichever type is used) // diff --git a/unpacked/jax/input/TeX/config.js b/unpacked/jax/input/TeX/config.js index 4850a6a53..774511b8e 100644 --- a/unpacked/jax/input/TeX/config.js +++ b/unpacked/jax/input/TeX/config.js @@ -24,7 +24,7 @@ MathJax.InputJax.TeX = MathJax.InputJax({ id: "TeX", - version: "2.1", + version: "2.1.1", directory: MathJax.InputJax.directory + "/TeX", extensionDir: MathJax.InputJax.extensionDir + "/TeX", diff --git a/unpacked/jax/input/TeX/jax.js b/unpacked/jax/input/TeX/jax.js index c31c4947f..642a643cd 100644 --- a/unpacked/jax/input/TeX/jax.js +++ b/unpacked/jax/input/TeX/jax.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/jax/input/TeX/jax.js @@ -30,7 +31,7 @@ var _ = function (id) { return MathJax.Localization._.apply(MathJax.Localization, - [ ["TeX", id] ].concat([].slice.call(arguments,1))) + [["TeX", id]].concat([].slice.call(arguments,1))); }; var STACK = MathJax.Object.Subclass({ @@ -79,14 +80,8 @@ var STACKITEM = STACK.Item = MathJax.Object.Subclass({ type: "base", - // Localization: should be updated when the language is changed - // This is used in TEX.Error(this[item.type+"Error"]) below, perhaps a if - // could just be used directly, or make the messageID contains close/right - // Add a note about the \\ syntax. - closeError: _("ExtraCloseMissingOpen", - "Extra close brace or missing open brace"), - rightError: _("MissingLeftExtraRight", - "Missing \\left or extra \\right"), + closeError: ["ExtraCloseMissingOpen","Extra close brace or missing open brace"], + rightError: ["MissingLeftExtraRight","Missing \\left or extra \\right"], Init: function () { if (this.isOpen) {this.env = {}} this.data = []; @@ -103,7 +98,7 @@ if (item.type === "over" && this.isOpen) {item.num = this.mmlData(false); this.data = []} if (item.type === "cell" && this.isOpen) { if (item.linebreak) {return false} - TEX.Error(_("Misplaced %1", "Misplaced ", item.name)); + TEX.Error(["Misplaced %1","Misplaced ",item.name]); } if (item.isClose && this[item.type+"Error"]) {TEX.Error(this[item.type+"Error"])} if (!item.isNotStack) {return true} @@ -134,12 +129,10 @@ STACKITEM.open = STACKITEM.Subclass({ type: "open", isOpen: true, - // Localization: should be updated when the language is changed - stopError: _("ExtraOpenMissingClose", - "Extra open brace or missing close brace"), + stopError: ["ExtraOpenMissingClose","Extra open brace or missing close brace"], checkItem: function (item) { if (item.type === "close") { - var mml = this.mmlData(); // this.mmlData(true,true); // force row + var mml = this.mmlData(); return STACKITEM.mml(MML.TeXAtom(mml)); // TeXAtom make it an ORD to prevent spacing (FIXME: should be another way) } return this.SUPER(arguments).checkItem.call(this,item); @@ -162,9 +155,7 @@ STACKITEM.subsup = STACKITEM.Subclass({ type: "subsup", - // Localization: should be updated when the language is changed - stopError: _("MissingScript", - "Missing superscript or subscript argument"), + stopError: ["MissingScript","Missing superscript or subscript argument"], checkItem: function (item) { var script = ["","subscript","superscript"][this.position]; if (item.type === "open" || item.type === "left") {return true} @@ -176,10 +167,8 @@ this.data[0].SetData(this.position,item.data[0]); return STACKITEM.mml(this.data[0]); } - if (this.SUPER(arguments).checkItem.call(this,item)) { - TEX.Error(_("MissingOpenForScript", - "Missing open brace for %1", script)) - } + if (this.SUPER(arguments).checkItem.call(this,item)) + {TEX.Error(["MissingOpenForScript","Missing open brace for %1",script])} }, Pop: function () {} }); @@ -187,9 +176,8 @@ STACKITEM.over = STACKITEM.Subclass({ type: "over", isClose: true, name: "\\over", checkItem: function (item,stack) { - if (item.type === "over") { - TEX.Error(_("AmbiguousUseOf", "Ambiguous use of %1", item.name)) - } + if (item.type === "over") + {TEX.Error(["AmbiguousUseOf","Ambiguous use of %1",item.name])} if (item.isClose) { var mml = MML.mfrac(this.num,this.mmlData(false)); if (this.thickness != null) {mml.linethickness = this.thickness} @@ -207,9 +195,7 @@ STACKITEM.left = STACKITEM.Subclass({ type: "left", isOpen: true, delim: '(', - // Localization: should be updated when the language is changed - // Add a note about the \\ syntax. - stopError: _("ExtraLeftMissingRight", "Extra \\left or missing \\right"), + stopError: ["ExtraLeftMissingRight", "Extra \\left or missing \\right"], checkItem: function (item) { if (item.type === "right") { var mml = MML.mfenced(this.data.length === 1 ? this.data[0] : MML.mrow.apply(MML,this.data)); @@ -227,17 +213,13 @@ type: "begin", isOpen: true, checkItem: function (item) { if (item.type === "end") { - if (item.name !== this.name) { - TEX.Error(_("EnvBadEnd", - "\\begin{%1} ended with \\end{%2}", - this.name, item.name)) - } + if (item.name !== this.name) + {TEX.Error(["EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.name,item.name])} if (!this.end) {return STACKITEM.mml(this.mmlData())} return this.parse[this.end].call(this.parse,this,this.data); } - if (item.type === "stop") { - TEX.Error(_("EnvMissingEnd", "Missing \\end{%1}", this.name)) - } + if (item.type === "stop") + {TEX.Error(["EnvMissingEnd","Missing \\end{%1}",this.name])} return this.SUPER(arguments).checkItem.call(this,item); } }); @@ -258,9 +240,7 @@ STACKITEM.position = STACKITEM.Subclass({ type: "position", checkItem: function (item) { - if (item.isClose) { - TEX.Error(_("MissingBoxFor", "Missing box for %1")) - } + if (item.isClose) {TEX.Error(["MissingBoxFor","Missing box for %1"])} if (item.isNotStack) { var mml = item.mmlData(); switch (this.move) { @@ -302,7 +282,7 @@ mml = STACKITEM.mml(mml); if (this.requireClose) { if (item.type === 'close') {return mml} - TEX.Error(_("MissingCloseBrace", "Missing close brace")); + TEX.Error(["MissingCloseBrace","Missing close brace"]); } return [mml,item]; } @@ -1146,8 +1126,7 @@ // (overridden in noUndefined extension) // csUndefined: function (name) { - TEX.Error(_("UndefinedControlSequence", - "Undefined control sequence %1", name)); + TEX.Error(["UndefinedControlSequence","Undefined control sequence %1",name]); }, /* @@ -1192,10 +1171,8 @@ else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} if (base.type === "msubsup") { - if (base.data[base.sup]) { - TEX.Error(_("DoubleExponent", - "Double exponent: use braces to clarify")) - } + if (base.data[base.sup]) + {TEX.Error(["DoubleExponent","Double exponent: use braces to clarify"])} position = base.sup; } else if (base.movesupsub) { if (base.type !== "munderover" || base.data[base.over]) { @@ -1217,10 +1194,8 @@ else {base = this.stack.Prev(); if (!base) {base = MML.mi("")}} if (base.isEmbellishedWrapper) {base = base.data[0].data[0]} if (base.type === "msubsup") { - if (base.data[base.sub]) { - TEX.Error(_("DoubleSubscripts", - "Double subscripts: use braces to clarify")) - } + if (base.data[base.sub]) + {TEX.Error(["DoubleSubscripts","Double subscripts: use braces to clarify"])} position = base.sub; } else if (base.movesupsub) { if (base.type !== "munderover" || base.data[base.under]) { @@ -1238,8 +1213,8 @@ Prime: function (c) { var base = this.stack.Prev(); if (!base) {base = MML.mi()} if (base.type === "msubsup" && base.data[base.sup]) { - TEX.Error(_("DoubleExponentPrime", - "Prime causes double exponent: use braces to clarify")) + TEX.Error(["DoubleExponentPrime", + "Prime causes double exponent: use braces to clarify"]); } var sup = ""; this.i--; do {sup += this.PRIME; this.i++, c = this.GetNext()} @@ -1267,8 +1242,8 @@ * Handle hash marks outside of definitions */ Hash: function (c) { - TEX.Error(_("CantUseHash1", - "You can't use 'macro parameter character #' in math mode")); + TEX.Error(["CantUseHash1", + "You can't use 'macro parameter character #' in math mode"]); }, /* @@ -1321,9 +1296,8 @@ Middle: function (name) { var delim = this.GetDelimiter(name); - if (this.stack.Top().type !== "left") { - TEX.Error(_("MisplacedMiddle", - "%1 must be within \\left and \\right", name))} + if (this.stack.Top().type !== "left") + {TEX.Error(["MisplacedMiddle","%1 must be within \\left and \\right",name])} this.Push(MML.mo(delim).With({stretchy:true})); }, @@ -1346,10 +1320,8 @@ }, Limits: function (name,limits) { var op = this.stack.Prev("nopop"); - if (!op || op.texClass !== MML.TEXCLASS.OP) { - TEX.Error(_("MisplacedLimits", - "%1 is allowed only on operators", name)) - } + if (!op || op.texClass !== MML.TEXCLASS.OP) + {TEX.Error(["MisplacedLimits","%1 is allowed only on operators",name])} op.movesupsub = (limits ? true : false); op.movablelimits = false; }, @@ -1398,18 +1370,13 @@ return n; }, MoveRoot: function (name,id) { - if (!this.stack.env.inRoot) { - TEX.Error(_("BadMoveRoot", "%1 can appear only within a root")); - } - if (this.stack.global[id]) { - TEX.Error(_("MultipleMoveRoot", - "Multiple use of %1", name)); - } + if (!this.stack.env.inRoot) + {TEX.Error(["BadMoveRoot","%1 can appear only within a root"])} + if (this.stack.global[id]) + {TEX.Error(["MultipleMoveRoot","Multiple use of %1",name])} var n = this.GetArgument(name); - if (!n.match(/-?[0-9]+/)) { - TEX.Error(_("IntegerArg", - "The argument to %1 must be an integer", name)); - } + if (!n.match(/-?[0-9]+/)) + {TEX.Error(["IntegerArg","The argument to %1 must be an integer",name])} n = (n/15)+"em"; if (n.substr(0,1) !== "-") {n = "+"+n} this.stack.global[id] = n; @@ -1464,20 +1431,17 @@ attr = this.GetBrackets(name,"").replace(/^\s+/,""), data = this.GetArgument(name), def = {attrNames:[]}, match; - if (!MML[type] || !MML[type].prototype.isToken) { - TEX.Error(_("NotMathMLToken", "%1 is not a token element", type)) - } + if (!MML[type] || !MML[type].prototype.isToken) + {TEX.Error(["NotMathMLToken", "%1 is not a token element",type])} while (attr !== "") { - match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ]*)\s*/i); - if (!match) { - TEX.Error("InvalidMathMLAttr", - "Invalid MathML attribute: %1", attr) - } + match = attr.match(/^([a-z]+)\s*=\s*('[^']*'|\"[^"]*"|[^ ]*)\s*/i); + if (!match) + {TEX.Error("InvalidMathMLAttr","Invalid MathML attribute: %1",attr)} if (!MML[type].prototype.defaults[match[1]] && !this.MmlTokenAllow[match[1]]) { - TEX.Error(_("UnknownAttrForElement", - "%1 is not a recognized attribute for %2", - match[1], type)) + TEX.Error(["UnknownAttrForElement", + "%1 is not a recognized attribute for %2", + match[1],type]); } def[match[1]] = match[2].replace(/^(['"])(.*)\1$/,"$2"); def.attrNames.push(match[1]); @@ -1625,16 +1589,16 @@ this.string = this.AddArgs(macro,this.string.slice(this.i)); this.i = 0; if (++this.macroCount > TEX.config.MAXMACROS) { - TEX.Error(_("MaxMacroSub", - "MathJax maximum macro substitution count exceeded; is there a recursive macro call?")) + TEX.Error(["MaxMacroSub", + "MathJax maximum macro substitution count exceeded; " + + "is there a recursive macro call?"]); } }, Matrix: function (name,open,close,align,spacing,vspacing,style,cases) { var c = this.GetNext(); - if (c === "") { - TEX.Error(_("MissingArgFor", "Missing argument for %1", name)) - } + if (c === "") + {TEX.Error(["MissingArgFor","Missing argument for %1",name])} if (c === "{") {this.i++} else {this.string = c+"}"+this.string.slice(this.i+1); this.i = 0} var array = STACKITEM.array().With({ requireClose: true, @@ -1660,8 +1624,7 @@ if (c === "{") {braces++; i++} else if (c === "}") {if (braces === 0) {m = 0} else {braces--; i++}} else if (c === "&" && braces === 0) { - TEX.Error(_("ExtraAlignTab", - "Extra alignment tab in \\cases text")) + TEX.Error(["ExtraAlignTab","Extra alignment tab in \\cases text"]); } else if (c === "\\") { if (string.substr(i).match(/^((\\cr)[^a-zA-Z]|\\\\)/)) {m = 0} else {i += 2} } else {i++} @@ -1684,8 +1647,8 @@ n = this.GetBrackets(name,"").replace(/ /g,""); if (n && !n.match(/^((-?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|mm|cm|in|pc))$/)) { - TEX.Error(_("BracketMustBeDimension", - "Bracket argument to %1 must be a dimension", name)) + TEX.Error(["BracketMustBeDimension", + "Bracket argument to %1 must be a dimension",name]); } } this.Push(STACKITEM.cell().With({isCR: true, name: name, linebreak: true})); @@ -1725,9 +1688,8 @@ HLine: function (name,style) { if (style == null) {style = "solid"} var top = this.stack.Top(); - if (!top.isa(STACKITEM.array) || top.data.length) { - TEX.Error(_("Misplaced", "Misplaced %1", name)) - } + if (!top.isa(STACKITEM.array) || top.data.length) + {TEX.Error(["Misplaced","Misplaced %1",name])} if (top.table.length == 0) { top.frame.push("top"); } else { @@ -1745,18 +1707,15 @@ Begin: function (name) { var env = this.GetArgument(name); - if (env.match(/[^a-z*]/i)) { - TEX.Error(_("InvalidEnv", - "Invalid environment name '%1'", env)) - } + if (env.match(/[^a-z*]/i)) + {TEX.Error(["InvalidEnv","Invalid environment name '%1'",env])} var cmd = this.envFindName(env); - if (!cmd) { - TEX.Error(_("UnknownEnv", - "Unknown environment '%1'", env)) - } + if (!cmd) + {TEX.Error(["UnknownEnv","Unknown environment '%1'",env])} if (++this.macroCount > TEX.config.MAXMACROS) { - TEX.Error(_("MaxMacroSub2", - "MathJax maximum substitution count exceeded; is there a recursive latex environment?")) + TEX.Error(["MaxMacroSub2", + "MathJax maximum substitution count exceeded; " + + "is there a recursive latex environment?"]); } if (!(cmd instanceof Array)) {cmd = [cmd]} var mml = STACKITEM.begin().With({name: env, end: cmd[1], parse:this}); @@ -1867,14 +1826,12 @@ GetArgument: function (name,noneOK) { switch (this.GetNext()) { case "": - if (!noneOK) { - TEX.Error(_("MissingArgFor", "Missing argument for %1", name)) - } + if (!noneOK) {TEX.Error(["MissingArgFor","Missing argument for %1",name])} return null; case '}': if (!noneOK) { - TEX.Error(_("ExtraCloseMissingOpen", - "Extra close brace or missing open brace")) + TEX.Error(["ExtraCloseMissingOpen", + "Extra close brace or missing open brace"]); } return null; case '\\': @@ -1886,14 +1843,12 @@ case '\\': this.i++; break; case '{': parens++; break; case '}': - if (parens == 0) { - TEX.Error(_("ExtraClose", "Extra close brace")) - } + if (parens == 0) {TEX.Error(["ExtraClose","Extra close brace"])} if (--parens == 0) {return this.string.slice(j,this.i-1)} break; } } - TEX.Error(_("MissingCloseBrace", "Missing close brace")); + TEX.Error(["MissingCloseBrace","Missing close brace"]); break; } return this.string.charAt(this.i++); @@ -1911,8 +1866,8 @@ case '\\': this.i++; break; case '}': if (parens-- <= 0) { - TEX.Error(_("ExtraCloseInBrackets", - "Extra close brace while looking for ']'")) + TEX.Error(["ExtraCloseBrace", + "Extra close brace while looking for %1","']'"]); } break; case ']': @@ -1920,9 +1875,8 @@ break; } } - TEX.Error( - _("MissingCloseBracket", - "Couldn't find closing ']' for argument to %1", name)); + TEX.Error(["MissingCloseBracket", + "Couldn't find closing ']' for argument to %1",name]); }, /* @@ -1935,8 +1889,8 @@ this.i++; if (c == "\\") {c += this.GetCS(name)} if (TEXDEF.delimiter[c] != null) {return this.convertDelimiter(c)} } - TEX.Error(_("MissingOrUnrecognizedDelim", - "Missing or unrecognized delimiter for %1", name)); + TEX.Error(["MissingOrUnrecognizedDelim", + "Missing or unrecognized delimiter for %1",name]); }, /* @@ -1957,8 +1911,8 @@ return match[1].replace(/ /g,""); } } - TEX.Error(_("MissingDimOrUnits", - "Missing dimension or its units for %1", name)); + TEX.Error(["MissingDimOrUnits", + "Missing dimension or its units for %1",name]); }, /* @@ -1974,16 +1928,16 @@ case '{': parens++; break; case '}': if (parens == 0) { - TEX.Error(_("ExtraCloseBraceInUpTo", - "Extra close brace while looking for %1", token)) + TEX.Error(["ExtraCloseBrace", + "Extra close brace while looking for %1",token]) } parens--; break; } if (parens == 0 && c == token) {return this.string.slice(j,k)} } - TEX.Error(_("TokenNotFoundForCommand", - "Couldn't find %1 for %2", token, name)); + TEX.Error(["TokenNotFoundForCommand", + "Couldn't find %1 for %2",token,name]); }, /* @@ -2032,9 +1986,8 @@ } } } - if (match !== '') { - TEX.Error(_("MathNotTerminated", "Math not terminated in text box")) - } + if (match !== '') + {TEX.Error(["MathNotTerminated","Math not terminated in text box"])} if (k < text.length) {mml.push(this.InternalText(text.slice(k),def))} return mml; }, @@ -2055,8 +2008,8 @@ c = string.charAt(i++); if (c === '#') {text += c} else { if (!c.match(/[1-9]/) || c > args.length) { - TEX.Error(_("IllegalMacroParam", - "Illegal macro parameter reference")) + TEX.Error(["IllegalMacroParam", + "Illegal macro parameter reference"]); } newstring = this.AddArgs(this.AddArgs(newstring,text),args[c-1]); text = ''; @@ -2073,8 +2026,8 @@ AddArgs: function (s1,s2) { if (s2.match(/^[a-z]/i) && s1.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)) {s1 += ' '} if (s1.length + s2.length > TEX.config.MAXBUFFER) { - TEX.Error(_("MaxBufferSize", - "MathJax internal buffer size exceeded; is there a recursive macro call?")) + TEX.Error(["MaxBufferSize", + "MathJax internal buffer size exceeded; is there a recursive macro call?"]); } return s1+s2; } @@ -2091,7 +2044,7 @@ MAXBUFFER: 5*1024 // maximum size of TeX string to process }, - sourceMenuTitle: "TeX Commands", + sourceMenuTitle: /*_(MathMenu)*/ ["TeXCommands","TeX Commands"], prefilterHooks: MathJax.Callback.Hooks(true), // hooks to run before processing TeX postfilterHooks: MathJax.Callback.Hooks(true), // hooks to run after processing TeX @@ -2147,6 +2100,10 @@ // Produce an error and stop processing this equation // Error: function (message) { + // + // Translate message if it is ["id","message",args] + // + if (message instanceof Array) {message = _.apply(_,message)} throw HUB.Insert(Error(message),{texError: true}); }, diff --git a/unpacked/jax/output/HTML-CSS/autoload/mglyph.js b/unpacked/jax/output/HTML-CSS/autoload/mglyph.js index 9c6837f01..ea5e16b7f 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/mglyph.js +++ b/unpacked/jax/output/HTML-CSS/autoload/mglyph.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/jax/output/HTML-CSS/autoload/mglyph.js @@ -24,9 +25,10 @@ */ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { - var VERSION = "2.1"; + var VERSION = "2.1.1"; var MML = MathJax.ElementJax.mml, - HTMLCSS = MathJax.OutputJax["HTML-CSS"]; + HTMLCSS = MathJax.OutputJax["HTML-CSS"], + LOCALE = MathJax.Localization; MML.mglyph.Augment({ toHTML: function (span,variant) { @@ -41,11 +43,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { if (HTMLCSS.Font.testFont(font)) { this.HTMLhandleVariant(span,variant,String.fromCharCode(index)); } else { - if (values.alt === "") { - values.alt = - MathJax.Localization._(["MathML", "BadMglyphFont"], - "Bad font: %1", font.family); - } + if (values.alt === "") + {values.alt = LOCALE._(["MathML","BadMglyphFont"],"Bad font: %1",font.family)} err = MML.merror(values.alt).With({mathsize:"75%"}); this.Append(err); err.toHTML(span); this.data.pop(); span.bbox = err.HTMLspanElement().bbox; @@ -64,8 +63,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { } if (this.img.status !== "OK") { err = MML.merror( - MathJax.Localization._(["MathML", "BadMglyph"], - "Bad mglyph: %1", values.src) + LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src) ).With({mathsize:"75%"}); this.Append(err); err.toHTML(span); this.data.pop(); span.bbox = err.HTMLspanElement().bbox; diff --git a/unpacked/jax/output/HTML-CSS/config.js b/unpacked/jax/output/HTML-CSS/config.js index a142f3a23..523d2d17d 100644 --- a/unpacked/jax/output/HTML-CSS/config.js +++ b/unpacked/jax/output/HTML-CSS/config.js @@ -26,7 +26,7 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({ id: "HTML-CSS", - version: "2.1", + version: "2.1.1", directory: MathJax.OutputJax.directory + "/HTML-CSS", extensionDir: MathJax.OutputJax.extensionDir + "/HTML-CSS", autoloadDir: MathJax.OutputJax.directory + "/HTML-CSS/autoload", @@ -147,10 +147,8 @@ MathJax.Hub.Register.StartupHook("End Config",[function (HUB,HTMLCSS) { !HUB.Browser.versionAtLeast(CONFIG.minBrowserVersion[HUB.Browser]||0.0)) { HTMLCSS.Translate = CONFIG.minBrowserTranslate; HUB.Config({showProcessingMessages: false}); - MathJax.Message.Set( - MathJax.Localization._(["Message", "MathJaxNotSupported"], - "Your browser does not support MathJax"), - null,4000); + MathJax.Message.Set(["MathJaxNotSupported", + "Your browser does not support MathJax"],null,4000); HUB.Startup.signal.Post("MathJax not supported"); } diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index eae80fae3..3739619fe 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -28,6 +28,12 @@ (function (AJAX,HUB,HTMLCSS) { var MML, isMobile = HUB.Browser.isMobile; + + var MESSAGE = function () { + var data = [].slice.call(arguments,0); + data[0][0] = ["HTML-CSS",data[0][0]]; + return MathJax.Message.Set.apply(MathJax.Message,data); + }; var FONTTEST = MathJax.Object.Subclass({ timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts @@ -131,12 +137,7 @@ loadWebFont: function (font) { HUB.Startup.signal.Post("HTML-CSS Jax - Web-Font "+HTMLCSS.fontInUse+"/"+font.directory); - var n = MathJax.Message.File( - // Localization: Message.File(fileName) will write "Loading "+fileName - // Here, this will become "Loading Web-Font "+fileName. Does it work - // for all languages (word order might be different)? - "Web-Font "+HTMLCSS.fontInUse+"/"+font.directory - ); + var n = MESSAGE(["LoadWebFont","Loading webfont %1",HTMLCSS.fontInUse+"/"+font.directory]); var done = MathJax.Callback({}); // called when font is loaded var callback = MathJax.Callback(["loadComplete",this,font,n,done]); AJAX.timer.start(AJAX,[this.checkWebFont,font,callback],0,this.timeout); @@ -156,17 +157,11 @@ if (!this.webFontLoaded) {HTMLCSS.loadWebFontError(font,done)} else {done()} }, loadError: function (font) { - MathJax.Message.Set( - MathJax.Localization._("Message", "CantLoadWebFont", - "Can't load web font %1", HTMLCSS.fontInUse+"/"+font.directory), - null,2000); + MESSAGE(["CantLoadWebFont","Can't load web font %1",HTMLCSS.fontInUse+"/"+font.directory],null,2000); HUB.Startup.signal.Post(["HTML-CSS Jax - web font error",HTMLCSS.fontInUse+"/"+font.directory,font]); }, firefoxFontError: function (font) { - MathJax.Message.Set( - MathJax.Localization._(["Message", "FirefoxCantLoadWebFont"], - "Firefox can't load web fonts from a remote host"), - null,3000); + MESSAGE(["FirefoxCantLoadWebFont","Firefox can't load web fonts from a remote host"],null,3000); HUB.Startup.signal.Post("HTML-CSS Jax - Firefox web fonts on remote host error"); }, @@ -334,11 +329,8 @@ HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts"); } } else { - MathJax.Message.Set( - MathJax.Localization._(["Message", "CantFindFontUsing"], - "Can't find a valid font using %1", - "["+this.config.availableFonts.join(", ")+"]"), - null,3000); + MESSAGE(["CantFindFontUsing","Can't find a valid font using %1", + "["+this.config.availableFonts.join(", ")+"]"],null,3000); this.FONTDATA = { TeX_factor: 1, baselineskip: 1.2, lineH: .8, lineD: .2, ffLineH: .8, FONTS: {}, VARIANT: {normal: {fonts:[]}}, RANGES: [], @@ -1486,10 +1478,7 @@ this.imgFonts = true; HUB.Startup.signal.Post("HTML-CSS Jax - switch to image fonts"); HUB.Startup.signal.Post("HTML-CSS Jax - using image fonts"); - MathJax.Message.Set( - MathJax.Localization._(["Message", "WebFontNotAvailable"], - "Web-Fonts not available -- using image fonts instead"), - null,3000); + MESSAGE(["WebFontNotAvailable","Web-Fonts not available -- using image fonts instead"],null,3000); AJAX.Require(this.directory+"/imageFonts.js",done); } else { this.allowWebFonts = false; diff --git a/unpacked/jax/output/SVG/autoload/mglyph.js b/unpacked/jax/output/SVG/autoload/mglyph.js index 7a46b84a1..40fee2d86 100644 --- a/unpacked/jax/output/SVG/autoload/mglyph.js +++ b/unpacked/jax/output/SVG/autoload/mglyph.js @@ -1,5 +1,6 @@ /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ + /************************************************************* * * MathJax/jax/output/SVG/autoload/mglyph.js @@ -27,7 +28,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { var VERSION = "2.1"; var MML = MathJax.ElementJax.mml, SVG = MathJax.OutputJax.SVG, - BBOX = SVG.BBOX; + BBOX = SVG.BBOX, + LOCALE = MathJax.Localization; var XLINKNS = "http://www.w3.org/1999/xlink"; @@ -73,8 +75,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { } if (this.img.status !== "OK") { err = MML.merror( - MathJax.Localization._(["MathML", "BadMglyph"], - "Bad mglyph: %1", values.src) + LOCALE._(["MathML","BadMglyph"],"Bad mglyph: %1",values.src) ).With({mathsize:"75%"}); this.Append(err); svg = err.toSVG(); this.data.pop(); } else { diff --git a/unpacked/localization/fr/FontWarnings.js b/unpacked/localization/fr/FontWarnings.js new file mode 100644 index 000000000..18f87ef93 --- /dev/null +++ b/unpacked/localization/fr/FontWarnings.js @@ -0,0 +1,53 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{ + FontWarnings: { + isLoaded: true, + strings: { + + webFont: + "MathJax utilise les polices Web pour afficher les expressions " + + "mathématiques sur cette page. Celles-ci mettent du temps à être "+ + "téléchargées et la page serait affichée plus rapidement si vous "+ + "installiez les polices mathématiques directement dans le dossier "+ + "des polices de votre système.", + + imageFonts: + "MathJax utilise des images de caractères plutôt que les polices "+ + "Web ou locales. Ceci rend le rendu plus lent que la normale et "+ + "les expressions mathématiques peuvent ne pas s'imprimer à la "+ + "résolution maximale de votre imprimante", + + noFonts: + "MathJax n'est pas parvenu à localiser une police pour afficher "+ + "les expressions mathématiques et les images de caractères ne "+ + "sont pas disponibles. Comme solution de dernier recours, il "+ + "utilise des caractères Unicode génériques en espérant que votre "+ + "navigateur sera capable de les afficher. Certains pourront ne "+ + "être rendus de façon incorrect voire pas du tout.", + + webFonts: + "La plupart des navigateurs modernes permettent de télécharger "+ + "des polices à partir du Web. En mettant à jour pour une version "+ + "plus récente de votre navigateur (ou en changeant de navigateur) "+ + "la qualité des expressions mathématiques sur cette page pourrait "+ + "être améliorée.", + + fonts: + "%1 MathJax peut utiliser les %2 ou bien les %3. Téléchargez et"+ + "installez l'une de ces familles de polices pour améliorer votre"+ + "expérience avec MathJax.", + + PageDesigned: + "%1 Cette page est conçue pour utiliser les %2. Téléchargez "+ + " et installez ces polices pour améliorer votre expérience "+ + "avec MathJax", + + STIXfonts: + "Polices STIX", + + TeXfonts: + "Polices TeX de MathJax" + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/FontWarnings.js"); \ No newline at end of file diff --git a/unpacked/localization/fr/MathML.js b/unpacked/localization/fr/MathML.js new file mode 100644 index 000000000..2e53b2436 --- /dev/null +++ b/unpacked/localization/fr/MathML.js @@ -0,0 +1,49 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{ + MathML: { + isLoaded: true, + strings: { + + BadMglyph: + "Élement mglyph incorrect: %1", + + BadMglyphFont: + "Police de caractère incorrecte: %1", + + MathPlayer: + "MathJax n'est pas parvenu à configurer MathPlayer.\n\n"+ + "Vous devez d'abord installer MathPlayer. Si c'est déjà le cas,\n"+ + "vos paramètres de sécurités peuvent empêcher l'exécution des\n"+ + "contrôles ActiveX. Sélectionnez Options Internet dans le menu\n"+ + "Outils et sélectionnez l'onglet Sécurité. Appuyez ensuite sur\n"+ + "le menu Niveau Personalisé. Assurez vous que les paramètres\n"+ + "Exécution des contrôles ActiveX et Comportements des exécutables\n"+ + "et des scripts sont activés.\n\n"+ + "Actuellement, vous verez des messages d'erreur à la place des\n"+ + "expressions mathématiques.", + + CantCreateXMLParser: + "MathJax ne peut créer un analyseur grammatical XML pour le MathML", + + UnknownNodeType: + "Type de noeud inconnu: %1", + + UnexpectedTextNode: + "Noeud de texte inattendu: %1", + + ErrorParsingMathML: + "Erreur lors de l'analyse grammaticale du code MathML", + + ParsingError: + "Erreur lors de l'analyse du code MathML: %1", + + MathMLSingleElement: + "Le code MathML doit être formé d'un unique élément", + + MathMLRootElement: + "Le code MathML doit être formé d'un élément et non un élément %1" + + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/MathML.js"); \ No newline at end of file diff --git a/unpacked/localization/fr/MathMenu.js b/unpacked/localization/fr/MathMenu.js new file mode 100644 index 000000000..5d252526a --- /dev/null +++ b/unpacked/localization/fr/MathMenu.js @@ -0,0 +1,118 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{ + MathMenu: { + isLoaded: true, + strings: { + + Show: "Voir Maths Comme", + MathMLcode: "du Code MathML", + OriginalMathML: "d'Origine MathML", + TeXCommands: "Commandes TeX", + AsciiMathInput: "AsciiMathml Entrée", + Original: "Forme Originale", + ErrorMessage: "Message d'Erreur", + texHints: "Voir les notes TeX dans MathML", + Settings: "Paramètres Maths", + ZoomTrigger: "Trigger Zoom", + Hover: "Flotter", + Click: "Clic de Souris", + DoubleClick: "Double-Clic", + NoZoom: "Pas de Zoom", + TriggerRequires: "Trigger Nécessite", + Option: "Option", + Alt: "Alt", + Command: "Command", + Control: "Control", + Shift: "Shift", + ZoomFactor: "Facteur de Zoom", + Renderer: "Traduire Maths", + MPHandles: "Laissez MathPlayer Gérer:", + MenuEvents: "Sélections du menu", + MouseEvents: "Êvénements de la Souris", + MenuAndMouse: "Les Êvénements de Menu et de la Souris", + FontPrefs: "Préférences des Polices", + ForHTMLCSS: "Pour le HTML-CSS:", + Auto: "Auto", + TeXLocal: "TeX (local)", + TeXWeb: "TeX (web)", + TeXImage: "TeX (image)", + STIXLocal: "STIX (local)", + ContextMenu: "Menu Contextuel", + Browser: "Navigateur", + Scale: "Ajuster tous les Maths ...", + Discoverable: "Mettez en Surbrillance lors de Survol", + About: "À propos de MathJax", + Help: "Aide MathJax", + + localTeXfonts: "utilisant les polices locales TeX", + webTeXfonts: "utilisant les polices internet TeX", + imagefonts: "utilisant les polices d'image", + localSTIXfonts: "utilisant les polices locales STIX", + webSVGfonts: "utilisant les polices internet SVG", + genericfonts: "utilisant les polices locales génériques", + + wofforotffonts: "les polices woff ou otf", + eotffonts: "les polices eot", + svgfonts: "les polices svg", + + WebkitNativeMMLWarning: + "Votre navigateur ne semble pas comporter de support MathML, " + + "changer le mode de rendu pourrait rendre illisibles " + + "les expressions mathématiques.", + + MSIENativeMMLWarning: + "Internet Explorer a besoin de module complémentaire MathPlayer " + + "pour afficher le MathML.", + + OperaNativeMMLWarning: + "Le support MathML d'Opera est limité, changer le mode de rendu " + + "pourrait entrainer un affichage médiocre de certaines expressions.", + + SafariNativeMMLWarning: + "Le support MathML natif de votre navigateur ne comporte pas " + + "toutes les fonctionnalités requises par MathJax, certaines " + + "expressions pourront donc ne pas s'afficher correctement.", + + FirefoxNativeMMLWarning: + "Le support MathML natif de votre navigateur ne comporte pas " + + "toutes les fonctionnalités requises par MathJax, certaines " + + "expressions pourront donc ne pas s'afficher correctement.", + + SwitchAnyway: + "Êtes vous certain de vouloir changer le mode de rendu ?\n\n" + + "Appuyez sur OK pour valider ou Annuler pour continuer avec le " + + "mode de rendu actuellement sélectionné.", + + ScaleMath: + "Mise à l'échelle des expressions mathématiques (par rapport au " + + "text environnant) de %1%%", + + NonZeroScale: + "L'échelle ne peut être nulle", + + PercentScale: + "L'échelle doit être un pourcentage (e.g. 120%%)", + + IE8warning: + "Ceci désactivera le menu de MathJax et les fonctionalités de " + + "zoom mais vous pourrez toujours obtenir le menu de MathJax " + + "en utilisant la commande Alt+Clic sur une expression.\n\n" + + "Êtes vous certain de vouloir choisir les options de MathPlayer?", + + IE9warning: + "Le menu contextuel de MathJax sera désactivé, " + + "mais vous pourrez toujours obtenir le menu de MathJax " + + "en utilisant la commande Alt-Clic sur une expression.", + + NoOriginalForm: + "Aucune forme d'origine disponible.", + + Close: + "Fermer", + + EqSource: + "Source de l'équation MathJax" + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/MathMenu.js"); \ No newline at end of file diff --git a/unpacked/localization/fr/TeX.js b/unpacked/localization/fr/TeX.js new file mode 100644 index 000000000..33a83eea8 --- /dev/null +++ b/unpacked/localization/fr/TeX.js @@ -0,0 +1,254 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{ + TeX: { + isLoaded: true, + strings: { + ExtraOpenMissingClose: + "Accolade ouvrant manquante ou accolade fermante non attendue", + + ExtraCloseMissingOpen: + "Accolade fermante non attendue ou accolade ouvrante manquante", + + MissingLeftExtraRight: + "Commande \\left manquante or ou commande \\right non attendue", + + MissingScript: + "Argument en exposant ou en indice manquant", + + ExtraLeftMissingRight: + "Commande \\left inattendue or ou commande \\right manquante", + + Misplaced: + "Mauvaise position pour la commande %1", + + MissingOpenForScript: + "Accolade ouvrante manquante pour le script %1", + + AmbiguousUseOf: + "Usage ambigu de la commande %1", + + EnvBadEnd: + "\\begin{%1} s'est terminé par un \\end{%2}", + + EnvMissingEnd: + "\\end{%1} manquant", + + MissingBoxFor: + "Boite manquante pour la commande %1", + + MissingCloseBrace: + "Accolade fermante manquante", + + UndefinedControlSequence: + "Commande %1 non définie", + + IllegalControlSequenceName: + "Nom de contrôle de séquence non autorisé pour la commande %1", + + IllegalParamNumber: + "Nombre de paramètres incorrect pour la commande %1", + + DoubleExponent: + "Double exposant: utilisez des accolades pour clarifier", + + DoubleSubscripts: + "Double indice: utilisez des accolades pour clarifier", + + DoubleExponentPrime: + "Un prime entraine un double exposant: utilisez "+ + "des accolades pour clarifier", + + CantUseHash1: + "Vous ne pouvez pas utilisez le caractère #, indiquant un "+ + "paramètre de macro, dans le mode mathématique", + + CantUseHash2: + "Usage du caractère # non autorisé dans le modèle pour la séquence "+ + "de contrôle %1", + + MisplacedMiddle: + "La commande %1 doit être placée à l'intérieur d'une section "+ + "\\left ... \right", + + MisplacedLimits: + "La commande %1 n'est autorisée que sur les opérateurs", + + MisplacedMoveRoot: + "La commande %1 n'est autorisée qu'à l'intérieur d'une racine", + + MultipleMoveRoot: + "Commande %1 redondante", + + IntegerArg: + "L'argument de la commande %1 doit être un entier", + + PositiveIntegerArg: + "L'argument de la commande %1 doit être un entier strictement "+ + "positif", + + NotMathMLToken: + "L'élément %1 n'est pas un élément MathML élémentaire", + + InvalidMathMLAttr: + "Attribut MathML non valide: %1", + + UnknownAttrForElement: + "Attribut %1 inconnu pour l'élément %2", + + MaxMacroSub1: + "Le nombre maximal de substitution de macro autorisé par MathJax "+ + "a été dépassé. Il y a t'il un appel de macro récursif?", + + MaxMacroSub2: + "Le nombre maximal de substitution de macro autorisé par MathJax "+ + "a été dépassé. Il y a t'il un environnement LaTeX récursif?", + + MissingArgFor: + "Argument manquant pour la commande %1", + + ExtraAlignTab: + "Tabulation d'alignement non attendu pour le texte de la commande "+ + "\\cases", + + BracketMustBeDimension: + "L'argument entre crochets de la commande %1 doit être une "+ + "dimension", + + InvalidEnv: + "Nom d'environnement '%1' non valide", + + UnknownEnv: + "Environnement '%1' inconnu", + + ExtraClose: + "Accolade fermante non attendue", + + ExtraCloseInBrackets: + "Accolade fermante non attendue avant le crochet fermant.", + + MissingCloseBracket: + "Impossible de trouver le crochet fermant pour l'argument de la "+ + "commande %1", + + MissingOrUnrecognizedDelim: + "Délimiteur manquant ou non reconnu pour la commande %1", + + MissingDimOrUnits: + "Dimension ou unité manquante pour la commande %1", + + ExtraCloseBraceInUpTo: + "Accolade fermante non attendue avant la commande %1", + + TokenNotFoundForCommand: + "Impossible de trouver la commande %1 pour la commande %2", + + MathNotTerminated: + "Expression mathématique non terminée à l'intérieur de cette boite "+ + "de texte", + + IllegalMacroParam: + "Paramètre de référence de macro non autorisé", + + MaxBufferSize: + "Taille maximale du tampon interne de MathJax dépassée. " + + "Il y a t'il un appel de macro récursif?", + + CommandNotAllowedInEnv: + "La commande %1 n'est pas autorisé à l'intérieur de "+ + "l'environnement %2", + + MultipleCommand: + "Usage multiple de la commande %1", + + MultipleLabel: + "Étiquette '%1' déjà définie", + + CommandAtTheBeginingOfLine: + "La commande %1 doit être placée en début de ligne", + + IllegalAlign: + "Alignement non autorisé pour la commande %1", + + BadMathStyleFor: + "Style mathématique non valide pour la commande %1", + + ErroneousNestingEq: + "Emboitement incorrect des structures d'équation", + + MultipleRowsOneCol: + "Les lignes multiples doivent avoir exactement une colonne", + + NoClosingDelim: + "Impossible de trouver le délimiteur fermant pour la commande %1", + + NoClosingChar: + "Impossible de trouver le délimiteur '%1' fermant", + + MultipleBBoxProperty: + "La propriété %1 de la commande %2 spécifiée deux fois", + + InvalidBBoxProperty: + "La valeur '%1' ne semble pas être une couleur, une dimension ou "+ + "de marge intérieur ou un style.", + + ExtraEndMissingBegin: + "Commande %1 non attendue ou commande \\begingroup manquante", + + GlobalNotFollowedBy: + "Command %1 non suivie d'une commande \\let, \\def ou \newcommand", + + NewextarrowArg1: + "Le premier argument de la commande %1 doit être le nom d'une "+ + "séquence de contrôle", + + NewextarrowArg2: + "Le second argument de la commande %1 doit être deux entiers "+ + "séparés par une virgule", + + NewextarrowArg3: + "Le troisième argument de la commande %1 doit être la valeur d'un "+ + "caractère unicode", + + UndefinedColorModel: + "Le modèle de couleur '%1' n'est pas défini", + + rgbArg1: + "Les couleurs rgb nécéssitent 3 nombres décimaux", + + InvalidDecimalNumber: + "Nombre décimal non valide", + + rgbArg2: + "Les valeurs rgb doivent être comprises entre 0 et 1", + + RGBArg1: + "Les couleurs RGB nécéssitent 3 nombres", + + InvalidNumber: + "Nombre non valide", + + RGBArg2: + "Les valeurs RGB doivent être comprises entre 0 et 255", + + GrayScalerArg: + "Les valeurs de dégradé de gris doivent être comprises entre 0 et 1", + + DoubleBackSlash: + "\\ doit être suivi d'une séquence de contrôle", + + SequentialParam: + "Les paramètres de la séquence de contrôle %1 doivent être "+ + "énumérés de façon séquentielle", + + MissingReplacementString: + "Chaine de caractère de remplacement manquante pour la définition %1", + + MismatchUseDef: + "L'utilisation de la commande %1 ne correspond pas à sa définition", + + RunawayArgument: + "Argument manquant pour la commande %1?" + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/TeX.js"); \ No newline at end of file diff --git a/unpacked/localization/fr/fr.js b/unpacked/localization/fr/fr.js new file mode 100644 index 000000000..e48d29b37 --- /dev/null +++ b/unpacked/localization/fr/fr.js @@ -0,0 +1,72 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr,{ + isLoaded: true, + domains: { + "_": { + isLoaded: true, + strings: { + + CookieConfig: + "MathJax a trouvé un cookie de configuration utilisateur qui inclut"+ + "du code à exécuter. Souhaitez vous l'exécuter?\n\n"+ + "(Choisissez Annuler sauf si vous avez créé ce cookie vous-même", + + MathProcessingError: + "Erreur de traitement de la formule mathématique", + + MathProcessingErrorHTML: + ["[Erreur de traitement de la formule mathématique]"], + + MathErrorHTML: + ["[Erreur dans la formule mathématique]"], + + LoadFile: "Téléchargement %1", + + Loading: "Téléchargement", + + LoadFailed: "Échec du téléchargement de %1", + + CantLoadWebFont: "Impossible de télécharcharger la police Web %1", + + ProcessMath: "Traitement des maths: %1%%", + + Processing: "Traitement", + + TypesetMath: "Composition des maths: %1%%", + + Typesetting: "Composition", + + FirefoxCantLoadWebFont: + "Firefox ne peut télécharger les polices Web à partir d'un hôte"+ + "distant", + + CantFindFontUsing: + "Impossible de trouver une police valide en utilisant %1", + + WebFontsNotAvailable: + "Polices Web non disponibles -- des images de caractères vont être"+ + "utilisées à la place", + + MathJaxNotSupported: + "Votre navigateur ne supporte pas MathJax" + + } + }, + MathMenu: {}, + FontWarnings: {}, + "v1.0-warning": {}, + TeX: {}, + MathML: {} + }, + + plural: function(n) { + if (0 <= n && n < 2) {return 1} // one + return 2; // other + }, + + number: function(n) { + return n.replace(".", ","); // replace dot by comma + } + +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/fr.js"); \ No newline at end of file diff --git a/unpacked/localization/fr/v1.0-warning.js b/unpacked/localization/fr/v1.0-warning.js new file mode 100644 index 000000000..203ca9aeb --- /dev/null +++ b/unpacked/localization/fr/v1.0-warning.js @@ -0,0 +1,15 @@ +MathJax.Hub.Insert(MathJax.Localization.strings.fr.domains,{ + "v1.0-warning": { + isLoaded: true, + strings: { + MissingConfig: + "%1 MathJax ne charge plus de fichier de configuration par défaut; "+ + "vous devez spécifier ces fichiers de façons explicites. Cette "+ + "page semble utiliser l'ancien fichier de configuration par "+ + "défaut %2 and doit donc être mise à jour. Ceci est expliqué "+ + "en détails à l'addresse suivante: %3" + } + } +}); + +MathJax.Ajax.loadComplete("[MathJax]/localization/fr/v1.0-warning.js"); \ No newline at end of file